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

  1. //Example to test all serial ports at once.
  2. //Explore M3 has 4 hardware serial ports and 1 USB serial.
  3. //Serial --refers to USB Serial
  4. //Serial0, Serial1, Serial2 and Serial3 refer to the hardware serial ports.
  5. // Refer the pinout diagram for more details
  6. //This example prints a string on all the serial ports,
  7. //you need to connect a USB to serial convertor to check messages on hardware serial ports.
  8.  
  9. void setup() {
  10. Serial.begin(9600);// refers to USB Serial, the baud rate actually has no meaning.
  11. Serial0.begin(9600);
  12. Serial1.begin(9600);
  13. Serial2.begin(9600);
  14. Serial3.begin(9600);
  15. }
  16.  
  17. void loop() {
  18. Serial.println("Message printed on USB Serial");
  19. Serial0.println("Serial communcation with Serial 0");
  20. Serial1.println("Serial communcation with Serial 1");
  21. Serial2.println("Serial communcation with Serial 2");
  22. Serial3.println("Serial communcation with Serial 3");
  23. }

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

Explore M3 Introduction

Explore M3 is a feature rich ARM Cortex M3 development board. It can help you prototype ideas faster with Arduino/mbed and take them be beyond with bare metal programming, RTOS support and lower power...

Arduino Setup for Explore M3

In this tutorial we will look at the basic setups of setting up the ExploreM3 on Arduino and installing DFU and Vcom drivers on Windows, Linux and MAC. Finally we will flash a simple led-blink example...

Led Blink with Explore M3

Blinking an LED is fun for a newbie, a setup test for a Embedded Developer and for this tutorial it getting started with Explore M3 and answering some basic questions like, where did it come from...

Explore M3 Arduino Libraries

Arduino libraries need no introduction. There are numerous devices and peripherals that work with Arduino. This page lists all the libraries that have been tested or ported to Explore M3. ...