From 4df891259399a9b7e1ff4143ac40568966f7c2ae Mon Sep 17 00:00:00 2001 From: Epagris Date: Tue, 25 Jun 2024 08:09:54 +0200 Subject: [PATCH] - InaboF407 working code --- usb_driver.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/usb_driver.c b/usb_driver.c index c8f75e7..16c6024 100644 --- a/usb_driver.c +++ b/usb_driver.c @@ -132,6 +132,9 @@ void usbdrv_init_global_state() { #endif } +// --------------- + + #if defined(USB_STM32H7) #define TOCAL_VALUE (0x00) #define TRDT_VALUE (0x05) @@ -382,11 +385,10 @@ void usbdrv_initial_ep0_setup() { // addresses of specific DIEPTXF registers, addresses from the RM static uint32_t *USB_pDIEPTXF[4] = { - (uint32_t *)(USBG + 0x028), // DIEPTXF0 - (uint32_t *)(USBG + 0x104), // DIEPTXF1 - (uint32_t *)(USBG + 0x108), // DIEPTXF2 - (uint32_t *)(USBG + 0x10C), // DIEPTXF3 - // TODO: HS USB controller has more endpoints + (uint32_t *)(((uint32_t)USBG) + 0x028), // DIEPTXF0 + (uint32_t *)(((uint32_t)USBG) + 0x104), // DIEPTXF1 + (uint32_t *)(((uint32_t)USBG) + 0x108), // DIEPTXF2 + (uint32_t *)(((uint32_t)USBG) + 0x10C), // DIEPTXF3 }; // configure USB endpoint @@ -641,7 +643,7 @@ uint32_t usbdrv_arm_IN_endpoint(uint8_t ep, const uint8_t *data, uint16_t len) { // arm OUT endpoint uint32_t usbdrv_arm_OUT_endpoint(uint8_t ep, uint8_t size) { - // arm endpoint only if it was not armed before OR if it's the EP0 OUT which is always enabled, but responds NAK after a successful transfer + // arm endpoint only if it was not armed before if (READ_BIT(USBOUTEP[ep].DOEPCTL, USB_OTG_DOEPCTL_EPENA)) { return 0; }