Skip to content

Commit 3986d2e

Browse files
authored
Merge pull request #124 from msmouni/patch-1
Over-drive mode configuration
2 parents af93075 + 89cc9a4 commit 3986d2e

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/rcc.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -729,15 +729,27 @@ impl CFGR {
729729
VOSscale::PwrScale1 => w.vos().scale1(),
730730
});
731731

732-
if config.overdrive {
733-
pwr.cr1.modify(|_, w| w.oden().set_bit());
734-
}
735-
736732
// Enable PLL
737733
rcc.cr.modify(|_, w| w.pllon().on());
738734

739735
// Wait for PLL to stabilise
740736
while rcc.cr.read().pllrdy().is_not_ready() {}
737+
738+
//Over-drive
739+
if config.overdrive {
740+
// Entering Over-drive mode
741+
//enable the Over-drive mode
742+
pwr.cr1.modify(|_, w| w.oden().set_bit());
743+
744+
//wait for the ODRDY flag to be set
745+
while !pwr.csr1.read().odrdy().bit_is_set() {}
746+
747+
//switch the voltage regulator from Normal mode to Over-drive mode
748+
pwr.cr1.modify(|_, w| w.odswen().set_bit());
749+
750+
//Wait for the ODSWRDY flag in the PWR_CSR1 to be set.
751+
while !pwr.csr1.read().odswrdy().bit_is_set() {}
752+
}
741753
}
742754

743755
if self.use_pll48clk {

0 commit comments

Comments
 (0)