In this tutorial, we will look at the hardware serial ports of the Explore M3. Having four hardware serial ports is awesome isn't it? Now you can connect all of your GPS, GSM, Bluetooth, WiFi and what not, without using soft serial ports.

In fact Explore M3 has additional Virtual Serial COM port. The USB port not only is used to upgrade firmware but also it double up has virtual com port. That means you can send messages to the computer without additional USB to Serial chip like the CP2102 or FTDI. 0 UART main.gif Alright, so lets get started. I will do a simple test example now to print serial port messages and sometime later will will connect multiple serial devices.

Hookup

Simply plug in the USB cable to test the virtual com port and USB to serial converter to other serial ports. Note that transmit(Tx) should be connected to Receive(Rx) of the USB to serial converter and Rx to Tx.

Serial Port UART Channel Explore M3 Pin
COM 0 RX0 0
TX0 1
COM 1 RX1 6
TX1 7
COM 2 RX2 4
TX2 5
COM 3 RX3 2
TX3 3
USB Serial Plug in the USB cable

Code

//Example to test all serial ports at once.
//Explore M3 has 4 hardware serial ports and 1 USB serial.
//Serial --refers to USB Serial
//Serial0, Serial1, Serial2 and Serial3 refer to the hardware serial ports.
// Refer the pinout diagram for more details
//This example prints a string on all the serial ports, 
//you need to connect a USB to serial convertor to check messages on hardware serial ports.
 
void setup() {
  Serial.begin(9600);// refers to USB Serial, the baud rate actually has no meaning.
  Serial0.begin(9600);
  Serial1.begin(9600);
  Serial2.begin(9600);
  Serial3.begin(9600);
}
 
void loop() {
  Serial.println("Message printed on USB Serial");
  Serial0.println("Serial communcation with Serial 0");
  Serial1.println("Serial communcation with Serial 1");
  Serial2.println("Serial communcation with Serial 2");
  Serial3.println("Serial communcation with Serial 3");
}

Going further

Now, that we are happy with serial communication with Arduino. I would recommend you to dig deeper especially if you're building a product around the chip with these bare metal tutorial.

  1. Bare metal serial communication with Explore M3