Skip to main content
Associate III
March 31, 2026
Solved

Need very slow ADC readings on STM32G474

  • March 31, 2026
  • 3 replies
  • 307 views

I'm using the STM32G474 at 170MHz.

Is it possible to simulate hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV512; since the G474  only recognizes up to ADC_CLOCK_ASYNC_DIV256;

I need very slow readings from the ADC.

Thank you

Valter

Best answer by TDK

> Oversampling didn't work correctly.

Then you didn't do it right.

x = (x0 + x1) / 2

3 replies

TDK
Super User
April 1, 2026

Sure, slow down the ADC clock or use software oversampling. Note that there is a minimum FADC requirement of 140 kHz that you need to be at/above. You can use software oversampling to achieve lower effective values.

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
mƎALLEm
Technical Moderator
April 1, 2026

Hello,

Use a timer to trigger the ADC readings.

"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."
Associate III
April 6, 2026

Not yet. I've tried several programming alternatives and still haven't been able to solve it. Oversampling didn't work correctly.
I'll try a timer to trigger the ADC readings.
I need to simulate a 512 pressscaler on the ADC readings because the G474 only accepts up to 256.
I wouldn't like to reduce the clock speed.

MasterT
Lead II
April 6, 2026

G474 has an option to choose clock for ADC, 

 RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};

 PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC12;
 //PeriphClkInit.Adc12ClockSelection = RCC_ADC12CLKSOURCE_SYSCLK;
 PeriphClkInit.Adc12ClockSelection = RCC_ADC12CLKSOURCE_PLL;

 Using PLL instead of SYSCLK allows to generate any clock, simply changing M and N PLL's settings.

I tested this mode not for lower, but higher speed, overdriving ADC up to 168 MHz. And it works.

TDK
TDKBest answer
Super User
April 6, 2026

> Oversampling didn't work correctly.

Then you didn't do it right.

x = (x0 + x1) / 2

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