Showing results for 
Search instead for 
Did you mean: 

STM32G474RE ADC Clocking

Associate II



I'm trying to figure out the clock config for my micro. I'm using ADC3 IN1 currently, and using the internal HSI clock source. Using the default settings, I can't seem to get anything better than 3.3 MSPS, and this is with a 10-Bit ADC resolution. From what I read, I should be able to get around 4 to 5 MSPS!


However, that's assuming the ADC is clocked at 60 MHz. By defualt, the ADC clock is divided by 4, so the resulting clock is at 42.5 MHz. Okay! So, I just need to change the divider ratio/or clock it to the PLLP to fix this.


However, I can't figure out a good way to get the prescaler to be okay with an async clock mode with a divider less than 4.

I've tried changing the PLLP clock divider ratio down to 6, which gives the ADC a clock of 56.666667. Won't let me change the prescaler still, stuck at async divide by 4.


Tried a PLLP clock divider of 5, which gives 68 MHz. Still can't change it to lower than 4. 


And changing the PLLP clock DOES impact my performance; I can change my trigger timer value and see my maximum sample speed change. If I manually change this line of code,

hadc3.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV4;


to lower divider values, it works as expected, and I get the higher sampling rates I want.

Why is CubeMX throwing a fit about this?

Using STM32CubeIDE 1.14.0. STM32G474-DPOW board.



Hover over the grayed out selection to understand the error.



In this case, it looks like CubeMX is using SYSCLK to determine this constraint regardless of the setting of the ADC345 clock mux.


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

Is this intentional? I'm not sure if I'm just misunderstanding how clocking the ADC works or if this is a bug. 🤔


No, it's almost certainly a bug. Perhaps @Semer CHERNI or @Amel NASRI can confirm or investigate.

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

Hello @Jbin0101 

First let me thank you for posting.

After investigating the situation, I found that @TDK  is right about the fact that CubeMX is using the SYSCLK.

The issue is now raised internally for further analysis (170481: this is an internal ticket reference)

In the mean while you can change the divider value manually in the generated code to suite your need.


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.