2022-02-10 12:57 PM
Hi
We are using the STM32L4S7AI. We have USART2 configured as 9-bit data.
We are using the HAL and have been using 8-bit HAL on many STM32 for a while... this is our first 9-bit data use.
We set UART_InitTypeDef.WordLength to UART_WORDLENGTH_9B.
On the wire, we have this message:
We have our UART configured as 19200, 9bit, 2 STOP, no parity.
So... for the first byte, given the image in the STM MCU guide:
I'd expect this to be LSB to MSB and have a value of 2 when read.
We are reading RDR under interrupt. It is a 16bit register:
uint16_t data = READ_REG( port->hwport->Instance->RDR );
data is assigned to 1.
The values on the wire above read as 001 0FE 0F7 0D7 1BE
Why is the STM32 treating the first bit on the wire as the 9th bit?
Thanks
Solved! Go to Solution.
2022-02-10 01:59 PM
Looks like you're inverting, the TWO STOP BITs are HIGH, the START BIT is LOW
First 9-bit word here is 0x1FD, second 0x003, third is 0x011
An RS232 level shifter would invert the signal
2022-02-10 01:59 PM
Looks like you're inverting, the TWO STOP BITs are HIGH, the START BIT is LOW
First 9-bit word here is 0x1FD, second 0x003, third is 0x011
An RS232 level shifter would invert the signal
2022-02-10 08:43 PM
Now I feel dumb. It was 2-wire 485 and the lines were reversed. Now it looks good.
Thanks!