Serial Config Error

Hi all,
I've searched if there were a question about this issue but I haven't found something about. So I'm trying to modify serial connection parity and databits as describe in online guide, but compiler give me an error.

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
  Serial2.begin(9600,SERIAL_7E1);
}
Arduino:1.5.6-r2 (Windows 7), Scheda:"Arduino Due (Programming Port)"
In function 'void setup()':
error: 'SERIAL_7E1' was not declared in this scope

I've seen that it could be a compiler issue, so I've tried to use Arduino IDE 1.0.5 and it didn't get me error, but it can't support Arduino Due. So how can I resolve this problem?
Thanks all for reply :slight_smile:

In Arduino IDE 1.5.X the SAM HardwareSerial library doesn't handle a config parameter in the begin function like the AVR HardwareSerial.

Hi Paliser thanks for replay :slight_smile: Do you know another way so configure it?

Sorry mrlele. Currently there is not serial port config implemented on Due. A year ago the people from Arduino opened an issue but still empty:
Add parity and stop bit configuration for HardwareSerial on Arduino Due · Issue #1343 · arduino/Arduino · GitHub .
P

Reading issue post, I could use this solution to resolve problem temporally :

Serial1.begin(9600);
  USART0->US_MR = US_MR_USART_MODE_NORMAL | US_MR_USCLKS_MCK | US_MR_CHRL_7_BIT | US_MR_PAR_EVEN |
                US_MR_NBSTOP_1_BIT | US_MR_CHMODE_NORMAL;

Currently there is not serial port config implemented on Due. A year ago the people from Arduino opened an issue but still empty:

Just how well is the Due supported? And if the Due port is not complete after all this time what does that say for the other new boards?


Rob

I've submitted a pull request that should allow you to set the config for Serial1, Serial2 and Serial3 as they use the USART. Serial cannot be fixed as it uses the UART module instead.

If you're interested in trying the fix then you can find the changes here: Add config options to due Serial1, 2, and 3 by bluesign2k · Pull Request #1998 · arduino/Arduino · GitHub