Skip to content

Commit f3247f9

Browse files
committed
core(USB): add STM32H5xx support
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent c711143 commit f3247f9

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

cores/arduino/stm32/stm32_def.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@
9292
#if !defined(USB) && defined(USB_DRD_FS)
9393
#define USB USB_DRD_FS
9494
#define PinMap_USB PinMap_USB_DRD_FS
95-
#if defined(STM32U5xx)
95+
#if defined(STM32H5xx) || defined(STM32U5xx)
9696
#define USB_BASE USB_DRD_BASE
97-
#define __HAL_RCC_USB_CLK_ENABLE __HAL_RCC_USB_FS_CLK_ENABLE
98-
#define __HAL_RCC_USB_CLK_DISABLE __HAL_RCC_USB_FS_CLK_DISABLE
97+
#if !defined(__HAL_RCC_USB_CLK_ENABLE)
98+
#define __HAL_RCC_USB_CLK_ENABLE __HAL_RCC_USB_FS_CLK_ENABLE
99+
#define __HAL_RCC_USB_CLK_DISABLE __HAL_RCC_USB_FS_CLK_DISABLE
100+
#endif
99101
#endif
100102
#endif
101103

cores/arduino/stm32/usb/usbd_conf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
5858
digitalWriteFast(digitalPinToPinName(PIN_UCPD_TCPP), LOW);
5959
#endif
6060

61-
#if defined(PWR_CR2_USV) || defined(PWR_SVMCR_USV)
61+
#if defined(PWR_CR2_USV) || defined(PWR_SVMCR_USV) || defined(PWR_USBSCR_USB33SV)
6262
/* Enable VDDUSB on Pwrctrl CR2 register*/
6363
HAL_PWREx_EnableVddUSB();
6464
#endif

cores/arduino/stm32/usb/usbd_conf.h

+3
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ 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(STM32H5xx)
78+
#define USB_IRQn USB_DRD_FS_IRQn
79+
#define USB_IRQHandler USB_DRD_FS_IRQHandler
7780
#elif defined(STM32U5xx) && !defined(USB_DRD_FS)
7881
#define USB_IRQn OTG_FS_IRQn
7982
#define USB_IRQHandler OTG_FS_IRQHandler

0 commit comments

Comments
 (0)