Skip to main content
TDJ
Senior III
December 29, 2021
Solved

Simple ADC configuration - STM32G0 specific problem

  • December 29, 2021
  • 3 replies
  • 3034 views

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

This topic has been closed for replies.
Best answer by MichaelSweden

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.

3 replies

MichaelSweden
MichaelSwedenBest answer
Associate II
December 29, 2021

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
TDJAuthor
Senior III
December 29, 2021

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

Thank you!

TDK
Super User
December 29, 2021
"If you feel a post has answered your question, please click ""Accept as Solution""."