From f05c85e6228a7c6f2471da33e09fa1e8e0dc07e9 Mon Sep 17 00:00:00 2001 From: Alexis Guijarro Date: Thu, 25 Jul 2024 02:18:18 +0000 Subject: [PATCH] arm/stm32h7x3x_rcc.c: Add External Power Supply option to stm32h7x3x targets --- arch/arm/src/stm32h7/Kconfig | 6 ++++++ arch/arm/src/stm32h7/stm32h7x3xx_rcc.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/stm32h7/Kconfig b/arch/arm/src/stm32h7/Kconfig index 91c66280aa..15ba5312c5 100644 --- a/arch/arm/src/stm32h7/Kconfig +++ b/arch/arm/src/stm32h7/Kconfig @@ -293,6 +293,12 @@ config STM32H7_PWR_DIRECT_SMPS_SUPPLY depends on STM32H7_HAVE_SMPS default n +config STM32H7_PWR_EXTERNAL_SOURCE_SUPPLY + bool "Use external source as power supply" + default n + ---help--- + Select this option for using an external power supply connected directly to the VCAP pin. + choice prompt "STM32 H7 Power Supply Selection" default STM32H7_PWR_DEFAULT_SUPPLY diff --git a/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c b/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c index da7af1f59c..51031027ae 100644 --- a/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c +++ b/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c @@ -148,12 +148,18 @@ # if defined(CONFIG_STM32H7_PWR_DIRECT_SMPS_SUPPLY) # define STM32_PWR_CR3_SELECTION STM32_PWR_CR3_SDEN +# elif defined(CONFIG_STM32H7_PWR_EXTERNAL_SOURCE_SUPPLY) +# define STM32_PWR_CR3_SELECTION STM32_PWR_CR3_BYPASS # else # define STM32_PWR_CR3_SELECTION STM32_PWR_CR3_LDOEN # endif #else # define STM32_PWR_CR3_MASK 0xffffffff -# define STM32_PWR_CR3_SELECTION (STM32_PWR_CR3_LDOEN | STM32_PWR_CR3_SCUEN) +# if defined(CONFIG_STM32H7_PWR_EXTERNAL_SOURCE_SUPPLY) +# define STM32_PWR_CR3_SELECTION (STM32_PWR_CR3_BYPASS | STM32_PWR_CR3_SCUEN) +# else +# define STM32_PWR_CR3_SELECTION (STM32_PWR_CR3_LDOEN | STM32_PWR_CR3_SCUEN) +# endif #endif