This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Question about using "USBD_CDC_ACM_WriteData()" middleware call

Hi,

I have a VCOM USB application and my intent is to send as many messages as possible to an attached PC via the VCOM serial interface. Since I am using middleware I don't have access to the traditional osWait / signal process for flow control.

So I built a queue of messages to send and in my USB application thread I have the following code to de-queue and send.

//
//  Write the message to USB
//
do
{
   intUSBStatus = USBD_CDC_ACM_WriteData( 0U, (const uint8_t *)strCAN0, strlen( strCAN0 ) );
}while( intUSBStatus == usbDriverBusy );

//
//  check for error
//
if( intUSBStatus != strlen( strCAN0 ) )
{
    strCntrs2.TxErrStatus++;
}

Question1
-------------
I will hang here if the usbDriverBusy stays active. Is there a safer way to pace the code... or does the RTOS guarantee to not lock up on busy.

Question 2
------------
I don't have an osWait() call in the busy loop. Will I hog the CPU or will the RTOS take care of that?

Any pointers on the best way to pace the USBD_CDC_ACM_WriteData() would be appreciated.

Thanks,
Tony

Parents Reply Children