Skip to main content
rsoc
Associate III
Feb 5, 2021 6:03 PM UTC
Solved

Use of Odd Parity in USART1 Configuration -- stm32L452RE uC

Hi--

I/m pretty stumped. I am trying to implement a odd parity configuration for USART1 in an stm32L452RE micro. I've confirmed without parity the usart behaves as expected at the needed baud. When i introduce parity into the code and sniff the data out of a logic analyzer, the data is error filled. I am probably doing something stupid, but wondering if someone sees something in my function to initialize the USART1 i am missing...

If it is not the init function, is the transmit using parity different than typical usart? Could I be getting caught there?

Thank you!

This topic has been closed for replies.
waclawek.jan
waclawek.janBest answer
Super User
Feb 5, 2021 6:05 PM UTC

In STM32, quite untypically, the parity bit counts towards the total number of bits. So, if you want to implement 8P1, you have to set 9 data bits.

JW

2 replies

waclawek.jan
waclawek.janBest answer
Super User
Feb 5, 2021 6:05 PM UTC

In STM32, quite untypically, the parity bit counts towards the total number of bits. So, if you want to implement 8P1, you have to set 9 data bits.

JW

rsoc
rsocAuthor
Associate III
Feb 5, 2021 6:11 PM UTC

for whatever reason my code didnt paste, but the response is spot on. good to go, thank you!