Skip to main content
Visitor II
July 28, 2015
Question

STM32 Communication between 7E1 and 8N1

  • July 28, 2015
  • 5 replies
  • 2030 views
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
    This topic has been closed for replies.

    5 replies

    Super User
    July 28, 2015
    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
    Visitor II
    July 28, 2015
    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?

    Visitor II
    July 28, 2015
    Posted on July 28, 2015 at 13:02

    My problem solved.I did as above and worked 

    Graduate II
    July 28, 2015
    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.

    Visitor II
    August 28, 2024

    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

    Technical Moderator
    August 29, 2024

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