We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2cf638d + 864a323 commit 215f395Copy full SHA for 215f395
src/rcc/mod.rs
@@ -207,6 +207,16 @@ impl Rcc {
207
assert!(pll_cfg.m > 0 && pll_cfg.m <= 8);
208
assert!(pll_cfg.r > 1 && pll_cfg.r <= 8);
209
210
+ // If the system is currently clocked from the PLL, then switch back to
211
+ // the HSI before we disable the PLL, otherwise the PLL will refuse to
212
+ // switch off.
213
+ self.cfgr.modify(|r, w| {
214
+ if r.sw().bits() == 0b010 {
215
+ unsafe { w.sw().bits(0b000) };
216
+ }
217
+ w
218
+ });
219
+
220
// Disable PLL
221
self.cr.modify(|_, w| w.pllon().clear_bit());
222
while self.cr.read().pllrdy().bit_is_set() {}
0 commit comments