CyU3PConnectState(CyTrue,CyFalse) will cause invalid sequence in commitbuffer

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

cross mob
alca_3937256
Level 2
Level 2

i'm currently working on a uvc application and I want the device to only work on usb 2.0. It work perfectly fine in usb 2.0 mode but if i force the cx3 to only work in usb 2CyU3PConnectState(CyTrue,CyFalse) the function CyU3PDmaMultiChannelCommitBuffer in the dma callback return 0x47. Do you have any idea why ?

0 Likes
1 Solution

I have the denebola kit from e-con system. The examples provided in the SDK work perfectly fine. I don't know why it doesn't work with my program. I also enumerate the usb as a serial port and it have a dedicated thread to receive commands from the host. For now I am fine with the work around

View solution in original post

0 Likes
11 Replies
KandlaguntaR_36
Moderator
Moderator
Moderator
25 solutions authored 10 solutions authored 5 solutions authored

Hello,

First Case:

>> i'm currently working on a uvc application and I want the device to only work on usb 2.0. It work perfectly fine in usb 2.0 mode

How did you test this?

A. Have you used USB 2.0 cable and connected to USB 3.0 PC port?

OR

B. Have you used USB 3.0 cable and connected to USB 2.0 host?

Second Case:

>> but if i force the cx3 to only work in usb 2CyU3PConnectState(CyTrue,CyFalse) the function CyU3PDmaMultiChannelCommitBuffer in the dma callback return 0x47.

CyU3PConnectState(CyTrue,CyFalse) enables the USB 2.0 PHY and expected to establish USB 2.0 connection.

If the first case works fine, the second case should also work fine.

For your info., the 0x47 error occurs when the host is slow in requesting data. Hence, the DMA buffers would be full.

0 Likes

How did you test this?

Here what work and what won't work

usb 2.0 cable on usb 3.0 or usb 2.0 port with CyU3PConnectState(CyTrue,CyTrue) -> working at 60 fps

usb 3.0 cable on usb 3.0 or usb 2.0 with CyU3PConnectState(CyTrue,CyTrue) -> working at 60 fps

usb 2.0 cable on usb 3.0 or usb 2.0 with CyU3PConnectState(CyTrue,CyFalse) -> error 0x47

usb 3.0 cable on usb 3.0 or usb 2.0 with CyU3PConnectState(CyTrue,CyFalse) -> error 0x47

why the host would be suddenly slower if i use CyU3PConnectState(CyTrue,CyFalse) ?

EDIT:

with this it work

CyU3PConnectState(CyTrue,CyTrue)

delay...

CyU3PConnectState(CyFalse, CyFalse);

CyU3PConnectState(CyTrue, CyFalse);

0 Likes

Can you please share the .c file in which you have called CyU3PConnectState(CyTrue,CyTrue) and error 0x47 occurred?

0 Likes

the code is confidential, i can't share it. The error never occur with CyU3PConnectState(CyTrue,CyTrue). Only with CyU3PConnectState(CyTrue,CyFalse). But as i mentionned, if i call CyU3PConnectState(CyTrue,CyTrue) and then CyU3PConnectState(CyTrue,CyFalse) it work.

0 Likes

That is fine.

Please post the code snippet to see where you are calling connect state API in your project.

0 Likes

/* Full speed configuration descriptor */

    status = CyU3PUsbSetDesc(CY_U3P_USB_SET_FS_CONFIG_DESCR, 0, (uint8_t *)CyCx3USBFSConfigDscr);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "\n\rAppInit:Set_FS_CFG_Dscr Err = 0x%x", status);

        CyCx3UvcAppErrorHandler(status);

    }

    /* String descriptor 0 */

    status = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 0, (uint8_t *)CyCx3USBStringLangIDDscr);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "\n\rAppInit:Set_STRNG_Dscr0 Err = 0x%x", status);

        CyCx3UvcAppErrorHandler(status);

    }

    /* String descriptor 1 */

    status = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 1, (uint8_t *)CyCx3USBManufactureDscr);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "\n\rAppInit:Set_STRNG_Dscr1 Err = 0x%x", status);

        CyCx3UvcAppErrorHandler(status);

    }

    /* String descriptor 2 */

    status = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 2, (uint8_t *)CyCx3USBProductDscr);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "\n\rAppInit:Set_STRNG_Dscr2 Err = 0x%x", status);

        CyCx3UvcAppErrorHandler(status);

    }

    /* String descriptor 3 */

    status = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 3, (uint8_t *)CyCx3USBConfigSSDscr);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "\n\rAppInit:Set_STRNG_Dscr3 Err = 0x%x", status);

        CyCx3UvcAppErrorHandler(status);

    }

    /* String descriptor 4 */

    status = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 4, (uint8_t *)CyCx3USBConfigHSDscr);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "\n\rAppInit:Set_STRNG_Dscr4 Err = 0x%x", status);

        CyCx3UvcAppErrorHandler(status);

    }

    /* String descriptor 5 */

    status = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 5, (uint8_t *)CyCx3USBConfigFSDscr);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "\n\rAppInit:Set_STRNG_Dscr5 Err = 0x%x", status);

        CyCx3UvcAppErrorHandler(status);

    }

