I’m currently developing code using the RAK11720 Arduino libraries (v4.2.2). I need to use UART1 with even parity, however the library always defaults to no parity. I have had to go into the library code to change this (uhal_uart.c function uart_init()). Please can you resolve this bug to the next library release and let me know when this has been implemented.
Hi @marinafinch ,
I can check this with the team. But as far as I know, parity bit configuration is not supported by RUI3.
Have you tried to directly set it via STM32 registered?
Something like this:
Serial.begin(115200);
// USART2 registers
// M0 bit (Bit 12) = 1 for 9-bit word length (8 data + 1 parity)
// PCE bit (Bit 10) = 1 for Parity Control Enable
// PS bit (Bit 9) = 0 for Even Parity (1 for Odd)
USART2->CR1 |= USART_CR1_M0; // Set Word length to 9 bits
USART2->CR1 |= USART_CR1_PCE; // Enable Parity
USART2->CR1 &= ~USART_CR1_PS; // Set to Even Parity
This compiles but I haven’t tested.