Skip to main content
clee.10
Associate II
September 21, 2020
Question

timer + ADC + DMA (ADC ISR overrun)

  • September 21, 2020
  • 3 replies
  • 1275 views

Hi all,

I want to use timer 2 to trigger ADC function (ADC3) on STM32H743ZI2 platform.

After DMA & timer starting, I stuck in HAL_ADC_IRQHandler().

 /* Multimode not set or feature not available or ADC independent */
 if ((hadc->Instance->CFGR & ADC_CFGR_DMNGT) != 0UL)
 {
 overrun_error = 1UL;
 }

Can somebody help me what's going on?

The attached file is cubeMx setting & main file.

Thanks.

This topic has been closed for replies.

3 replies

TDK
September 21, 2020

> hadc3.Init.ContinuousConvMode = ENABLE;

> sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;

Once it triggers once, the ADC will continue to free-run. If you want one conversion per timer update, disable ContinuousConvMode .

At a sampling time of 1.5 cycles, maybe the DMA can't keep up and you get an overrun. Bump this up to max unless you have a reason not to.

"If you feel a post has answered your question, please click ""Accept as Solution""."
clee.10
clee.10Author
Associate II
September 23, 2020

Hi TDK,

I found a workaround in https://electronics.stackexchange.com/questions/408907/stm32-adcdma-occurring-only-once.

But I don't know the actual reason.