summaryrefslogtreecommitdiff
path: root/ports/stm32/powerctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/stm32/powerctrl.c')
-rw-r--r--ports/stm32/powerctrl.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/ports/stm32/powerctrl.c b/ports/stm32/powerctrl.c
index fe4d58001..165919977 100644
--- a/ports/stm32/powerctrl.c
+++ b/ports/stm32/powerctrl.c
@@ -215,10 +215,10 @@ set_clk:
// Re-configure PLL
// Even if we don't use the PLL for the system clock, we still need it for USB, RNG and SDIO
RCC_OscInitTypeDef RCC_OscInitStruct;
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
- RCC_OscInitStruct.HSEState = MICROPY_HW_CLK_HSE_STATE;
+ RCC_OscInitStruct.OscillatorType = MICROPY_HW_RCC_OSCILLATOR_TYPE;
+ RCC_OscInitStruct.HSEState = MICROPY_HW_RCC_HSE_STATE;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
- RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
+ RCC_OscInitStruct.PLL.PLLSource = MICROPY_HW_RCC_PLL_SRC;
RCC_OscInitStruct.PLL.PLLM = m;
RCC_OscInitStruct.PLL.PLLN = n;
RCC_OscInitStruct.PLL.PLLP = p;
@@ -297,9 +297,12 @@ void powerctrl_enter_stop_mode(void) {
#else
#if !defined(STM32L4)
- // enable HSE
- __HAL_RCC_HSE_CONFIG(MICROPY_HW_CLK_HSE_STATE);
- while (!__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY)) {
+ // enable clock
+ __HAL_RCC_HSE_CONFIG(MICROPY_HW_RCC_HSE_STATE);
+ #if MICROPY_HW_CLK_USE_HSI
+ __HAL_RCC_HSI_ENABLE();
+ #endif
+ while (!__HAL_RCC_GET_FLAG(MICROPY_HW_RCC_FLAG_HSxRDY)) {
}
#endif