[En-Nut-Discussion] Timing problems with UART

Klaus Kloos klaus.kloos at gmx.de
Sun Nov 6 07:30:35 CET 2011


Hello Ulrich
>> 
>> 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.
> 
Is it NUT_IRQPRI_UART0 in ih_at91uart0.c? ive changed it to 7 but there is not much change.
(Ive change the code directly in the nut-directory. How to add such defines to the makefile?)

> 2nd) NutEnterCritical disables all interrupts until NutExitCritical is
> called. And therefore yes: It might influence your USART timing.
> 
Is it a way (for me) to modify NutEnterCritical/NutExitCritical for leaving the USART-IRQ unchanged?

> 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.
> 
Ive found a very detailed description on USART-DMA here
http://www.sparkfun.com/datasheets/DevTools/SAM7/at91sam7%20serial%20communications.pdf
So i might be able to get this run (with some help :-).
Where to find the DMA SPI code? Ive searched in ethernut-4.10\nut\arch\arm\dev\atmel.

Greetings Klaus




More information about the En-Nut-Discussion mailing list