cancel
Showing results for 
Search instead for 
Did you mean: 

UART 7 data bits

kbcloud
Associate
Posted on December 10, 2012 at 01:57

The manual says that the STM32 supports only 8 and 9 word length for UART.

But I need 7 data bits.

How can I configure the 7 data bits?

#7-databits-uart-usart
3 REPLIES 3
Posted on December 10, 2012 at 03:25

Presumably by configuring as 8-bit and have the eighth bit being stuffed as a extra stop bit?

USARTx->DR = x | 0x80; // Add High Stop bit

..

x = USARTx->DR & 0x7F;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
kbcloud
Associate
Posted on December 10, 2012 at 07:21

Thank you for help.

But there might be framing errors when the counter part UART transmits 1 start, 7 data bits and 1 stop bit.

The 1 stop bit might be considered as the 8th data bit by the STM UART side.

And it might expect ''1 stop bit''(signal HIGH).

If the counter UART start to transmit another byte by sending STX (signal LOW) in this moment, then there might be framing error.

How do you think about this scenario?

Posted on December 10, 2012 at 15:32

How do you think about this scenario?

I think you are going to have to evaluate it, and validate it to your own satisfaction, the STM32's don't have a 7N1 configuration.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..