[En-Nut-Discussion] Timing problems with UART
Ulrich Prinz
ulrich.prinz at googlemail.com
Sun Nov 6 00:48:23 CET 2011
Hi Klaus
On 04.11.2011 09:06, Klaus Kloos wrote:
> Hello
>
> Im on a SAM7ek using Ethernut 4.10.
> When I send a block of 513 bytes (DMX) sometimes (every 1-5s) the execution last a little bit longer (ca up to 3 Bytes) , as if additional time is spend somewhere while sending. Most of the time the signal length is very constant.
> As long as I understand the UART is driven by hardware and the only problem i can think off is that somewhere the UART is disabled for a short time.
> Does anyone have an idea where to search for? For example, is NutEnterCritical() stopping the UART?
>
Two options can break the USART timing, if it runs on IRQ, not DMA:
1st) I remember that SAM7 might support interrupt priorities. So if a
same level interrupt is already active, it is finished before the next
interrupt of same or lower level is served. AFAIK in Nut/OS all
interrupts are on same level.
2nd) NutEnterCritical disables all interrupts until NutExitCritical is
called. And therefore yes: It might influence your USART timing.
Only way out might be usage of DMA. I do not remember if DMA is
supported for USARTs in SAM9. In Cortex they are.
I wrote the DMA unit for the SPI in SAM7 so you might take look there
and copy the needed things over to USART.
It is not difficult especially if you're needing DMA for only one component.
Best regards
Ulrich
More information about the En-Nut-Discussion
mailing list