Skip to content

Commit a4ac6d1

Browse files
author
Alrik Vidstrom
committed
Fix I/O errors when using slow USB thumb drives
Increases the MAX_NOTREADY_RETRY from 5 to 50000. The previous value (5) was not nearly enough to handle the slow writes to some USB thumb drives. While it worked with some models, it failed all the time with others. 50000 might be a bit on the high side, but it adds margin since we can't possibly test all the models out there.
1 parent 8c3c35a commit a4ac6d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/targets/TARGET_STM/USBHALHost_STM.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838

3939
#define TOTAL_SIZE (HCCA_SIZE + (MAX_ENDPOINT * ED_SIZE) + (MAX_TD * TD_SIZE))
4040

41-
#define MAX_NOTREADY_RETRY 5
41+
// This must be a large number to account for the relatively high write latency of USB thumb drives
42+
#define MAX_NOTREADY_RETRY 50000
4243

4344
/* STM device FS have 11 channels (definition is for 60 channels) */
4445
static volatile uint8_t usb_buf[TOTAL_SIZE];

0 commit comments

Comments
 (0)