AnsweredAssumed Answered

PDB -> ADC -> DMA + _int_disable = busted!

Question asked by billnd on May 6, 2013
Latest reply on May 28, 2013 by Yifang Guo

Hi all.

 

I have a problem, and I'm tearing my hair out over it. Just wondering if anyone has any info that might help me see the wood for the trees.

 

I'm running with IAR, on a K10 (50MHz) and with MQX 4.0.0.

 

I've got the PDB firing off every 20uS, triggering an ADC, that in turn fires off a series of DMA's. The ADC is configured so that the conversion takes 17uS.

 

This all works fine, and is seemingly reliably while nothing else is going on. However, once other software is running, every now and again the PDB stops with a sequence error. I think I've tracked it down to things disabling the interrupts for a period of time that is approaching 3uS. I'm guessing this is relevant as it's 20uS - 17uS.

 

I've removed as much software as i can, and just have a task that does _int_disable, short loop, _int_enable. As the short loop approaches 3uS in length, the problem starts to happen, as the loop length is increased the problems happens more regularly.

 

So I'm assuming that the problem is that the ADC completes, but (due to interrupts being disabled) before the DMA's can do their business, the PDB triggers. As the ADC has not been fully serviced by the DMA the COCO flag is still set and causes the sequence error.

 

Does this sound like a sensible analysis of the problem?

 

Presumably there is a way to priorities things so that the DMA has precedence even during an ints disabled period?

 

Any thoughts most welcome, thanks in advance.

Bill

Outcomes