lpcware

Does LPC1343 USBCDC example lack flow control when sending from target to host?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by ian201 on Tue Feb 01 11:56:59 MST 2011
When using the lpcxpresso usbcdc example, data appears to be lost when sending large amounts from target to host. Does the example usbcdc lack flow control? Is this a limitation of the usb cdc specification, or the lpc1343 device?

vcomdemo.c V1.02
cdcuser.c V1.10
usbcore.c V1.20
serial.c V1.10

The code changes made below are to construct a pathological test, which floods the USB interface with writes from target to host. I set ser_AvailChar to always return '1' to signal data is always available. In ser_AvailChar, a single incrementing byte is sent on each call. The usbcdc example project is otherwise unmodified.

I would expect to see in the output file [0,1,2,3,4,...,255,0,1,2...], repeated as fast as the target interface can send, and the host can accept.

On Linux:
cat /dev/ttyACM0 > capture
hexdump capture | less

* serial.c *

int ser_Read (char *buffer, const int *length) {
        static int increment = 0;
        buffer[0] = increment++;
        return 1;
}

void ser_AvailChar (int *availChar) {
        return 1;
}

Outcomes