Fix rcc_configure failing silently
The function being so important, any failure should be fatal
This commit is contained in:
parent
4df0ba5c6a
commit
99f3bb79c3
11
drv/rcc.c
11
drv/rcc.c
@ -161,7 +161,7 @@ static void apply_speed_preset(void)
|
||||
//restore sane values
|
||||
apply_default_preset();
|
||||
|
||||
//try enabling HSE, fallback to HSI if HSE fails
|
||||
//enable HSE
|
||||
regs->CR.HSEON = 1;
|
||||
for (uint32_t i=0; i<10000; ++i) {
|
||||
__asm__("nop");
|
||||
@ -169,18 +169,19 @@ static void apply_speed_preset(void)
|
||||
if (regs->CR.HSERDY == 0x1) {
|
||||
regs->CFGR.PLLSCR = 1;
|
||||
} else {
|
||||
regs->CR.HSEON = 0;
|
||||
apply_default_preset();
|
||||
while (true);
|
||||
}
|
||||
|
||||
//configure PLL, fallback to HSI if PLL fails
|
||||
//configure PLL
|
||||
regs->CFGR.PLLMUL = 0x7; //PLL x9
|
||||
regs->CR.PLLON = 1;
|
||||
for (uint32_t i=0; i<10000; ++i) {
|
||||
__asm__("nop");
|
||||
}
|
||||
if (regs->CR.PLLRDY != 0x1) {
|
||||
regs->CR.PLLON = 0;
|
||||
return; //clock low enough, no need for prescalers
|
||||
apply_default_preset();
|
||||
while (true);
|
||||
}
|
||||
|
||||
//configure prescalers
|
||||
|
||||
Loading…
Reference in New Issue
Block a user