Skip to content

Commit 4473892

Browse files
committed
core(u5): update for USB_DRD_FS support
Signed-off-by: Frederic Pillon <[email protected]>
1 parent e89ae0f commit 4473892

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Diff for: cores/arduino/stm32/stm32_def.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,15 @@
8686
#endif
8787
#endif
8888

89-
/* STM32G0xx defined USB_DRD_FS */
89+
/* STM32G0xx and some STM32U5xx defined USB_DRD_FS */
9090
#if !defined(USB) && defined(USB_DRD_FS)
9191
#define USB USB_DRD_FS
9292
#define PinMap_USB PinMap_USB_DRD_FS
93+
#if defined(STM32U5xx)
94+
#define USB_BASE USB_DRD_BASE
95+
#define __HAL_RCC_USB_CLK_ENABLE __HAL_RCC_USB_FS_CLK_ENABLE
96+
#define __HAL_RCC_USB_CLK_DISABLE __HAL_RCC_USB_FS_CLK_DISABLE
97+
#endif
9398
#endif
9499

95100
/**

Diff for: cores/arduino/stm32/usb/usbd_conf.c

+2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
105105
#ifdef __HAL_USB_WAKEUP_EXTI_ENABLE_RISING_EDGE
106106
__HAL_USB_WAKEUP_EXTI_ENABLE_RISING_EDGE();
107107
#endif
108+
#ifdef __HAL_USB_WAKEUP_EXTI_ENABLE_IT
108109
__HAL_USB_WAKEUP_EXTI_ENABLE_IT();
110+
#endif
109111
#if defined(USB_WKUP_IRQn)
110112
/* USB Wakeup Interrupt */
111113
HAL_NVIC_EnableIRQ(USB_WKUP_IRQn);

Diff for: cores/arduino/stm32/usb/usbd_conf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extern "C" {
7474
#elif defined(STM32G0xx)
7575
#define USB_IRQn USB_UCPD1_2_IRQn
7676
#define USB_IRQHandler USB_UCPD1_2_IRQHandler
77-
#elif defined(STM32U5xx)
77+
#elif defined(STM32U5xx) && !defined(USB_DRD_FS)
7878
#define USB_IRQn OTG_FS_IRQn
7979
#define USB_IRQHandler OTG_FS_IRQHandler
8080
#elif defined(STM32L5xx)

0 commit comments

Comments
 (0)