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
4 REPLIES 4
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..