Note that this is a rewrite of this topic. Now that I understand the problem and have confirmation from another developer that its a valid issue, it seemed appropriate to repost with correct subject line and only the essential details...
Referring to the usb_device_cdc_vcom_lite example from the SDK. This example just echoes whatever character is sent. Here's a --slightly modified-- snippet taken directly from the example...
void APP_task(void)
{
usb_status_t error = kStatus_USB_Error;
if ((1 == s_cdcVcom.attach) && (1 == s_cdcVcom.startTransactions))
{
/* User Code */
if ((0 != s_recvSize) && (0xFFFFFFFFU != s_recvSize))
{
int32_t i;
/* Copy Buffer to Send Buff */
for (i = 0; i < s_recvSize; i++)
{
#ifdef DEMONSTRATE_THE_ERROR
if (s_currRecvBuf[i] != 'Z')
#endif
s_currSendBuf[s_sendSize++] = s_currRecvBuf[i];
}
s_recvSize = 0;
}
if (s_sendSize)
{
uint32_t size = s_sendSize;
s_sendSize = 0;
error = USB_DeviceSendRequest(s_cdcVcom.deviceHandle, USB_CDC_VCOM_BULK_IN_ENDPOINT, s_currSendBuf, size);
if (error != kStatus_USB_Success)
{
/* Failure to send Data Handling code here */
}
}
}
}
With DEMONSTRATE_THE_ERROR undefined, the above code works... It simply echoes each character received from the host back to the host. If DEMONSTRATE_THE_ERROR is defined and the host sends 'Z', all echoes stop, and the connection is essentially dead as best I can tell.
One additional note...
If I call USB_DeviceSendRequest() with buffer and size set to 0 when I receive the 'Z', the 'Z' is not echoed, but after that characters are echoed. So it appears that for each incoming (from the host) character there needs to be a corresponding call to USB_DeviceSendRequest() even if the length is zero.
It appears to me that this is an issue in the SDK, can someone from NXP take a look and offer some suggestions?