Skip to content

Commit 0be5545

Browse files
chris-durandrleh
authored andcommitted
[examples] Fix ADC clock in Nucleo G474RE example
The ADC prescaler was set to 1 which yield an 170 MHz ADC clock. This i soutside of the specification and leads to signal distortions. The clock prescaler is set to 4 to stay below the maximum clock of 60 MHz.
1 parent 3b2ef55 commit 0be5545

File tree

1 file changed

+3
-1
lines changed
  • examples/nucleo_g474re/adc_basic

1 file changed

+3
-1
lines changed

examples/nucleo_g474re/adc_basic/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ main()
2222
MODM_LOG_INFO << " running on Nucleo-G474RE" << modm::endl << modm::endl;
2323

2424
MODM_LOG_INFO << "Configuring ADC ...";
25+
// max. ADC clock for STM32G474: 60 MHz
26+
// 170 MHz AHB clock / 4 = 42.5 MHz
2527
Adc1::initialize(
26-
Adc1::ClockMode::SynchronousPrescaler1,
28+
Adc1::ClockMode::SynchronousPrescaler4,
2729
Adc1::ClockSource::SystemClock,
2830
Adc1::Prescaler::Disabled,
2931
Adc1::CalibrationMode::SingleEndedInputsMode,

0 commit comments

Comments
 (0)