summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuuki NAGAO <wf.yn386@gmail.com>2023-06-27 22:20:12 +0900
committerYuuki NAGAO <wf.yn386@gmail.com>2023-06-27 22:28:31 +0900
commita2c02014cd4df7cd2b7bea611b555d3a58a4d02f (patch)
tree99d464b72a0a58a8f998fad89f8bc89000efa943
parent7ca3c1d8920fc0a9ceef0a1d725009d1716e41fa (diff)
stm32: Modify RCC->APB2ENR directly instead of HAL API.
Also, it is needed only when USB is enabled. Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
-rw-r--r--ports/stm32/powerctrlboot.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ports/stm32/powerctrlboot.c b/ports/stm32/powerctrlboot.c
index 1721f6c7e..51b740a80 100644
--- a/ports/stm32/powerctrlboot.c
+++ b/ports/stm32/powerctrlboot.c
@@ -348,8 +348,6 @@ void SystemClock_Config(void) {
#elif defined(STM32L1)
void SystemClock_Config(void) {
- // Enable SYSCFG clock
- __HAL_RCC_SYSCFG_CLK_ENABLE();
// Enable power control peripheral
__HAL_RCC_PWR_CLK_ENABLE();
@@ -390,6 +388,10 @@ void SystemClock_Config(void) {
SystemCoreClockUpdate();
powerctrl_config_systick();
+ #if MICROPY_HW_ENABLE_USB
+ RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
+ #endif
+
// Disable the Debug Module in low-power mode due to prevent
// unexpected HardFault after __WFI().
#if !defined(NDEBUG)