CX3 uvc cdc - Data packet missing in virtual serial port

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ajmc_3522501
Level 3
Level 3
5 likes given First like given

Hi,

I'm using the CX3 UVC-CDC configuration (Cx3UvcOV5640_UVC_CDC)

The virtual serial port is used to communicate with the sensor periodically, the process followed are

1. Open the CDC COM port and send some bytes

2. The sensor responds to the commands.

4. Close the COM port.

5. Repeat the above steps in a definite interval.

During this process after some time, the CDC device misses data. The sensor is replying to CX3 but it is not received in the CDC device and the PC doesn't get a reply.

The serial driver were automatically installed when device was connected to PC(Windows 10).

Could you please help me out to solve this issue.

Regards

Ajay

0 Likes
1 Solution

Hi Srinath,

Even without the CDC mechanism the sensor communication issue persists.

So i'm concluding that the issue is not related to CX3.

Thanks for the help.

Regards

Ajay

View solution in original post

0 Likes
6 Replies
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello Ajay,

- Do you see any errors in the CX3 firmware with respect to data committing to the CDC device?

- Does the failure occur after fixed number of iterations or is it random?

- Please collect the USB traces and share the same.

Best regards,

Srinath S

0 Likes
lock attach
Attachments are accessible only for community members.

Hi Srinath,

Please find replies to your queries below: 

    I don't see any error coming in the CX3 firmware part.

    The failure occurs randomly

    Please find the USB trace attached when the issue occurred.

I also have some doubts about my CDC endpoint configuration. Could you please check that and see if there are any potential issues.

   dmaCfgCdc.size = 1024;

    dmaCfgCdc.count = 3;

    dmaCfgCdc.prodSckId = CY_U3P_UIB_SOCKET_PROD_5;

    dmaCfgCdc.consSckId = CY_U3P_LPP_SOCKET_UART_CONS;

    dmaCfgCdc.dmaMode = CY_U3P_DMA_MODE_BYTE;

    dmaCfgCdc.notification = 0;

    dmaCfgCdc.cb = NULL;

    dmaCfgCdc.prodHeader = 0;

    dmaCfgCdc.prodFooter = 0;

    dmaCfgCdc.consHeader = 0;

    dmaCfgCdc.prodAvailCount = 0;

    status = CyU3PDmaChannelCreate (&glChHandleUsbtoUart,

             CY_U3P_DMA_TYPE_AUTO, &dmaCfgCdc);

    if (status != CY_U3P_SUCCESS)

    {

        CyCx3UvcAppErrorHandler(status);

    }

    /* Create a DMA_MANUAL channel between uart producer socket and usb consumer socket */

    /* Use a smaller buffer size (32 bytes) to ensure that packets get filled in a short time. */

    dmaCfgCdc.size         = 32;

    dmaCfgCdc.prodSckId    = CY_U3P_LPP_SOCKET_UART_PROD;

    dmaCfgCdc.consSckId    = CY_U3P_UIB_SOCKET_CONS_5;

    dmaCfgCdc.notification = CY_U3P_DMA_CB_PROD_EVENT;

    dmaCfgCdc.cb           = CyFxUSBUARTDmaCallback;

    status = CyU3PDmaChannelCreate (&glChHandleUarttoUsb,

             CY_U3P_DMA_TYPE_MANUAL, &dmaCfgCdc);

    if (status != CY_U3P_SUCCESS)

    {

    CyCx3UvcAppErrorHandler(status);

    }

    /* Set DMA Channel transfer size */

    status = CyU3PDmaChannelSetXfer (&glChHandleUsbtoUart,0);

    if (status != CY_U3P_SUCCESS)

    {

    CyCx3UvcAppErrorHandler(status);

    }

    status = CyU3PDmaChannelSetXfer (&glChHandleUarttoUsb, 0);

    if (status != CY_U3P_SUCCESS)

    {

    CyCx3UvcAppErrorHandler(status);

    }

Regards

Ajay

0 Likes

Hello Ajay,

- Please check the CX3 firmware to see if there is a PROD_EVENT callback occurring on the UART to USB DMA channel when you see the failure.

- How is the data being sent from the UART device to the CX3's UART?. Is it byte by byte or is it a stream of data?

- The DMA configurations are fine for the UART to USB channel.

Best regards,

Srinath S

0 Likes

Hi Srinath,

I had some trouble debugging CX3 as the JTAG controls gets lost when the code is allowed to run. I assume it might be due to the device going to low power mode.

From the results i see that

1. The PROD_EVENT event is being called frequently even when the failure occurs.

2. The data is being send out as a stream of data.

During debug is could find out that the DMA callback is invoked every time and the correct number of bytes are committed into buffer.

But when the USB is sniffed such a data is not seen.

Could this be an issue with the windows serial driver ?

Regards

Ajay

0 Likes

Hello Ajay,

- What is the action that the firmware performs when the PROD_EVENT is called? Is the data being committed from the DMA channel as part of the callback?

- What is the host application that you are using to read the data? Please test using TeraTerm.

- In case you are using the Microsoft CDC driver, test using the Cypress Serial driver and let me know if the issue still exists.

Best regards,

Srinath S

0 Likes

Hi Srinath,

Even without the CDC mechanism the sensor communication issue persists.

So i'm concluding that the issue is not related to CX3.

Thanks for the help.

Regards

Ajay

0 Likes