aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/STM32L4xx/hal_lld.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/STM32/STM32L4xx/hal_lld.c')
-rw-r--r--os/hal/ports/STM32/STM32L4xx/hal_lld.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/os/hal/ports/STM32/STM32L4xx/hal_lld.c b/os/hal/ports/STM32/STM32L4xx/hal_lld.c
index 730629c86..76433073c 100644
--- a/os/hal/ports/STM32/STM32L4xx/hal_lld.c
+++ b/os/hal/ports/STM32/STM32L4xx/hal_lld.c
@@ -111,6 +111,13 @@ void hal_lld_init(void) {
#if STM32_PVD_ENABLE
PWR->CR1 |= PWR_CR1_PVDE | (STM32_PLS & STM32_PLS_MASK);
#endif /* STM32_PVD_ENABLE */
+
+ /* Validating USB VDD.*/
+#if HAL_USE_USB
+ PWR->CR2 = PWR_CR2_USV;
+#else
+ PWR->CR2 = 0;
+#endif /* STM32_PVD_ENABLE */
}
/**