stm32/usb: Fix USB support on STM32G4.
Also fix MAX_ENDPOINT definition for G0, which follows G4. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
parent
0000eb2724
commit
f4b4d05e49
@ -559,7 +559,7 @@
|
||||
#endif
|
||||
|
||||
// Whether the USB peripheral is device-only, or multiple OTG
|
||||
#if defined(STM32L0) || defined(STM32L432xx) || defined(STM32WB)
|
||||
#if defined(STM32G4) || defined(STM32L0) || defined(STM32L432xx) || defined(STM32WB)
|
||||
#define MICROPY_HW_USB_IS_MULTI_OTG (0)
|
||||
#else
|
||||
#define MICROPY_HW_USB_IS_MULTI_OTG (1)
|
||||
|
@ -312,7 +312,7 @@ void USB_IRQHandler(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif defined(STM32WB)
|
||||
#elif defined(STM32G4) || defined(STM32WB)
|
||||
|
||||
#if MICROPY_HW_USB_FS
|
||||
void USB_LP_IRQHandler(void) {
|
||||
|
@ -59,7 +59,7 @@
|
||||
#endif
|
||||
|
||||
// Maximum number of endpoints (excluding EP0)
|
||||
#if defined(STM32L0) || defined(STM32WB)
|
||||
#if defined(STM32G0) || defined(STM32G4) || defined(STM32L0) || defined(STM32WB)
|
||||
#define MAX_ENDPOINT(dev_id) (7)
|
||||
#elif defined(STM32L4)
|
||||
#define MAX_ENDPOINT(dev_id) (5)
|
||||
@ -67,7 +67,7 @@
|
||||
#define MAX_ENDPOINT(dev_id) ((dev_id) == USB_PHY_FS_ID ? 3 : 5)
|
||||
#elif defined(STM32F7)
|
||||
#define MAX_ENDPOINT(dev_id) ((dev_id) == USB_PHY_FS_ID ? 5 : 8)
|
||||
#elif defined(STM32G0) || defined(STM32H7)
|
||||
#elif defined(STM32H7)
|
||||
#define MAX_ENDPOINT(dev_id) (8)
|
||||
#endif
|
||||
|
||||
|
@ -67,7 +67,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) {
|
||||
if (hpcd->Instance == USB_OTG_FS) {
|
||||
// Configure USB GPIO's.
|
||||
|
||||
#if defined(STM32G0)
|
||||
#if defined(STM32G0) || defined(STM32G4)
|
||||
|
||||
// These MCUs don't have an alternate function for USB but rather require
|
||||
// the pins to be disconnected from all peripherals, ie put in analog mode.
|
||||
@ -146,7 +146,7 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) {
|
||||
#elif defined(STM32L432xx)
|
||||
NVIC_SetPriority(USB_FS_IRQn, IRQ_PRI_OTG_FS);
|
||||
HAL_NVIC_EnableIRQ(USB_FS_IRQn);
|
||||
#elif defined(STM32WB)
|
||||
#elif defined(STM32G4) || defined(STM32WB)
|
||||
NVIC_SetPriority(USB_LP_IRQn, IRQ_PRI_OTG_FS);
|
||||
HAL_NVIC_EnableIRQ(USB_LP_IRQn);
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user