Skip to main content
Visitor II
August 29, 2024
Solved

Uart Parity and Data bit issue in STM32C0 Series

  • August 29, 2024
  • 4 replies
  • 1524 views

Hi all,i am using STM32C011F4U6 and i want communication between Uart1 _baud rate -115200 _8N1 and Uart2_Baud rate _4800_7E1.But STM32C0 haven't 7 bit communication option. How can i do this?

Thank you

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    Rest-of-World

    8E1

    ST

    UartHandle.Init.WordLength = UART_WORDLENGTH_9B; // 8+Parity
    UartHandle.Init.StopBits = UART_STOPBITS_1;
    UartHandle.Init.Parity = UART_PARITY_EVEN;

     

    Rest-of-World

    7E1

    ST

    UartHandle.Init.WordLength = UART_WORDLENGTH_8B; // 7+Parity
    UartHandle.Init.StopBits = UART_STOPBITS_1;
    UartHandle.Init.Parity = UART_PARITY_EVEN;

    4 replies

    Technical Moderator
    August 29, 2024

    Welcome @praveen2, to the community!

    first of all: please don't post the same question twice.

    Then: what makes you think that the C011 cannot be set to 7bit?
    As @Tesla DeLorean explained in the other thread, you have to programme a word length of 8 bits for 7N1. The RM0490 also mentions under USART main features: Programmable data word length (7, 8 or 9 bits).

    Does it answer your question?

    Regards
    /Peter

    Super User
    August 29, 2024

    CubeMX settings for 7E1 are as follows:

    TDK_0-1724936783598.png

    Note that "word length" includes the parity bit.

    Graduate II
    August 29, 2024

    >>i want communication between

    How exactly?

    The data rates are significantly different, so you'll likely need some depth of buffering to cope, as long as the overall volume is manageable.

    You want to forward data between the two UARTs? One direction, or both?

    Writing code will be easier if you can clearly communicate what the actual task is. Perhaps draw a diagram if that's helpful. Break the problem in to pieces.

    Graduate II
    August 29, 2024

    Rest-of-World

    8E1

    ST

    UartHandle.Init.WordLength = UART_WORDLENGTH_9B; // 8+Parity
    UartHandle.Init.StopBits = UART_STOPBITS_1;
    UartHandle.Init.Parity = UART_PARITY_EVEN;

     

    Rest-of-World

    7E1

    ST

    UartHandle.Init.WordLength = UART_WORDLENGTH_8B; // 7+Parity
    UartHandle.Init.StopBits = UART_STOPBITS_1;
    UartHandle.Init.Parity = UART_PARITY_EVEN;

    praveen2Author
    Visitor II
    August 30, 2024

    Thanks for your support ,problem solved.I did as above setting @Tesla DeLorean .