2026-03-31 2:10 PM - last edited on 2026-04-01 1:36 AM by mƎALLEm
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
Solved! Go to Solution.
2026-04-06 6:25 AM
> Oversampling didn't work correctly.
Then you didn't do it right.
x = (x0 + x1) / 2
2026-03-31 9:09 PM
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.
2026-04-01 1:35 AM
Hello,
Use a timer to trigger the ADC readings.
2026-04-06 6:06 AM
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.
2026-04-06 6:25 AM
> Oversampling didn't work correctly.
Then you didn't do it right.
x = (x0 + x1) / 2
2026-04-06 9:28 AM
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.
2026-04-06 2:27 PM
Very good.
I'll review the code.
Thank you for the suggestion.