cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Communication between 7E1 and 8N1

karatepe101
Associate II
Posted on July 28, 2015 at 09:30

Hi all,i am using STM32F0 and i want communication between 7E1 and 8N1.But STM32F0 haven't 7 bit communication option. How can i do this?

Thank you
6 REPLIES 6
Posted on July 28, 2015 at 09:47

> Hi all,i am using STM32F0 and i want communication between 7E1 and 8N1.But STM32F0 haven't 7 bit communication option.

In the STM32 U(S)ARTs, parity bits are included in the data bits, so use the 8-bit option.

JW
karatepe101
Associate II
Posted on July 28, 2015 at 10:10

Thank you jan for your answer. In my opinion,i should use 8E1(for 7E1 communication) and 8N1.

When i sent data 8E1 to 8N1,i should Data&(0x7F) for remove parity bit.When i sent data 8N1 to 8E1,i should Data&~(0x80) for add even partiy bit.Am i right?

karatepe101
Associate II
Posted on July 28, 2015 at 13:02

My problem solved.I did as above and worked 

Posted on July 28, 2015 at 15:08

You don't have to do anything when writing the transmit register, the STM32 adds the parity bit.  When reading you want to mask either with & 0x7F, or & 0xFF, for the 7 and 8 bit data lengths.

For 7E1 you'd configure the USART in 8-bit mode with parity, for 8E1 you'd configure in 9-bit mode with parity.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
praveen2
Associate II

Hi all,i am using STM32C011F4U6 and i want communication between Uart1 _8N1 and Uart2_7E1.But STM32C0 haven't 7 bit communication option. How can i do this?
Thank you

@praveen2 Please also refer to this thread where you have asked the same question.

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.