Skip to main content
kbcloud
Associate
December 10, 2012
Question

UART 7 data bits

  • December 10, 2012
  • 3 replies
  • 1179 views
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
This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
December 10, 2012
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 VenmoUp vote any posts that you find helpful, it shows what's working..
kbcloud
kbcloudAuthor
Associate
December 10, 2012
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?

Tesla DeLorean
Guru
December 10, 2012
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 VenmoUp vote any posts that you find helpful, it shows what's working..