stm32/modmachine: Re-enable PLLSAI[1] after waking from stop mode.
On F7s PLLSAI is used as a 48MHz clock source if the main PLL cannot provide such a frequency, and on L4s PLLSAI1 is always used as a clock source for the peripherals. This commit makes sure these PLLs are re-enabled upon waking from stop mode so the peripherals work. See issues #4022 and #4178 (L4 specific).
This commit is contained in:
parent
4df1943948
commit
1acf58c08f
|
@ -568,6 +568,22 @@ STATIC mp_obj_t machine_sleep(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#if defined(STM32F7)
|
||||
if (RCC->DCKCFGR2 & RCC_DCKCFGR2_CK48MSEL) {
|
||||
// Enable PLLSAI if it is selected as 48MHz source
|
||||
RCC->CR |= RCC_CR_PLLSAION;
|
||||
while (!(RCC->CR & RCC_CR_PLLSAIRDY)) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(STM32L4)
|
||||
// Enable PLLSAI1 for peripherals that use it
|
||||
RCC->CR |= RCC_CR_PLLSAI1ON;
|
||||
while (!(RCC->CR & RCC_CR_PLLSAI1RDY)) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
return mp_const_none;
|
||||
|
|
Loading…
Reference in New Issue