Skip to content

Commit 4d3770b

Browse files
authored
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
1 parent 336aa91 commit 4d3770b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

port/ch32/usb_dc_usbhs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,12 @@ int usbd_ep_open(uint8_t busid, const struct usb_endpoint_descriptor *ep)
123123
g_ch32_usbhs_udc.in_ep[ep_idx].ep_enable = true;
124124
if (g_ch32_usbhs_udc.in_ep[ep_idx].ep_type == USB_ENDPOINT_TYPE_ISOCHRONOUS) {
125125
USBHS_DEVICE->ENDP_TYPE |= (1 << (ep_idx));
126+
USB_SET_TX_CTRL(ep_idx, USBHS_EP_T_RES_NAK | USBHS_EP_T_TOG_0);
126127
} else {
127128
USBHS_DEVICE->ENDP_TYPE &= ~(1 << (ep_idx));
129+
USB_SET_TX_CTRL(ep_idx, USBHS_EP_T_RES_NAK | USBHS_EP_T_TOG_0 | USBHS_EP_T_AUTOTOG);
128130
}
129131
USBHS_DEVICE->ENDP_CONFIG |= (1 << (ep_idx));
130-
USB_SET_TX_CTRL(ep_idx, USBHS_EP_T_RES_NAK | USBHS_EP_T_TOG_0 | USBHS_EP_T_AUTOTOG);
131132
}
132133
USB_SET_MAX_LEN(ep_idx, USB_GET_MAXPACKETSIZE(ep->wMaxPacketSize));
133134
return 0;

0 commit comments

Comments
 (0)