cancel
Showing results for 
Search instead for 
Did you mean: 

UART1 Configuration for Data Bits(Word Length) 7.

Nikunj Patel
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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".

View solution in original post

3 REPLIES 3
Peter BENSCH
ST Employee

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
Guru

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
ST Employee

@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.