USB CDC Example Receive only fail

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB CDC Example Receive only fail

44 Views
etronic_arg
Contributor III

Hi,

I just trying to do a Virtual COM communication based on the USB CDC example from SDK.
I tested the example with success.

I cancel the "echo" part of the APPTask:

static void APPTask(void)
{
    usb_status_t error = kStatus_USB_Error;
    if ((1 == s_cdcVcom.attach) && (1 == s_cdcVcom.startTransactions))
    {
        /* User Code */
        /* endpoint callback length is USB_CANCELLED_TRANSFER_LENGTH (0xFFFFFFFFU) when transfer is canceled */
        if ((0 != s_recvSize) && (USB_CANCELLED_TRANSFER_LENGTH != s_recvSize))
        {
            int32_t i;

			/* Copy Buffer to Send Buff */
            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;

            error = USB_DeviceCdcAcmSend(s_cdcVcom.cdcAcmHandle, USB_CDC_VCOM_BULK_IN_ENDPOINT, s_currSendBuf, size);

            if (error != kStatus_USB_Success)
            {
                // Failure to send Data Handling code here
            }
        }
*/

 

If I send "HELLO" wth a terminal from a PC, the first time s_currSendBuf fills with the characters.

With the second "HELLO" I send, the terminal stucks.

I just need to receive characters but not send them back.
What would be the right way to do it?

Thanks

 

Tags (3)
0 Kudos
Reply
0 Replies