From 5a1c5cf0b7eadf11bdf98e2f11c8d065049aeb51 Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Thu, 14 Feb 2019 23:41:16 -0500 Subject: [PATCH] stm32f4: Clarify comments and disable OTGINT; fixes stack reset on cable disconnect, and we don't use OTG right now. --- src/portable/stm/stm32f4/dcd_stm32f4.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/portable/stm/stm32f4/dcd_stm32f4.c b/src/portable/stm/stm32f4/dcd_stm32f4.c index 3d4e06b29..d93fc8c9e 100644 --- a/src/portable/stm/stm32f4/dcd_stm32f4.c +++ b/src/portable/stm/stm32f4/dcd_stm32f4.c @@ -142,8 +142,10 @@ bool dcd_init (uint8_t rhport) USB_OTG_GINTSTS_USBRST | USB_OTG_GINTSTS_ENUMDNE | \ USB_OTG_GINTSTS_ESUSP | USB_OTG_GINTSTS_USBSUSP | USB_OTG_GINTSTS_SOF; - // Required as part of core initialization. - USB_OTG_FS->GINTMSK |= USB_OTG_GINTMSK_OTGINT | USB_OTG_GINTMSK_MMISM; + // Required as part of core initialization. Disable OTGINT as we don't use + // it right now. TODO: How should mode mismatch be handled? It will cause + // the core to stop working/require reset. + USB_OTG_FS->GINTMSK |= /* USB_OTG_GINTMSK_OTGINT | */ USB_OTG_GINTMSK_MMISM; USB_OTG_DeviceTypeDef * dev = ((USB_OTG_DeviceTypeDef *) (USB_OTG_FS_PERIPH_BASE + USB_OTG_DEVICE_BASE)); @@ -577,7 +579,7 @@ void OTG_FS_IRQHandler(void) { _setup_packet[1] = (* rx_fifo); } break; - default: // Invalid, do something here? + default: // Invalid, do something here, like breakpoint? break; }