From 39ddfed9a0360af147193a6eb09228fd6afa0c41 Mon Sep 17 00:00:00 2001 From: Adrian Higgins Date: Thu, 5 Sep 2024 14:50:20 +1000 Subject: [PATCH] stm32: Update STM32L452xx Multi OTG handling. Added custom Multi OTG handling for STM32L452xx, based on STM32L432xx handling. Fixes issue #15795. Signed-off-by: Adrian Higgins --- ports/stm32/mpconfigboard_common.h | 2 +- ports/stm32/stm32_it.c | 2 +- ports/stm32/usbd_conf.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/stm32/mpconfigboard_common.h b/ports/stm32/mpconfigboard_common.h index 67a6ee990e..c158419483 100644 --- a/ports/stm32/mpconfigboard_common.h +++ b/ports/stm32/mpconfigboard_common.h @@ -619,7 +619,7 @@ // Whether the USB peripheral is device-only, or multiple OTG // For STM32G0 and STM32H5 the USB peripheral supports device and host mode, // but otherwise acts like a non-multi-OTG peripheral. -#if defined(STM32G0) || defined(STM32G4) || defined(STM32H5) || defined(STM32L0) || defined(STM32L1) || defined(STM32L432xx) || defined(STM32WB) +#if defined(STM32G0) || defined(STM32G4) || defined(STM32H5) || defined(STM32L0) || defined(STM32L1) || defined(STM32L432xx) || defined(STM32L452xx) || defined(STM32WB) #define MICROPY_HW_USB_IS_MULTI_OTG (0) #else #define MICROPY_HW_USB_IS_MULTI_OTG (1) diff --git a/ports/stm32/stm32_it.c b/ports/stm32/stm32_it.c index a910a624be..e05dbe91bc 100644 --- a/ports/stm32/stm32_it.c +++ b/ports/stm32/stm32_it.c @@ -312,7 +312,7 @@ void USB_DRD_FS_IRQHandler(void) { } #endif -#elif defined(STM32L0) || defined(STM32L432xx) +#elif defined(STM32L0) || defined(STM32L432xx) || defined(STM32L452xx) #if MICROPY_HW_USB_FS void USB_IRQHandler(void) { diff --git a/ports/stm32/usbd_conf.c b/ports/stm32/usbd_conf.c index 5d9e7177de..829037ba93 100644 --- a/ports/stm32/usbd_conf.c +++ b/ports/stm32/usbd_conf.c @@ -93,7 +93,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) { const uint32_t otg_alt = GPIO_AF10_OTG1_FS; #elif defined(STM32L0) const uint32_t otg_alt = GPIO_AF0_USB; - #elif defined(STM32L432xx) + #elif defined(STM32L432xx) || defined(STM32L452xx) const uint32_t otg_alt = GPIO_AF10_USB_FS; #elif defined(STM32H5) || defined(STM32WB) const uint32_t otg_alt = GPIO_AF10_USB; @@ -156,7 +156,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) { #elif defined(STM32L0) NVIC_SetPriority(USB_IRQn, IRQ_PRI_OTG_FS); HAL_NVIC_EnableIRQ(USB_IRQn); - #elif defined(STM32L432xx) + #elif defined(STM32L432xx) || defined(STM32L452xx) NVIC_SetPriority(USB_FS_IRQn, IRQ_PRI_OTG_FS); HAL_NVIC_EnableIRQ(USB_FS_IRQn); #elif defined(STM32G4) || defined(STM32L1) || defined(STM32WB)