AnsweredAssumed Answered

How to USB CDC VCOM set line coding ?

Question asked by Nicolas Pinault on Aug 7, 2018

Hi,

 

I've started a new project using USB CDC VCOM.

I've imported a SDK example to get a starting example.

In need to manage line coding parameters (baudrate, parity, nb bits...).

 

Here is the code of the class callback managing line coding in the SDK example :

        case kUSB_DeviceCdcEventGetLineCoding:
            *(acmReqParam->buffer) = vcomInstance->lineCoding;
            *(acmReqParam->length) = LINE_CODING_SIZE;
            error = kStatus_USB_Success;
            break;

        case kUSB_DeviceCdcEventSetLineCoding:
        {
            if (1 == acmReqParam->isSetup)
            {
                *(acmReqParam->buffer) = vcomInstance->lineCoding;
            }
            else
            {
                *(acmReqParam->length) = 0;
            }
        }
            error = kStatus_USB_Success;
            break;

The code in kUSB_DeviceCdcEventGetLineCoding is ok.

We provide a buffer address containing line coding data. These data will be sent to the host.

 

The code in kUSB_DeviceCdcEventSetLineCoding is problematic.

From what I understand : We, again, provide a buffer address. This buffer address wil be used to receive data from the host when the callback is exited. We don't have data yet so we can't do the real work.

How can the application be aware that data from the host have been received ?

 

Best regards,

Nicolas

Outcomes