aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Rockstedt <[email protected]>2023-12-15 11:42:58 +0100
committerOliver Rockstedt <[email protected]>2023-12-15 11:42:58 +0100
commite5e85ba02bc91a47d80ba89dee27e6ccb20f0ccd (patch)
treef3e38deefa4630a9ecfc4d37e6734623ff2aad44
parentdf0f41c41c685c28965942bf6e6c67d8ca166d40 (diff)
STM32H7: Allow PLL1 DIVP of 1 for certain series
-rw-r--r--embassy-stm32/src/rcc/h.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs
index 1889eb280..18dff9f29 100644
--- a/embassy-stm32/src/rcc/h.rs
+++ b/embassy-stm32/src/rcc/h.rs
@@ -70,7 +70,9 @@ pub struct Pll {
70 pub mul: PllMul, 70 pub mul: PllMul,
71 71
72 /// PLL P division factor. If None, PLL P output is disabled. 72 /// PLL P division factor. If None, PLL P output is disabled.
73 /// On PLL1, it must be even (in particular, it cannot be 1.) 73 /// On PLL1, it must be even for most series (in particular,
74 /// it cannot be 1 in series other than STM32H723/733,
75 /// STM32H725/735 and STM32H730.)
74 pub divp: Option<PllDiv>, 76 pub divp: Option<PllDiv>,
75 /// PLL Q division factor. If None, PLL Q output is disabled. 77 /// PLL Q division factor. If None, PLL Q output is disabled.
76 pub divq: Option<PllDiv>, 78 pub divq: Option<PllDiv>,
@@ -729,9 +731,12 @@ fn init_pll(num: usize, config: Option<Pll>, input: &PllInput) -> PllOutput {
729 731
730 let p = config.divp.map(|div| { 732 let p = config.divp.map(|div| {
731 if num == 0 { 733 if num == 0 {
732 // on PLL1, DIVP must be even. 734 // on PLL1, DIVP must be even for most series.
733 // The enum value is 1 less than the divider, so check it's odd. 735 // The enum value is 1 less than the divider, so check it's odd.
736 #[cfg(not(pwr_h7rm0468))]
734 assert!(div.to_bits() % 2 == 1); 737 assert!(div.to_bits() % 2 == 1);
738 #[cfg(pwr_h7rm0468)]
739 assert!(div.to_bits() % 2 == 1 || div.to_bits() == 0);
735 } 740 }
736 741
737 vco_clk / div 742 vco_clk / div