Skip to main content
Associate
December 10, 2025
Solved

Does enabling MSBFIRST change the position of the parity bit in the USART frame?

  • December 10, 2025
  • 2 replies
  • 555 views

Hi everyone,

I’m working with an STM32L5 USART and trying to clarify a point about parity vs. MSB-first transmission.

From the reference manual (USART parity control / frame formats), when parity is enabled the frame formats are shown as:

  • M=00, PCE=1: SB | 7-bit data | PB | STB

  • M=01, PCE=1: SB | 8-bit data PB | STB

and there is a note that “in the data register, the PB is always taking the MSB position (8th or 7th depending on M)”.

This wording caused confusion in our class:
one interpretation is that because parity occupies the MSB position in the data register/word length, it might be transmitted before the data bits when MSBFIRST=1.

My understanding is:

  • MSBFIRST only reverses the order of the data bits inside the data field.

  • The parity bit remains the parity field in the frame, i.e. logically after the data field and before stop bits.

  • The “MSB position” note refers to the bit slot within the word length/data register, not to the time order on the line.

Could someone confirm:

Question:
When MSBFIRST is enabled or disabled, does the parity bit position in the transmitted frame change?
Or is it always the same frame structure (SB → data bits (order depends on MSBFIRST) → PB → stop)?

If possible, a short explanation referencing how the hardware maps parity into TDR/RDR vs. the actual serial bit timing would be very helpful.

Thanks!

Best answer by waclawek.jan

This might've been better documented, but it's also easy to test. I've just did that, and it works so that the parity bit is always transmitted as the last bit in the frame, just before the stop bit, regardless of MSBFIRST setting.

In other words, MSBFIRST impacts only the ordering of data bits.

JW

2 replies

Andrew Neil
Super User
December 10, 2025

A classic example of where a diagram can provide a far better description that words!

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate
December 11, 2025

Thanks for your reply.

I agree that a diagram is helpful – that’s exactly why I’m asking. :)
What I’m trying to confirm is a very specific point about the STM32 USART: 
- Does enabling MSBFIRST change the position of the parity bit in the transmitted frame, or not?

 

waclawek.jan
waclawek.janBest answer
Super User
December 14, 2025

This might've been better documented, but it's also easy to test. I've just did that, and it works so that the parity bit is always transmitted as the last bit in the frame, just before the stop bit, regardless of MSBFIRST setting.

In other words, MSBFIRST impacts only the ordering of data bits.

JW

Associate
December 14, 2025

Thank you very much for testing this and confirming it.
Your explanation that the parity bit is always transmitted as the last bit before the stop bit, and that MSBFIRST only affects the ordering of the data bits, clears up the confusion I had when reading the reference manual.
This fully answers my question, thanks again!