Skip to main content
nichtgedacht
Associate III
January 28, 2017
Question

uart 9-O-2 protocol

  • January 28, 2017
  • 2 replies
  • 446 views
Posted on January 28, 2017 at 17:54

Is it really impossible to set the STM32 MCU UART for 9-O-2 or 9-O-1 ?

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    January 28, 2017
    Posted on January 28, 2017 at 18:09

    As stated, it is not possible. You might be able to fake such output using SPI

    Not that those are prolifically used, this sounds like a pretty niche configuration based on some other hardware in that space.

    The USART can send 9 data bits, including parity and up to 2 stop bits.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    T J
    Senior III
    January 28, 2017
    Posted on January 28, 2017 at 23:45

    You can bitbash using a port pin. using a timer interrupt.

    easy enough...

    what baud rate ?

    if the baud rate is high, then you will have to use the ouputCompare function of a timer pin to set the pin in advance of the bit boundary.

    ie.

    initialise timer interrupt for 1 bit time, set the pin high and set the pin to toggle on OC event. this will send the start bit at the instant of the timer interrupt.

    then set the next transition to be high or low, and reset the OC trigger.

    but I don't think you could go above 115200. without using 50% of the cpu time.