cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 ADC w/ DMA not stopped after end of sequence

YBrun.1849
Associate

Hello,

My question is related to "STM32L4 ADC w/ DMA overrun error" which was closed unanswered.

I am implementing an algorithm that uses ADC with DMA on a NUCLEO-L476RG.

The ADC is configured as follows:

  • Clock Prescaler: Synchronuous
  • DMA Continuous Requests: Enable
  • External Trigger Conversion Source: Timer 3 Trigger Out event
  • End Of Conversion Selection: End of single conversion
  • DMA channel configured as Normal Mode

I do not use the Circular Mode, because I need to start the batch of ADC conversion when needed. However, I need to get SIZE elements every time I start an ADC conversion, thus the DMA with Normal Mode.

I start a batch with

HAL_ADC_Start_DMA(&hadc1, acquisition_buffer, SIZE)

I then process the result when HAL_ADC_ConvCpltCallback is called.

I tested this algorithm on a NUCLEO-F746ZG and on a NUCLEO-F413ZH. On both of these boards, the ADC stuff is running fine. I can start a new conversion batch at the end of batch.

However, I don't get the same result on the NUCLEO-L476RG.

After looking at the register with the debugger, I have seen that the conversion is still on going even though HAL_ADC_ConvCpltCallback was called. Therefore, restarting a conversion batch does not work and I finally get an overrun error.

I cannot explain why the ADC/DMA is not automatically stopped at the end of the batch on the L476.

As a workaround, I stop the ADC/DMA within HAL_ADC_ConvCpltCallback using

HAL_ADC_Stop_DMA(&hadc1)

I can then start again a batch conversion.

Have you already had this problem ? Why is the L476 behaving differently ?

Thanks

Yorick

0 REPLIES 0