From 7905132333c3225e0d7349045aa0e41b7b124cf1 Mon Sep 17 00:00:00 2001 From: Kizarm Date: Sat, 12 Oct 2024 14:02:13 +0200 Subject: [PATCH] repair ack --- V203/usb/cdc/ch32v203/cdc_class.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/V203/usb/cdc/ch32v203/cdc_class.cpp b/V203/usb/cdc/ch32v203/cdc_class.cpp index cbb4925..d6a321c 100644 --- a/V203/usb/cdc/ch32v203/cdc_class.cpp +++ b/V203/usb/cdc/ch32v203/cdc_class.cpp @@ -292,7 +292,7 @@ __always_inline void cdc_class::OutTokenHandler(const uint8_t intst) { const char *ptr = reinterpret_cast (USBFS_EP2_Buf); USBFSD->UEP2_RX_CTRL = (USBFSD->UEP2_RX_CTRL & ~USBFS_UEP_R_RES_MASK) | USBFS_UEP_R_RES_NAK; Up (ptr, rlen); - USBFSD->UEP2_RX_CTRL = (USBFSD->UEP2_RX_CTRL & ~USBFS_UEP_R_RES_MASK) | USBFS_UEP_R_RES_NAK; + USBFSD->UEP2_RX_CTRL = (USBFSD->UEP2_RX_CTRL & ~USBFS_UEP_R_RES_MASK) | USBFS_UEP_R_RES_ACK; } break; default: @@ -665,12 +665,10 @@ uint32_t cdc_class::Down (const char * data, const uint32_t len) { uint32_t rem = len; const uint32_t max = DEF_USBD_ENDP3_SIZE; const uint8_t * ptr = reinterpret_cast (data); - // zde se musí počkat, nevím proč, ale jinak to nechodí - delay_us(1'000); // 1ms stačí pro odchod paketu po USB while (rem) { const uint32_t chunk = rem > max ? max : rem; if (USBFS_Endp_DataUp (DEF_UEP3, ptr, chunk, DEF_UEP_CPY_LOAD)) { - delay_us(1'000); // čekej dokud je USBFS_Endp_Busy + delay_us(10); // čekej dokud je USBFS_Endp_Busy } else { ptr += chunk; rem -= chunk;