Skip to main content
EGonc.3
Associate
August 19, 2021
Solved

ADC DMA_Handle is 0!

  • August 19, 2021
  • 3 replies
  • 1458 views

Hi

I'm using a NUCLEO-H7A3ZI-Q.

I have created a project with CubeMX and I'm experiencing a strange behaviour on the ADC.

The initialisation code is calling  MX_ADC1_Init() but this function returns with an error but the ADC DMA_Handle is 0, causing later on a call to HAL_ADC_Start_DMA() to generate an error.

ANy ideas of what could be wrong?

thanks

This topic has been closed for replies.
Best answer by Amel NASRI

Hi @Community member​ ,

The correct order (as already suggested by @Mike_ST​  is MX_DMA_Init() then MX_ADC1_Init().

This is because MX_ADC1_Init() modifies some DMA register and needs its clock to be active.

In order to avoid such issue with some possible code regeneration, you can force the order of calls in STM32CubeMX, project generation setup.

As stated by @Community member​ , that is an old issue fixed on some old version of STM32CubeMX but appearing again with version 6.3.0.

-Amel

3 replies

Mike_ST
ST Technical Moderator
August 19, 2021

Hello,

I'm not sure, but there might be a bug where the DMA init function MX_DMA_Init() is called after MX_ADC1_Init() in main()...

Please check whether this is the case and move MX_DMA_Init before MX_ADC1_Init.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
Amel NASRI
Amel NASRIBest answer
ST Technical Moderator
September 8, 2021

Hi @Community member​ ,

The correct order (as already suggested by @Mike_ST​  is MX_DMA_Init() then MX_ADC1_Init().

This is because MX_ADC1_Init() modifies some DMA register and needs its clock to be active.

In order to avoid such issue with some possible code regeneration, you can force the order of calls in STM32CubeMX, project generation setup.

As stated by @Community member​ , that is an old issue fixed on some old version of STM32CubeMX but appearing again with version 6.3.0.

-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.