Hi
I am using a IMXRT1062 with usb cdc host. I use one example but I can't understand how it works. This example it gets the data from terminal and send it on the usb and vice versa. I want to send and receive data through my code. I use:
USB_HostCdcDataSend(g_cdc.classHandle, &bufferOut[0], bufferLen),
USB_HostCdcDataOutCallback, &g_cdc);
to send data. For receive data I use:
USB_HostCdcDataRecv(g_cdc.classHandle, (uint8_t *)&bufferRx[0],
bufferRxLen, USB_HostCdcDataInCallback, &g_cdc); I should get called irrespective.
if you see the example (below function) there is receive call when I am sending the data. This example works very well.
void USB_HostCdcDataOutCallback(void *param, uint8_t *data, uint32_t dataLength, usb_status_t status)
{
freeNodeToQueue(&g_EmptyQueue, g_UsbSendNode);
g_CurrentUsbRecvNode = getNodeFromQueue(&g_EmptySendQueue);
if (g_CurrentUsbRecvNode)
{
g_CurrentUsbRecvNode->next = NULL;
g_CurrentUsbRecvNode->dataLength = dataLength;
USB_HostCdcDataRecv(g_cdc.classHandle, (uint8_t *)&g_CurrentUsbRecvNode->buffer[0],
g_CurrentUsbRecvNode->dataLength, USB_HostCdcDataInCallback, &g_cdc);
}
g_UsbSendNode = getNodeFromQueue(&g_UsbSendQueue);
if (g_UsbSendNode)
{
USB_HostCdcDataSend(g_cdc.classHandle, (uint8_t *)&g_UsbSendNode->buffer[0], g_UsbSendNode->dataLength,
USB_HostCdcDataOutCallback, &g_cdc);
}
else
{
g_UsbSendBusy = 0;
}
}
Is it possible call USB_HostCdcDataRecv(g_cdc.classHandle, (uint8_t *)&g_CurrentUsbRecvNode->buffer[0],
g_CurrentUsbRecvNode->dataLength, USB_HostCdcDataInCallback, &g_cdc); independently from Send function?
thanks very much
resolved myself. Simply call one time ( USB_HostCdcDataRecv )