From 332a498054039d026dcba122061997f0ed58e064 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Fri, 19 Apr 2024 00:48:23 +0100 Subject: [PATCH] stm32/h7: Implemented handling for bringing up the 3.3V USB voltage supply --- include/libopencm3/stm32/h7/pwr.h | 3 +++ lib/stm32/h7/pwr.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/include/libopencm3/stm32/h7/pwr.h b/include/libopencm3/stm32/h7/pwr.h index dd3943d1d8..b326c7c788 100644 --- a/include/libopencm3/stm32/h7/pwr.h +++ b/include/libopencm3/stm32/h7/pwr.h @@ -245,6 +245,9 @@ void pwr_set_svos_scale(enum pwr_svos_scale scale); * @param[in] scale Voltage scale value to set. */ void pwr_set_vos_scale(enum pwr_vos_scale scale); + +/** Enable and bring up the VDD33USB power supply for the USB controller */ +void pwr_enable_usb33(void); /**@}*/ diff --git a/lib/stm32/h7/pwr.c b/lib/stm32/h7/pwr.c index ce6e4bafa8..2ce1c0b091 100644 --- a/lib/stm32/h7/pwr.c +++ b/lib/stm32/h7/pwr.c @@ -161,3 +161,10 @@ void pwr_set_vos_scale(enum pwr_vos_scale scale) { } while (!(PWR_D3CR & PWR_D3CR_VOSRDY)); /* VOSRDY bit is same between D3CR and SRDCR. */ } + +void pwr_enable_usb33(void) +{ + PWR_CR3 |= PWR_CR3_USB33DEN; + while (!(PWR_CR3 & PWR_CR3_USB33RDY)) + continue; +}