You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right,
After checking HAL uart:
Depending on the frame length defined by the M1 and M0 bits (7-bit,
8-bit or 9-bit), the possible UART formats are listed in the
following table.
Table 1. UART frame format.
+-----------------------------------------------------------------------+
| M1 bit | M0 bit | PCE bit | UART frame |
|---------|---------|-----------|---------------------------------------|
| 0 | 0 | 0 | | SB | 8 bit data | STB | |
|---------|---------|-----------|---------------------------------------|
| 0 | 0 | 1 | | SB | 7 bit data | PB | STB | |
|---------|---------|-----------|---------------------------------------|
| 0 | 1 | 0 | | SB | 9 bit data | STB | |
|---------|---------|-----------|---------------------------------------|
| 0 | 1 | 1 | | SB | 8 bit data | PB | STB | |
|---------|---------|-----------|---------------------------------------|
| 1 | 0 | 0 | | SB | 7 bit data | STB | |
|---------|---------|-----------|---------------------------------------|
| 1 | 0 | 1 | | SB | 6 bit data | PB | STB | |
+-----------------------------------------------------------------------+
In HardwareSerial.cpp:
void HardwareSerial::begin(unsigned long baud, byte config)
{
_serial.baudrate = (uint32_t)baud;
// Could be 8 or 9 bits. Could match with Arduino small data length?
_serial.databits = UART_WORDLENGTH_8B;
if((config & 0x30) == 0x30) {
_serial.parity = UART_PARITY_ODD;
} else if((config & 0x20) == 0x20) {
_serial.parity = UART_PARITY_EVEN;
} else {
_serial.parity = UART_PARITY_NONE;
}
if parity is set odd or even, need to set : _serial.databits = UART_WORDLENGTH_9B;
and it is ok.
I need to check all possible value provided in HardwareSerial.h, I think HAL could not deal with all those config (5bits?...):
Activity
fpistm commentedon Jul 1, 2017
Right,
After checking HAL uart:
Depending on the frame length defined by the M1 and M0 bits (7-bit,
8-bit or 9-bit), the possible UART formats are listed in the
following table.
Table 1. UART frame format.
In HardwareSerial.cpp:
if parity is set odd or even, need to set :
_serial.databits = UART_WORDLENGTH_9B;and it is ok.
I need to check all possible value provided in HardwareSerial.h, I think HAL could not deal with all those config (5bits?...):
Adminius commentedon Jul 2, 2017
I changed to:
and it works (also with my HW that requires 19200 8E1).
Fix Serial config
fpistm commentedon Jul 3, 2017
Tested with: