Hi,
I am trying to setup a reliable USB connection to exchange some data between the frdm-k22f and my pc.
The usb_device_cdc_vcom demo itself works as expected, echoing anything I send.
When trying to send more then one packet from the board the data will get messed up. There will be missing data / data sent twice.
Sending 5 packets as reply to one incoming byte with a simple counter will result in the answer "1/2/3/4/4" so the 0 packet is missing and the 4 is being sent twice.
Looping the USB_DeviceCdcAcmSend command with a larger buffer can kill the connection too, so the problem seems to be that even if returning kStatus_USB_Success it doesn't ensure that the data has been sent or that the hardware is ready to accept new data.
Any hint how to ensure the data gets sent would be appreciated.
Minimal code example ( s_cdcVcom.startTransactions has to be set to 1 / commented out for the demo to work
static uint32_t counter = 0; static uint32_t buffersize = 4; int k, i = 0; if ((0 != s_recvSize) && (0xFFFFFFFFU != s_recvSize)) { for (k = 0; k < 5; k++) { for (i = 0; i < buffersize; i += 4) { s_currSendBuf[i + 3] = (counter >> 24) & 0xff; s_currSendBuf[i + 2] = (counter >> 16) & 0xff; s_currSendBuf[i + 1] = (counter >> 8) & 0xff; s_currSendBuf[i + 0] = (counter) & 0xff; counter++; } do { error = USB_DeviceCdcAcmSend(s_cdcVcom.cdcAcmHandle,USB_CDC_VCOM_BULK_IN_ENDPOINT, s_currSendBuf, buffersize); } while (error != kStatus_USB_Success); } s_recvSize = 0; }