Main Site Documentation

USBH_SerialUSB read buffer length


#1

How many bytes does the read buffer contain, that is used in the USBH_SerialUSB driver?

The Serial-to-USB adapter I use contains 96 bytes buffer in hardware (Prolific 2303).
But when I first send e.g. 128 bytes data to the FEZ, and then read all data at once in FEZ will return 128 bytes.
Probably the SerialUSB driver picks up the data and stores it into a local variable in the driver.

How many bytes are reserved for that input buffer, and can it be changed in code?


#2

You shouldn’t rely on the internal buffer size in your code. Always read the data as fast your application allows.


#3

I do as fast as the application does allow. But i’m debugging an issue.

The application has 3 threads, one main, one for serial communication and one for network.

The serial thread only reads data from serial and writes it to a queue that is later processed by the main thread. When an exception occurs on the network thread (e.g. cable disconnected, server unavailable) serial communication misses characters. Data is send at 9600 baud.