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

This commit is contained in:
Damien George 2019-08-15 12:46:04 +10:00
parent bf733c27bb
commit 97e8e036c5
3 changed files with 7 additions and 2 deletions

View File

@ -288,7 +288,7 @@
#endif
// 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)
#else
#define MICROPY_HW_USB_IS_MULTI_OTG (1)

View File

@ -298,7 +298,7 @@ void DebugMon_Handler(void) {
/* file (startup_stm32f4xx.s). */
/******************************************************************************/
#if defined(STM32L0)
#if defined(STM32L0) || defined(STM32L432xx)
#if MICROPY_HW_USB_FS
void USB_IRQHandler(void) {

View File

@ -64,6 +64,8 @@ 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)
const uint32_t otg_alt = GPIO_AF10_USB_FS;
#elif defined(STM32WB)
const uint32_t otg_alt = GPIO_AF10_USB;
#else
@ -113,6 +115,9 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) {
#if defined(STM32L0)
NVIC_SetPriority(USB_IRQn, IRQ_PRI_OTG_FS);
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)
NVIC_SetPriority(USB_LP_IRQn, IRQ_PRI_OTG_FS);
HAL_NVIC_EnableIRQ(USB_LP_IRQn);