Skip to content

Commit 31a647e

Browse files
bbx10cmaglie
authored andcommitted
Fix 10 second blocking delay
Affects all devices that do IN transfers.
1 parent b00b1a2 commit 31a647e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

libraries/USBHost/src/Usb.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ uint32_t USBHost::ctrlReq(uint32_t addr, uint32_t ep, uint8_t bmReqType, uint8_t
143143
if (rcode)
144144
{
145145
TRACE_USBHOST(printf("/!\\ USBHost::ctrlReq : EP0 allocation error: %lu\r\n", rcode);)
146-
//USBTRACE2("\n\rUSBHost::ctrlReq : EP0 allocation error: ", rcode");
146+
//USBTRACE2("\n\rUSBHost::ctrlReq : EP0 allocation error: ", rcode");
147147
return rcode;
148148
}
149149

@@ -263,6 +263,7 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr
263263
continue;
264264
}
265265
if(rcode) {
266+
uhd_freeze_pipe(pep->epAddr);
266267
//printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode);
267268
return(rcode);// break; //should be 0, indicating ACK. Else return error code.
268269
}
@@ -305,6 +306,7 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr
305306
break;
306307
} // if
307308
} //while( 1 )
309+
uhd_freeze_pipe(pep->epAddr);
308310
return ( rcode);
309311
}
310312

@@ -422,6 +424,16 @@ uint32_t USBHost::dispatchPkt(uint32_t token, uint32_t epAddr, uint32_t nak_limi
422424
return 0;
423425
}
424426

427+
//case hrNAK:
428+
if((USB->HOST.HostPipe[epAddr].PINTFLAG.reg & USB_HOST_PINTFLAG_TRFAIL) ) {
429+
USB->HOST.HostPipe[epAddr].PINTFLAG.reg = USB_HOST_PINTFLAG_TRFAIL;
430+
nak_count++;
431+
if(nak_limit && (nak_count == nak_limit)) {
432+
rcode = USB_ERRORFLOW;
433+
return (rcode);
434+
}
435+
}
436+
425437
//case hrNAK:
426438
if( (usb_pipe_table[epAddr].HostDescBank[0].STATUS_BK.reg & USB_ERRORFLOW ) ) {
427439
nak_count++;

0 commit comments

Comments
 (0)