#ifndef FX3_STREAMING

    /* We enable device operation off VBat and use the VBatt signal for USB connection detection. This is the standard

     * setting for all CX3 designs, as the VBus and VBatt signals are connected to a single pad.

     */

    CyU3PUsbVBattEnable (CyTrue);

    CyU3PUsbControlVBusDetect (CyFalse, CyTrue);

#endif

    /* Connect the USB pins and enable super speed operation */

    status = CyU3PConnectState(CyTrue, CyFalse);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "\n\rAppInit:ConnectState Err = 0x%x", status);

        CyCx3UvcAppErrorHandler(status);

    }

    /* Since the status interrupt endpoint is not used in this application,

     * just enable the EP in the beginning. */

    /* Control status interrupt endpoint configuration */

    endPointConfig.enable   = 1;

    endPointConfig.epType   = CY_U3P_USB_EP_INTR;

    endPointConfig.pcktSize = CX3_EP_INTR_PACKET_SIZE;

    endPointConfig.isoPkts  = 1;

    endPointConfig.burstLen = CX3_EP_INTR_BURST_LEN;

    status = CyU3PSetEpConfig(CX3_EP_CONTROL_STATUS, &endPointConfig);

    if (status != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "\n\rAppInit:CyU3PSetEpConfig CtrlEp Err = 0x%x", status);

        CyCx3UvcAppErrorHandler(status);

    }

    CyU3PUsbFlushEp(CX3_EP_CONTROL_STATUS);

I follow the example from the ez usb suite

0 Likes

CyU3PDmaMultiChannelCommitBuffer in the dma callback return 0x47 when all the buffers are full - host is slow in requesting for BULK IN. Hence, the producer socket does not have available buffer to fill the incoming data.This can happen both USB 3.0 and USB 2.0 connection.

But in your case, this may happen that the USB 2.0 host is slow in transferring the data to PC but the DMA producer is filling the buffers so quickly.

Please let me know the return value of connectstate API when the second argument is CyFalse.

Please use the USB Bulk Loop Auto example firmware and see whether you are able to establish USB 2.0 connection with second argument as false. This is nothing to do with your application.

This will let us know whether the USB 2.0 connection proper when you use USB 3.0 cable and connect to USB 3.0 recepticle, with CyU3PConnectState(CyTrue, CyFalse);

Modify the Bulk Loop Auto as follows and collect the UART logs.

/* Connect the USB Pins with super speed operation enabled. */

    apiRetStatus = CyU3PConnectState(CyTrue, CyFalse);

   if (apiRetStatus == CY_U3P_SUCCESS)

    {

     CyU3PDebugPrint (4, "USB Connect success\n");

    }

    if (apiRetStatus != CY_U3P_SUCCESS)

    {

        CyU3PDebugPrint (4, "USB Connect failed, Error code = %d\n", apiRetStatus);

        CyFxAppErrorHandler(apiRetStatus);

    }

0 Likes

It work with the example, but as I said, it work on usb 2.0 so the host is not slow, it work on 10 different computer. But i have to first connect in usb 3.0, disconnect and then reconnect in usb 2.0.

if this work, then it should also work by only calling CyU3PConnectState(CyTrue, CyFalse);

CyU3PConnectState(CyTrue,CyTrue)

delay...

CyU3PConnectState(CyFalse, CyFalse);

CyU3PConnectState(CyTrue, CyFalse);

0 Likes

This is not supposed to happen.

If you are not fine with the above work around (placing delay in between two connectstate APIs), then we can debug further for the root cause.

For your information:

I have not come across this issue.

I have loaded USB Bulk Loop Example with the above modification to the Explorer kit (CYUSB3KIT-003) and connect to USB 3.0 host. It enumerates perfectly in USB 2.0.

What is hardware you are using for the test? Is it Cypress SuperSpeed Explorer kit or custom board.

Can you please load USB Bulk Source Sink Example firmware and collect the UART logs?

SDK Path: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxbulksrcsink

0 Likes

I have the denebola kit from e-con system. The examples provided in the SDK work perfectly fine. I don't know why it doesn't work with my program. I also enumerate the usb as a serial port and it have a dedicated thread to receive commands from the host. For now I am fine with the work around

0 Likes

Thank you for the confirmation.

0 Likes