Hi danielchen@fsl,
Thanks for the quick response - I'll continue in this thread since I'm now 100% on the RT1052 (no longer using the RT1021).
So in order to reproduce:
MCUXpresso 11.1.1, SDK2.7.0 -> SDK Example "dev_cdc_vcomm_freertos" -> Link using Internal SRAM only and DebugPrint goes to SemiHost
Then on my board - we're using USB OTG2, so I have to go to virtual_com.h and update the controller to:
#define CONTROLLER_ID kUSB_ControllerEhci1
If you're on the EVK, can skip that step.
After this, I run, and the demo works, echo's just fine.
Now to duplicate my issue, we simply have to try and echo only every third or 4th RX.
Just add a static int RX counter, still reset the TX buff every RX, but only try to send on every 3rd or 4th packet, and it'll fail as soon as you get multiple RX's without doing a TX.
Here's the modified AppTask for you to test:
void APPTask(void *handle)
{
usb_status_t error = kStatus_USB_Error;
static int numRxs = 0;
USB_DeviceApplicationInit();
while (1)
{
if ((1 == s_cdcVcom.attach) && (1 == s_cdcVcom.startTransactions))
{
if ((0 != s_recvSize) && (0xFFFFFFFF != s_recvSize))
{
int32_t i;
numRxs++;
for (i = 0; i < s_recvSize; i++)
{
s_currSendBuf[s_sendSize++] = s_currRecvBuf[i];
}
s_recvSize = 0;
}
if (s_sendSize)
{
uint32_t size = s_sendSize;
s_sendSize = 0;
if ((numRxs % 4) == 1){
error = USB_DeviceCdcAcmSend(s_cdcVcom.cdcAcmHandle, USB_CDC_VCOM_BULK_IN_ENDPOINT, s_currSendBuf, size);
if (error != kStatus_USB_Success)
{
}
}
}
}
}
}