cancel
Showing results for 
Search instead for 
Did you mean: 

Simple ADC configuration - STM32G0 specific problem

TDJ
Senior III

Porting a working solution from STM32L031 to STM32G0B1 I try to configure ADC in CubeMX . It is a very simple, typical setup. 3 channels converted in "one shot" mode with DMA, triggered by slow 1Hz timer.

All I am getting is HAL_ADC_ErrorCallback(), state: HAL_ADC_STATE_REG_OVR, errorCode: HAL_ADC_ERROR_OVR.

Almost identical setup works great on STM32L031.

I am stuck and clueless. Please advise.

CubeMX is the latest 6.4, firmware package STM32Cube FW_G0 V1.5.0

0693W00000Hq3SUQAZ.png0693W00000Hq3SZQAZ.png0693W00000Hq3WMQAZ.png0693W00000Hq3WHQAZ.png

1 ACCEPTED SOLUTION

Accepted Solutions
MichaelSweden
Associate III

Check the call order of MX_ADC1_Init() and MX_DMA_Init(). At least in software version this summer the code generated had these in the wrong order for a STM32G0 device.

View solution in original post

3 REPLIES 3
MichaelSweden
Associate III

Check the call order of MX_ADC1_Init() and MX_DMA_Init(). At least in software version this summer the code generated had these in the wrong order for a STM32G0 device.

TDJ
Senior III

Yep, that was the problem. DMA needs to be initialized first. It is a CubeMX bug.

Thank you!

TDK
Guru

To fix, in case you didn't see it:

https://community.st.com/s/question/0D53W00001EzCmCSAV/mxdmainit-order-in-the-mainc-file-generated-by-stm32cubemx-how-to-fix

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