AnsweredAssumed Answered

start and stop the tim1 -> adc -> dma chain

Question asked by fleming.mark on Oct 25, 2013
I have an STM8L application that needs to scan several ADC channels on a fixed time basis, so I used the ADC_DMA code from the STM8L standard peripheral examples as a starting point. The timer is set to a 1KHz trigger rate, and processing of ADC samples is done in the DMA Transfer Complete ISR. All works as expected (application is a resistive touch panel).

So far, so good. Now I need to shut off the chain and put the CPU in a low power Wait state until some external interrupt occurs. I need to turn off the TIM1/ADC/DMA chain so that the TC interrupt does not wake the processor, but all attempts to do so either fail to stop the TC interrupt, causes channel data written to the DMA circular buffer to get out of sequence, or succeed but eventually causes the system to hang.

How should I disable the chain before sleeping, and how do I insure that the data written to the DMA circular buffer remains in the proper sequence?