1. Is there meant to be a function in USB that checks if the USB is free before trying to send another packet?
In the test code below, I get strange behavior on the VCP terminal - normally only see "USB CDC Demo-2" coming out when I press the 's' key. If I put a small delay between the two 'CDC Sends' I get both strings, but not always.
Code: Select all
void USBDev_CDCDataReceived(uint16_t size)
{
USBDev_CDCSetReceiveBuffer(buffer);
if (buffer[0] == 's')
{
strcpy(buffer, "USB CDC Demo-1");
USBDev_CDCSendData(buffer, strlen(buffer));
strcpy(buffer, "USB CDC Demo-2");
USBDev_CDCSendData(buffer, strlen(buffer));
}
}
The terminal I am connecting the VCP program to, seems not to mind what baud rate is set - it still communicates - and also changing the parameters in the initialization of USBDev_CDCSetLineCoding function seems to make no difference to speed or operation.
Please help me understand what this function is doing?
Thank you.