From 71ab6240f2dd8132ab29d9251690b3f8b6da0517 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Fri, 15 Dec 2023 19:43:58 +0000 Subject: [PATCH] stm32: Fix STM32G4 USB STM32G4 USB controller requires 8 or 16-bit access, not 32-bit Signed-off-by: Alex Maclean --- src/stm32/usbfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/stm32/usbfs.c b/src/stm32/usbfs.c index ad2e7b3e..5385c956 100644 --- a/src/stm32/usbfs.c +++ b/src/stm32/usbfs.c @@ -15,7 +15,7 @@ #include "internal.h" // GPIO #include "sched.h" // DECL_INIT -#if CONFIG_MACH_STM32F1 || CONFIG_MACH_STM32G4 +#if CONFIG_MACH_STM32F1 // Transfer memory is accessed with 32bits, but contains only 16bits of data typedef volatile uint32_t epmword_t; #define WSIZE 2 @@ -25,6 +25,11 @@ typedef volatile uint16_t epmword_t; #define WSIZE 2 #define USBx_IRQn USB_IRQn +#elif CONFIG_MACH_STM32G4 + // Transfer memory is accessed with 16bits and contains 16bits of data + typedef volatile uint16_t epmword_t; + #define WSIZE 2 + #define USBx_IRQn USB_LP_IRQn #elif CONFIG_MACH_STM32G0 // Transfer memory is accessed with 32bits and contains 32bits of data typedef volatile uint32_t epmword_t;