cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

rokw_4712521
New Contributor

Hello,

I have constructed data receiving module quote from the USBHost example, which is shown below.

In my test, first few minutes, it worked okay but it ends up with "CY_U3P_ERROR_INVALID_SEQUENCE" error which caused by CyU3PUsbHostEpSetXfer function.

FX3 API Guide says the error means "The endpoint is already active" but this is not enough for me.

Can you please explain in more detail in what case, does this error breakout?

CyU3PReturnStatus_t

CyFxMscRecvBuffer (

        uint8_t *buffer,

        uint16_t count)

{

    CyU3PDmaBuffer_t buf_p;

    CyU3PUsbHostEpStatus_t epStatus;

    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

    /* Setup the DMA for transfer. */

    buf_p.buffer = buffer;

    buf_p.count  = 0;

    buf_p.size   = ((count + 0x0F) & ~0x0F);

    buf_p.status = 0;

    status = CyU3PDmaChannelSetupRecvBuffer (&glMscInCh, &buf_p);

    if (status == CY_U3P_SUCCESS)

    {

        status = CyU3PUsbHostEpSetXfer (glMscInEp,

                CY_U3P_USB_HOST_EPXFER_NORMAL, count);

    }

    if (status == CY_U3P_SUCCESS)

    {

        status = CyU3PUsbHostEpWaitForCompletion (glMscInEp, &epStatus,

                CY_FX_MSC_WAIT_TIMEOUT);

    }

    if (status == CY_U3P_SUCCESS)

    {

        status = CyU3PDmaChannelWaitForCompletion (&glMscInCh, CYU3P_NO_WAIT);

    }

    if (status != CY_U3P_SUCCESS)

    {

        CyFxMscErrorRecovery ();

    }

    return status;

}

0 Likes
9 Replies