sochinho
Posts: 1
Joined: Fri Jan 23, 2015 11:42 am

Measure delay in transmitting bytes via uart

Fri Jan 23, 2015 12:00 pm

Hi.
We have task to write program which will be measuring delay in transmitting bytes via UART. We have problem, because it's practically imperceptible. We thought that it could be done by measuring time from starting of interrupt, caused rising edge on RxD pin to writing bytes to ttyAMA0, but we don't know if it's possible to enable interrupts on RxD pin. Is anyone who knows how we can do it or have another idea?
Thanks!

RaspISteve
Posts: 98
Joined: Wed Oct 24, 2012 9:15 pm
Location: Cheltenham, UK

Re: Measure delay in transmitting bytes via uart

Tue Jan 27, 2015 11:32 pm

sochinho, are you being asked to determine the latency between and new character arriving/leaving the UART and the point at which the Pi is actively dealing with it or between characters arriving/leaving the UART.

If it's just leaving/arriving in the UART the internal buffering will hid all of it. Remember that in async transmission each character has an overhead of one start bit and one, one and a half or two stop bits depending of baud rate (high baud rates tend to have one start and one stop bit). So for every 8 bit character, 10 (or more) bits are transacted. This extra time is more than enough for most computer systems deal with characters without any delays or gaps in the character stream.

If the task is response time from new character event to event completion it'll depend on what else is happening in the system and relative priories in any scheduling system.
Share and Enjoy.

User avatar
joan
Posts: 14472
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Measure delay in transmitting bytes via uart

Wed Jan 28, 2015 8:21 am

You will need to clarify what time you are trying to measure. At the moment it is not clear.

What event starts the timer?
What event stops the timer?

Return to “Advanced users”