cancel
Showing results for 
Search instead for 
Did you mean: 

STM32407x ADC , DMA and overrun

n.serina
Associate III

Hello,

I want to know when ADC DMA is enabled and if ADC overrun status sets to 1.

the RM says this

>>>>>>>>>>>>>>>>.

To recover the ADC from OVR state when the DMA is used, follow the steps below:

1. Reinitialize the DMA (adjust destination address and NDTR counter)

2. Clear the ADC OVR bit in ADC_SR register

3. Trigger the ADC to start the conversion.

>>>>>>>

Question 1 ) with what value NDTR needs to be adjusted ?

question 2) when i trigger the ADC(step 3 above) will the sequence start from the beginning or will it resume from the channel where data was lost due to overrun ?

Thank you very much

1 REPLY 1
TDK
Guru

When this happens, clear the flag and treat it as an entirely new conversion. I would be very surprised if it has any memory of where it was in the process. You could use the current NDTR value to determine where it left off.

Despite this, if data are lost (overrun), the OVR bit in the ADC_SR register is set and an

interrupt is generated (if the OVRIE enable bit is set). DMA transfers are then disabled and

DMA requests are no longer accepted. In this case, if a DMA request is made, the regular

conversion in progress is aborted and further regular triggers are ignored. It is then

necessary to clear the OVR flag and the DMAEN bit in the used DMA stream, and to reinitialize

both the DMA and the ADC to have the wanted converted channel data transferred

to the right memory location.

If you feel a post has answered your question, please click "Accept as Solution".