Hello,
I initially tested the demo without modification with minicom with now issues. However, I want to send large blocks of data so I wrote the python code to try this out and made a modification to the example to just memcpy the recv buffer into the send buffer instead of copying a bytes at a time. A couple of test seems OK so I started adding packet parsing code to the example.
I am sending data in chunks of anywhere from 74 bytes to 25K and when I started sending multiple 25K transfers the device started hanging. I then modified the example to only echo back one byte instead of the full 512 bytes chunks it was received but the problem still persisted. I also did just try using 'cat' to send data to the tty but same result.
What I have been able to figure out at this time is that to receive another incoming packet the receive endpoint must be primed and this is what "echoing" that data back is doing. I doesn't need to be the entire buffer, one bytes is sufficient. However, there seems to be a race somewhere because typically in the middle of a multi-packet transfer, the receive endpoint is NOT being primed. In other words, I can see when try transfer hangs by looking at the usbmon trace; then if I pause the K28 and look at the USB controller regs on the K28 the prime bit is not set.
I have not been able to figure out the exact sequence of event to trigger on to figure out what is causing the priming event to be lost. I'm surprised this isn't working since this seems like a common thing to want to do.
Currently I have found if I call
USB_DeviceCdcAcmRecv(handle, USB_CDC_VCOM_BULK_OUT_ENDPOINT, s_currRecvBuf, g_UsbDeviceCdcVcomDicEndpoints[0].maxPacketSize);
after copying the receive buffer for the kUSB_DeviceCdcEventRecvResponse case, I don't get the hang. Then I can't parse a single buffer fast enough but that is easier to solve.
I'm just concerned this is not the right approach since I haven't solve the root problem.
thanks for you input,
jeff