This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit f6a3443865f193231a5504d2e4892e9bdf1021b4
Author: Jerzy Kasenberg <jerzy.kasenb...@codecoup.pl>
AuthorDate: Fri Apr 12 14:45:34 2024 +0200

    tinyusb: Fix USB for STM32L4
    
    Clock for PWR is needed and STM32L4 clock configuration does
    not turn it on.
    
    Additionally HAL_PWREx_EnableVddUSB() call was selected only for U5
    and it is needed for L4 as well
    
    Signed-off-by: Jerzy Kasenberg <jerzy.kasenb...@codecoup.pl>
---
 hw/usb/tinyusb/synopsys/src/synopsys.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/usb/tinyusb/synopsys/src/synopsys.c 
b/hw/usb/tinyusb/synopsys/src/synopsys.c
index c7f4db5a4..ad784e506 100755
--- a/hw/usb/tinyusb/synopsys/src/synopsys.c
+++ b/hw/usb/tinyusb/synopsys/src/synopsys.c
@@ -84,6 +84,9 @@ tinyusb_hardware_init(void)
      * Enable USB OTG clock, force device mode
      */
     USB_OTG_CLK_ENABLE();
+#ifdef __HAL_RCC_PWR_CLK_ENABLE
+    __HAL_RCC_PWR_CLK_ENABLE();
+#endif
 
 #if MYNEWT_VAL(USB_ID_PIN_ENABLE)
     hal_gpio_init_af(MCU_GPIO_PORTA(10), GPIO_AF_USB, GPIO_PULLUP, 
GPIO_MODE_AF_OD);
@@ -117,7 +120,7 @@ tinyusb_hardware_init(void)
 #endif
 #endif
 
-#if MYNEWT_VAL(MCU_STM32U5)
+#if MYNEWT_VAL(MCU_STM32U5) || MYNEWT_VAL(MCU_STM32L4)
     /* Enable USB power */
     HAL_PWREx_EnableVddUSB();
 #endif

Reply via email to