Переглянути джерело

fix:(port/ch58x/usb_ch58x_dc_usbfs.c) fix out endpoint cannot receive bug

FanhuaCloud 6 місяців тому
батько
коміт
739db92ef0
1 змінених файлів з 3 додано та 3 видалено
  1. 3 3
      port/ch32/ch58x/usb_ch58x_dc_usbfs.c

+ 3 - 3
port/ch32/ch58x/usb_ch58x_dc_usbfs.c

@@ -543,11 +543,10 @@ void USBD_IRQHandler(uint8_t busid)
                     }
                     }
                     break;
                     break;
                 case UIS_TOKEN_OUT:
                 case UIS_TOKEN_OUT:
-                    EPn_SET_RX_NAK(epid);
-
                     if (epid == 0) {
                     if (epid == 0) {
                         /*!< ep0 out */
                         /*!< ep0 out */
                         CH58x_USBFS_DEV->UEP0_CTRL ^= RB_UEP_R_TOG;
                         CH58x_USBFS_DEV->UEP0_CTRL ^= RB_UEP_R_TOG;
+                        EPn_SET_RX_NAK(epid);
                         uint32_t read_count = EPn_GET_RX_LEN(0);
                         uint32_t read_count = EPn_GET_RX_LEN(0);
                         memcpy(usb_dc_cfg.ep_out[epid].xfer_buf, usb_dc_cfg.ep_out[epid].ep_ram_addr, read_count);
                         memcpy(usb_dc_cfg.ep_out[epid].xfer_buf, usb_dc_cfg.ep_out[epid].ep_ram_addr, read_count);
 
 
@@ -563,6 +562,7 @@ void USBD_IRQHandler(uint8_t busid)
                             if (epid == 4) {
                             if (epid == 4) {
                                 CH58x_USBFS_DEV->UEP4_CTRL ^= RB_UEP_R_TOG;
                                 CH58x_USBFS_DEV->UEP4_CTRL ^= RB_UEP_R_TOG;
                             }
                             }
+                            EPn_SET_RX_NAK(epid);
                             uint32_t read_count = EPn_GET_RX_LEN(epid);
                             uint32_t read_count = EPn_GET_RX_LEN(epid);
                             memcpy(usb_dc_cfg.ep_out[epid].xfer_buf, usb_dc_cfg.ep_out[epid].ep_ram_addr, read_count);
                             memcpy(usb_dc_cfg.ep_out[epid].xfer_buf, usb_dc_cfg.ep_out[epid].ep_ram_addr, read_count);
                             usb_dc_cfg.ep_out[epid].xfer_buf += read_count;
                             usb_dc_cfg.ep_out[epid].xfer_buf += read_count;
@@ -637,4 +637,4 @@ void USB_IRQHandler(void)
 {
 {
     extern void USBD_IRQHandler(uint8_t busid);
     extern void USBD_IRQHandler(uint8_t busid);
     USBD_IRQHandler(0);
     USBD_IRQHandler(0);
-}
+}