Skip to main content
LMI2
Senior III
May 1, 2020
Question

CubeMX counts USART parity as data? A bug in CubeMX

  • May 1, 2020
  • 4 replies
  • 1158 views

Actually it says it counts parity bit in USART word lenght. I'm pretty sure that is not so and perhaps even not what they would actually do, and what is word in this contekst anyway.

0693W000000WnX8QAK.png

This topic has been closed for replies.

4 replies

TDK
Super User
May 2, 2020

It counts it in the word length. Whether or not you consider it data is up to you. CubeMX is just following what the chip does. Start bit + word + stop bit(s).

Tesla DeLorean
Guru
May 2, 2020

ST has done this forever.

8E1 would be 9-bit with Even Parity in the 9th bit, advisable to mask the read of the data register

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
LMI2
LMI2Author
Senior III
May 2, 2020

Has anyone ever user parity bit.

TDK
Super User
May 2, 2020
Yes.
Used by the bootloader as well.
MarcV
Associate II
May 7, 2020

Programming the usart was about the very first thing I did with STM32 and CubeMX and I immediately ran into a CubeMX bug. I had to setup a communication using 8 databits, even parity, one stopbit and couldn't get it to work. After a bit of frustration I tried the same program but I modified the code on both ends to use 8 databits and NO parity and it worked right away. It turned out that, when using 8E1 parameters, CubeMX has to set the usart to 9 databits but instead it set 8 databits, causing the communication to fail. So whenever I make a modification to the project in MX and regenerate the code, I have to remember to manually correct the generated output.