Skip to content

Commit c045878

Browse files
committed
Fix USBSerial for large receives
When GDB would send packets larger than 256 bytes, the rx_buffer in USBSerial would fill before it completely emptied the underlying USBCDC receive buffer in the onInterrupt() callback. Since the underlying USBCDC receive buffer still had data in it, it would never call onInterrupt() again and MRI would never receive any more data from GDB. I just added a call to onInterrupt() to any USBSerial methods which relate to receiving data to make sure that the underlying USBCDC receive buffer has a chance to be emptied so that more data can be received from the PC.
1 parent c541772 commit c045878

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cores/arduino/USB/PluggableUSBSerial.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,17 @@ class USBSerial: public USBCDC, public ::mbed::Stream, public HardwareSerial {
221221
}
222222

223223
int available(void) {
224+
onInterrupt();
224225
return rx_buffer.available();
225226
}
226227

227228
int peek(void) {
229+
onInterrupt();
228230
return rx_buffer.peek();
229231
}
230232

231233
int read(void) {
234+
onInterrupt();
232235
return rx_buffer.read_char();
233236
}
234237

0 commit comments

Comments
 (0)