Go Down

Topic: Arduino Due Multiple serial (Read 1 time) previous topic - next topic


i'm using Serial, Serial1 and Serial2 on a Mega 2560 but the same code don't walk on the Due.
It compile and can be set on the DUE but it looks like the data received over Serial1 and Serial2 cant be read.

Serial2.available()  always return 0

How to use Serial1 and 2 on Due board please?


It compile
What do?

What is connected to the Serial1 and Serial2 pins?

The Mega is a 5V board. The DUE isn't. Does that matter?
The art of getting good answers lies in asking good questions.


I found were the bug come from but i didn't find a solution yet.
Actually my code work if i use begin like this:


but not with this:

byte value = something (any parameters for serial settings)
Serial1.begin(9600, value);
Serial2.begin(9600, value);

// Define config for Serial.begin(baud, config);
#define SERIAL_5N1 0x00
#define SERIAL_6N1 0x02
#define SERIAL_7N1 0x04
#define SERIAL_8N1 0x06
#define SERIAL_5N2 0x08
#define SERIAL_6N2 0x0A
#define SERIAL_7N2 0x0C
#define SERIAL_8N2 0x0E
#define SERIAL_5E1 0x20
#define SERIAL_6E1 0x22
#define SERIAL_7E1 0x24
#define SERIAL_8E1 0x26
#define SERIAL_5E2 0x28
#define SERIAL_6E2 0x2A
#define SERIAL_7E2 0x2C
#define SERIAL_8E2 0x2E
#define SERIAL_5O1 0x30
#define SERIAL_6O1 0x32
#define SERIAL_7O1 0x34
#define SERIAL_8O1 0x36
#define SERIAL_5O2 0x38
#define SERIAL_6O2 0x3A
#define SERIAL_7O2 0x3C
#define SERIAL_8O2 0x3E

i tried some values but don't work.

Go Up