From 4947b136156e923447456edd8a28fe391e158dcd Mon Sep 17 00:00:00 2001 From: RobertTDowling Date: Wed, 15 Nov 2023 17:11:16 -0800 Subject: [PATCH 1/2] stm32h7 ADC: Fix stalled clock in default h7 config --- embassy-stm32/src/rcc/h.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs index 4407d9e9..bdae850f 100644 --- a/embassy-stm32/src/rcc/h.rs +++ b/embassy-stm32/src/rcc/h.rs @@ -168,7 +168,12 @@ impl Default for Config { apb4_pre: APBPrescaler::DIV1, per_clock_source: PerClockSource::HSI, - adc_clock_source: AdcClockSource::from_bits(0), // PLL2_P on H7, HCLK on H5 + + #[cfg(stm32h5)] + adc_clock_source: AdcClockSource::from_bits(0), // HCLK on H5 + #[cfg(stm32h7)] + adc_clock_source: AdcClockSource::from_bits(2), // PCLK on H7 + timer_prescaler: TimerPrescaler::DefaultX2, voltage_scale: VoltageScale::Scale0, ls: Default::default(), From 7f258cd3c403fc2fe1837afbecc1bf88da46cb5a Mon Sep 17 00:00:00 2001 From: RobertTDowling Date: Sun, 19 Nov 2023 15:56:34 -0800 Subject: [PATCH 2/2] PR feedback --- embassy-stm32/src/rcc/h.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs index bdae850f..1a9603d0 100644 --- a/embassy-stm32/src/rcc/h.rs +++ b/embassy-stm32/src/rcc/h.rs @@ -170,9 +170,9 @@ impl Default for Config { per_clock_source: PerClockSource::HSI, #[cfg(stm32h5)] - adc_clock_source: AdcClockSource::from_bits(0), // HCLK on H5 + adc_clock_source: AdcClockSource::HCLK1, #[cfg(stm32h7)] - adc_clock_source: AdcClockSource::from_bits(2), // PCLK on H7 + adc_clock_source: AdcClockSource::PER, timer_prescaler: TimerPrescaler::DefaultX2, voltage_scale: VoltageScale::Scale0,