diff options
| author | Links0617 <[email protected]> | 2026-11-11 14:04:20 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-11-11 16:18:54 +0800 |
| commit | 05007a0cdcf480ff5e870ce142bc92c217060fc8 (patch) | |
| tree | 25f3dd1dfd8da03d9247125c094c6516e05a247c | |
| parent | a0054795c44037ace8a2b77b6e610adbff2257ea (diff) | |
fix(port/wch usbhsd): Fix the TOG mismatch issue following a bus reset on the USBHS device interface
| -rw-r--r-- | port/wch/usbhs/usb_dc_usbhs.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/port/wch/usbhs/usb_dc_usbhs.c b/port/wch/usbhs/usb_dc_usbhs.c index ccb08020..6a5d1733 100644 --- a/port/wch/usbhs/usb_dc_usbhs.c +++ b/port/wch/usbhs/usb_dc_usbhs.c @@ -407,6 +407,20 @@ void USBD_IRQHandler(uint8_t busid) } } else if (flag & USBHS_UDIF_BUS_RST) { USBHSD->DEV_AD = 0; + USBHSD->UEP_TX_EN = 0; + USBHSD->UEP_RX_EN = 0; + USBHSD->UEP_TX_ISO = 0; + USBHSD->UEP_RX_ISO = 0; + USBHSD->UEP_TX_TOG_AUTO = 0; + USBHSD->UEP_RX_TOG_AUTO = 0; + USBHSD->UEP_TX_BURST = 0; + USBHSD->UEP_RX_BURST = 0; + USBHSD->UEP_TX_BURST_MODE = 0; + USBHSD->UEP_RX_RES_MODE = 0; + for (uint8_t i = 0; i < 8; i++) { + ENDP_TX_CTRL(i) = 0; + ENDP_RX_CTRL(i) = 0; + } USBHSD->UEP0_DMA = (uint32_t)&g_ch32_usbhs_udc[busid].setup; USBHSD->UEP0_TX_CTRL = USBHS_UEP_T_RES_NAK; USBHSD->UEP0_RX_CTRL = USBHS_UEP_R_RES_ACK; |
