Line 15: Line 15:
 
//This example prints a string on all the serial ports,  
 
//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.
 
//you need to connect a USB to serial convertor to check messages on hardware serial ports.
=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.
 
#[[Serial Communication using Explore M3|Bare metal serial communication with Explore M3]]
 
{{DISQUS}}
 
  
 
void setup() {
 
void setup() {
Line 36: Line 32:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
=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.
 +
#[[Serial Communication using Explore M3|Bare metal serial communication with Explore M3]]
 +
{{DISQUS}}

Revision as of 18:29, 23 May 2016

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.

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.

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