Skip to content
Snippets Groups Projects
Commit 97e8e036 authored by Damien George's avatar Damien George
Browse files

stm32/usbd: Support USB device mode on STM32L432 MCUs.

parent bf733c27
No related branches found
No related tags found
No related merge requests found
...@@ -288,7 +288,7 @@ ...@@ -288,7 +288,7 @@
#endif #endif
// Whether the USB peripheral is device-only, or multiple OTG // Whether the USB peripheral is device-only, or multiple OTG
#if defined(STM32L0) || defined(STM32WB) #if defined(STM32L0) || defined(STM32L432xx) || defined(STM32WB)
#define MICROPY_HW_USB_IS_MULTI_OTG (0) #define MICROPY_HW_USB_IS_MULTI_OTG (0)
#else #else
#define MICROPY_HW_USB_IS_MULTI_OTG (1) #define MICROPY_HW_USB_IS_MULTI_OTG (1)
......
...@@ -298,7 +298,7 @@ void DebugMon_Handler(void) { ...@@ -298,7 +298,7 @@ void DebugMon_Handler(void) {
/* file (startup_stm32f4xx.s). */ /* file (startup_stm32f4xx.s). */
/******************************************************************************/ /******************************************************************************/
#if defined(STM32L0) #if defined(STM32L0) || defined(STM32L432xx)
#if MICROPY_HW_USB_FS #if MICROPY_HW_USB_FS
void USB_IRQHandler(void) { void USB_IRQHandler(void) {
......
...@@ -64,6 +64,8 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) { ...@@ -64,6 +64,8 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) {
const uint32_t otg_alt = GPIO_AF10_OTG1_FS; const uint32_t otg_alt = GPIO_AF10_OTG1_FS;
#elif defined(STM32L0) #elif defined(STM32L0)
const uint32_t otg_alt = GPIO_AF0_USB; const uint32_t otg_alt = GPIO_AF0_USB;
#elif defined(STM32L432xx)
const uint32_t otg_alt = GPIO_AF10_USB_FS;
#elif defined(STM32WB) #elif defined(STM32WB)
const uint32_t otg_alt = GPIO_AF10_USB; const uint32_t otg_alt = GPIO_AF10_USB;
#else #else
...@@ -113,6 +115,9 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) { ...@@ -113,6 +115,9 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) {
#if defined(STM32L0) #if defined(STM32L0)
NVIC_SetPriority(USB_IRQn, IRQ_PRI_OTG_FS); NVIC_SetPriority(USB_IRQn, IRQ_PRI_OTG_FS);
HAL_NVIC_EnableIRQ(USB_IRQn); HAL_NVIC_EnableIRQ(USB_IRQn);
#elif defined(STM32L432xx)
NVIC_SetPriority(USB_FS_IRQn, IRQ_PRI_OTG_FS);
HAL_NVIC_EnableIRQ(USB_FS_IRQn);
#elif defined(STM32WB) #elif defined(STM32WB)
NVIC_SetPriority(USB_LP_IRQn, IRQ_PRI_OTG_FS); NVIC_SetPriority(USB_LP_IRQn, IRQ_PRI_OTG_FS);
HAL_NVIC_EnableIRQ(USB_LP_IRQn); HAL_NVIC_EnableIRQ(USB_LP_IRQn);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment