From 4d3770b5d0ca5291941e95b64b68e804b0265b30 Mon Sep 17 00:00:00 2001 From: sumengqi Date: Sun, 11 May 2025 09:09:06 +0800 Subject: fix:(port/ch32/usb_dc_usbhs.c) fix isochronous in endpoint config bug (#314) * fix:(port/ch32/usb_dc_usbhs.c) fix isochronous in endpoint config bug --- port/ch32/usb_dc_usbhs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/port/ch32/usb_dc_usbhs.c b/port/ch32/usb_dc_usbhs.c index f2b8caa3..bc9efb9b 100644 --- a/port/ch32/usb_dc_usbhs.c +++ b/port/ch32/usb_dc_usbhs.c @@ -123,11 +123,12 @@ int usbd_ep_open(uint8_t busid, const struct usb_endpoint_descriptor *ep) g_ch32_usbhs_udc.in_ep[ep_idx].ep_enable = true; if (g_ch32_usbhs_udc.in_ep[ep_idx].ep_type == USB_ENDPOINT_TYPE_ISOCHRONOUS) { USBHS_DEVICE->ENDP_TYPE |= (1 << (ep_idx)); + USB_SET_TX_CTRL(ep_idx, USBHS_EP_T_RES_NAK | USBHS_EP_T_TOG_0); } else { USBHS_DEVICE->ENDP_TYPE &= ~(1 << (ep_idx)); + USB_SET_TX_CTRL(ep_idx, USBHS_EP_T_RES_NAK | USBHS_EP_T_TOG_0 | USBHS_EP_T_AUTOTOG); } USBHS_DEVICE->ENDP_CONFIG |= (1 << (ep_idx)); - USB_SET_TX_CTRL(ep_idx, USBHS_EP_T_RES_NAK | USBHS_EP_T_TOG_0 | USBHS_EP_T_AUTOTOG); } USB_SET_MAX_LEN(ep_idx, USB_GET_MAXPACKETSIZE(ep->wMaxPacketSize)); return 0; -- cgit v1.3.1