cancel
Showing results for 
Search instead for 
Did you mean: 

ADC DMA_Handle is 0!

EGonc.3
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Amel NASRI
ST Employee

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 Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
Mike_ST
ST Employee

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.

Amel NASRI
ST Employee

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 Accept as Solution on the reply which solved your issue or answered your question.