Pages: [1]   Go Down
Author Topic: Arduino Due Hardware Serial Confusion  (Read 1573 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 2
Posts: 68
Good Vibes, Bad Vibes, Random Vibe
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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:
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.
Logged

Nowhere at all
Offline Offline
Newbie
*
Karma: 0
Posts: 43
Patience, discipline
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!

BR

Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 68
Good Vibes, Bad Vibes, Random Vibe
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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.
Logged

Nowhere at all
Offline Offline
Newbie
*
Karma: 0
Posts: 43
Patience, discipline
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

BR
Logged

Pages: [1]   Go Up
Jump to: