Skip to main content
sima2
Associate III
August 31, 2010
Question

USART delay?

  • August 31, 2010
  • 4 replies
  • 836 views
Posted on August 31, 2010 at 13:40

USART delay?

    This topic has been closed for replies.

    4 replies

    Andrew Neil
    Super User
    May 17, 2011
    Posted on May 17, 2011 at 14:04

    That will obviously depend upon the Baud Rate!

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    sima2
    sima2Author
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 14:04

    Sorry I wrote the wrong word. I meant the start bit. :)

    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:04

    It depends on the baud rate, and the state of the shift register when the buffer register is loaded. For 8 N 1, with the TXE going high, you are looking at 10 bit times. You should use the TC (transmit complete) flag/interrupt to know when the transmitter has completed.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:04

    >>Sorry I wrote the wrong word. I meant the start bit. :)

    It depends on how you want to use the USART. If you need to know the TX time for the start bit you are basically going to have to wait for *both* TXE and TC to be high, *then* load the byte you want to send. The time you load the register should be reasonably close to the time the start bit occurs. The USART is clock by a synchronous clock 16x the baud clock, as well as the APB clock. How accurately do you want to know the time? Do you want to be streaming bytes?

    You could get a reasonable estimate of the *last* byte transmit time for the start bit by watching the TXE bit going high indicating the last byte has entered the USART shift register.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..