@@ -38,7 +38,6 @@ static volatile uint8_t rxLEDPulse; /**< Milliseconds remaining for data Rx LED
38
38
#endif
39
39
static char isRemoteWakeUpEnabled = 0 ;
40
40
static char isEndpointHalt = 0 ;
41
- static char lastTransmitTimedOut = 0 ;
42
41
43
42
extern void (*gpf_isr)(void );
44
43
@@ -602,6 +601,16 @@ uint8_t USBDeviceClass::armRecv(uint32_t ep)
602
601
// Timeout for sends
603
602
#define TX_TIMEOUT_MS 70
604
603
604
+ static char LastTransmitTimedOut[7 ] = {
605
+ 0 ,
606
+ 0 ,
607
+ 0 ,
608
+ 0 ,
609
+ 0 ,
610
+ 0 ,
611
+ 0
612
+ };
613
+
605
614
// Blocking Send of data to an endpoint
606
615
uint32_t USBDeviceClass::send (uint32_t ep, const void *data, uint32_t len)
607
616
{
@@ -627,13 +636,13 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
627
636
// previous transfer is still not complete
628
637
629
638
// convert the timeout from microseconds to a number of times through
630
- // the wait loop; it takes (roughly) 18 clock cycles per iteration.
631
- uint32_t timeout = microsecondsToClockCycles (TX_TIMEOUT_MS * 1000 ) / 18 ;
639
+ // the wait loop; it takes (roughly) 23 clock cycles per iteration.
640
+ uint32_t timeout = microsecondsToClockCycles (TX_TIMEOUT_MS * 1000 ) / 23 ;
632
641
633
642
// Wait for (previous) transfer to complete
634
643
while (!usbd.epBank1IsTransferComplete (ep)) {
635
- if (lastTransmitTimedOut || timeout-- == 0 ) {
636
- lastTransmitTimedOut = 1 ;
644
+ if (LastTransmitTimedOut[ep] || timeout-- == 0 ) {
645
+ LastTransmitTimedOut[ep] = 1 ;
637
646
638
647
// set byte count to zero, so that ZLP is sent
639
648
// instead of stale data
@@ -643,7 +652,7 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
643
652
}
644
653
}
645
654
646
- lastTransmitTimedOut = 0 ;
655
+ LastTransmitTimedOut[ep] = 0 ;
647
656
648
657
if (len >= EPX_SIZE) {
649
658
length = EPX_SIZE - 1 ;
0 commit comments