From ad55071c5fb3a7290fefec4798b6181b9bfe7e4f Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Mon, 28 Feb 2022 03:06:52 +0200 Subject: [PATCH] stm32: Add LSE driver strength config option. --- src/hal/cmsis/src/st/system_stm32fxxx.c | 7 +++++++ src/omv/boards/OPENMVPT/omv_boardconfig.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/hal/cmsis/src/st/system_stm32fxxx.c b/src/hal/cmsis/src/st/system_stm32fxxx.c index 5a7644479..6157d9e9b 100644 --- a/src/hal/cmsis/src/st/system_stm32fxxx.c +++ b/src/hal/cmsis/src/st/system_stm32fxxx.c @@ -224,6 +224,13 @@ void SystemClock_Config(void) } #endif + #if defined(OMV_OSC_LSE_DRIVE) + // Configure LSE drive strength. + HAL_PWR_EnableBkUpAccess(); + __HAL_RCC_LSEDRIVE_CONFIG(OMV_OSC_LSE_DRIVE); + HAL_PWR_DisableBkUpAccess(); + #endif + /* Macro to configure the PLL clock source */ __HAL_RCC_PLL_PLLSOURCE_CONFIG(OMV_OSC_PLL_CLKSOURCE); diff --git a/src/omv/boards/OPENMVPT/omv_boardconfig.h b/src/omv/boards/OPENMVPT/omv_boardconfig.h index 86822b0b4..129dfdf32 100644 --- a/src/omv/boards/OPENMVPT/omv_boardconfig.h +++ b/src/omv/boards/OPENMVPT/omv_boardconfig.h @@ -141,6 +141,7 @@ // HSE/HSI/CSI State #define OMV_OSC_LSE_STATE (RCC_LSE_ON) +#define OMV_OSC_LSE_DRIVE (RCC_LSEDRIVE_HIGH) #define OMV_OSC_HSE_STATE (RCC_HSE_ON) #define OMV_OSC_HSI48_STATE (RCC_HSI48_ON)