Skip to main content
Nikunj Patel
Associate III
January 8, 2021
Solved

UART1 Configuration for Data Bits(Word Length) 7.

  • January 8, 2021
  • 3 replies
  • 2464 views

Hi @All ALL​ @Martin KJELDSEN​ 

I am using STM32F412CGU6 microcontroller.

I would like to Configure UART1 with following settings.

  • Baud Rate: 9600

  • Start bits: 1

  • Parity: Even

  • Data Bits: 7

  • Flow Control: Off

  • Stop Bits: 1

In STM32CubeMX, There is no configuration available for Data Bits 7.

So, How can I configure the above UART settings.

Thanks 

Nikunj Patel

This topic has been closed for replies.
Best answer by TDK

Setting a word length of 8 bits and even parity will get you what you want. The word length is inclusive of the parity bits.

3 replies

Peter BENSCH
Technical Moderator
January 8, 2021

That is correct, as the USART in the STM32F4xx only support a data word length of 8 or 9 bit.

You need to switch to another STM32, e.g. STM32L4xx to be able to use a data word length of 7, 8 or 9 bit.

Good luck!

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
TDK
TDKBest answer
Super User
January 8, 2021

Setting a word length of 8 bits and even parity will get you what you want. The word length is inclusive of the parity bits.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Peter BENSCH
Technical Moderator
January 8, 2021

@TDK​ is absolutely right, I haven't seen the parameter Parity: Even.

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.