Go Down

Topic: Arduino Due Hardware Serial Confusion (Read 4195 times) previous topic - next topic


Are the three hardware serial ports functioning?  How do I instruct the Due which port to use for communication?  The given examples apply to non-Due boards with a single hardware port.

If hardware serial is not available, what about software serial?  I tried compiling the softwareserial.h library, but received this message:

Code: [Select]

C:\Programs\arduino-1.5.1r2\hardware\arduino\sam\libraries\SoftwareSerial\SoftwareSerial - Copy.cpp:125: error: #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors

Your help is appreciated.  Thanks.


You shouldnt need to use softserial on Due, since you already have 4 serial ports!

To select which one you want to send the command to, simply add the number of the serial port after the "Serial" state.

For example:

Serial.begin(9600); would affect TX0/RX0, since you didnt write a number.
Serial1.print("Hello"); would affect TX1/RX1.
Serial2.read(); would affect TX2/RX2.

I hope this helps!



Bi0H4z4rD - thank you, that was very helpful.  Appending the serial port number to the "serial" command was not obvious in the documentation.  This will be much better than software serial.

What's the cleanest way to setup a communication task with serial put to the side while the main loop is running?  Or does this happen by default already?  My concern is that the serial task will be much slower than the main program.

Thank you.


You cant do parallel tasking. Only one instruction can be active at a time, so if you want to do stuff until you receive data on serial for example, i would recommend to check from time to time if there is anything in the serial data buffer.

And dont worry, you would need to do pretty heavy stuff to slow down the due by using serial.

Best method: loop--->(Code, test, improve+research) until you are satisfied with results.


Go Up