summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifroy Henry <[email protected]>2023-01-03 15:56:14 -0500
committerhathach <[email protected]>2024-04-11 20:57:39 +0700
commitb8b22b929e1bbbbae7c7337972129ae6f7192bc6 (patch)
treee4dcb9923067844ce4cb0b51427f7bec36c75bed
parent5a9b3eab6f3aa5e9fc71b902bfdbfef1acb29b44 (diff)
Allow re-enumeration on host power cycle.
-rw-r--r--src/portable/ti/msp430x5xx/dcd_msp430x5xx.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c b/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c
index 46b7d6458..a0d9b3ea5 100644
--- a/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c
+++ b/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c
@@ -94,7 +94,12 @@ static void bus_reset(void)
USBOEPCNT_0 &= ~NAK;
USBIEPCNT_0 &= ~NAK;
- USBCTL |= FEN; // Enable responding to packets.
+ // Disable (subsequent) bus reset events from causing a functional
+ // reset of the USB module.
+ USBCTL &= ~FRSTE;
+
+ // Enable responding to packets.
+ USBCTL |= FEN;
// Dedicated buffers in hardware for SETUP and EP0, no setup needed.
// Now safe to respond to SETUP packets.
@@ -334,6 +339,10 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
if(epnum == 0)
{
+ // Enables a bus reset to cause a functional reset of the USB
+ // module.
+ USBCTL |= FRSTE;
+
if(dir == TUSB_DIR_OUT)
{
// Interrupt will notify us when data was received.