cancel
Showing results for 
Search instead for 
Did you mean: 

Missing DMA interrupt

niko
Associate II
Posted on February 25, 2009 at 03:12

Missing DMA interrupt

2 REPLIES 2
niko
Associate II
Posted on May 17, 2011 at 09:57

I'm outputting data to SPI0 using DMA at fixed rate. The data flow should be constant and not have any interruptions. Data rate is about 2 Mbps.

I'm setting up new LLI in DMA irq handler for next transfer. Interrupt rate is about 500-700 ints/second.

I'm using IAR's irq_Mask and irq_Unmask functions to disable interrupts when application code needs to access same datastructures as the DMA irq handler. I've had problems with missing DMA interrupts. It seems that once every couple of minutes (or even more often if I'm particularly unlucky) a DMA interrupt is missed and it is serviced when TCP/IP performs DMA. Usually I get interrupts every 1.5-2 ms but when the delay occurs the interrupt interval is 3-5 ms. If I comment out the irq_Mask and irq_Unmask functions, everything seems to work ok. Of course this allows race conditions that can cause problems, so I need some way to disable interrupts without losing DMA irqs.

Is it so that using the irq_Mask -functionality could cause the MCU to miss interrupts? I'm changing the implementation of the interrupt disabling to use VIC interrupt masking so that only DMA interrupt is masked when application code is accessing sensitive data. Is this a safe way to do it in your opinion?

If you have any experience on this yourself or have any good pointers I'd be very happy if you shared those with me. Thank you in advance.

Niko Haatainen

niko
Associate II
Posted on May 17, 2011 at 09:57

It seems to me that STR912 will miss DMA terminal count interrupt if interrupts are disabled (either by setting I_Bit and F_Bit in CPSR or setting corresponding bit it VIC0->INTECR) when end of DMA transfer occurrs.

It also seems that the 91x_enet -driver in Interniche TCP/IP stack suffers from this. Once every now and then it upcalls a UDP packet that will fail call to pk_validate(pkt) as the packets data buffer is missing a safety marker 'M' at the end of buffer. When this occurs the IP stack also drops one packet. I didn't get the IP stack to work correctly if I undefined USE_DMA, which should make the stack not use DMA.

None of the code ST has provided so far has not worked without problems so why should Interniche be any different.