Set stop bits for Arduino Due using IDE 1.5.2

I am using a LCD that is connected to my Due using the RX1 pin. The LCD specifications state that while using the serial connection at 9600 baud that it takes 8 data bits and 2 stops bits with no parity. I am using IDE 1.5.2 to program my Due and based on my research I have found that I need to set this information using the Serial1.begin command. However, I have found 2 methods for setting data and neither one is accepted by the complier as valid.

Using:
Serial1.begin(9600, SERIAL_8N2);

Gives the error:
WireTester.ino: In function 'void setup()':
WireTester:18: error: 'SERIAL_8N2' was not declared in this scope

Using:
Serial1.begin(9600, 8, 2, N);

Gives the error:
WireTester.ino: In function 'void setup()':
WireTester:18: error: 'N' was not declared in this scope

What is the proper method for setting this information?

Did you include <serial.h> at the top of your program? That sets the #defines used like SERIAL_8N2

I didn't not include <serial.h>. I added it to the code and this came up:
fatal error: serial.h: No such file or directory compilation terminated.

There is no serial library included in the list of libraries from the 1.5.2 download. Is it located somewhere else?

Serial port configuration is currently not implemted on the Due (it was introduced on AVR boards just before the release of Due core).

I opened an issue to keep track of this:

Guys,

Unfortunately the processor UART serial does not support anything other than 1 stop bit.
You'll have to change to one of the available USART ports which are full featured and support 1, 1.5 and 2 stop bits.

The SAM USART (I assume Serial1 is on a USART) does support 2 stop bits but you'll have to do the setup yourself by the sounds of it.

Write 2 into the NBSTOP field of the appropriate US_MR register. See section 36.8.2 of the data sheet.


Rob

Yes, exactly as I mentioned above.

Here's how to do it assuming you'll be using Serial1:

Serial1.begin(SERIAL_9600_BAUD);
USART1->US_MR = US_MR_USART_MODE_NORMAL | US_MR_USCLKS_MCK | US_MR_CHRL_8_BIT | US_MR_PAR_NO |
US_MR_NBSTOP_2_BIT | US_MR_CHMODE_NORMAL;

For anyone else trying to get this to work on a Due the above is correct except if using Serial1 you should configure USART0 not USART1.

  Serial1.begin(9600);
  USART0->US_MR = US_MR_USART_MODE_NORMAL | US_MR_USCLKS_MCK | US_MR_CHRL_8_BIT | US_MR_PAR_NO |
                US_MR_NBSTOP_2_BIT | US_MR_CHMODE_NORMAL;

Would be very nice if the Serial.begin(speed, config) function was ported for the Due!