You are here

USB3 Control Endpoint OUT transfer errors | Cypress Semiconductor

USB3 Control Endpoint OUT transfer errors

Summary: 1 Reply, Latest post by aasi on 19 Apr 2012 05:10 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
tenbord's picture
1 post

since response transfer is additionally needed from the existing firmware example
when Control OUT (CY_FX_RQT_I2C_EEPROM_WRITE) transfer using write() function of "CCyControlEndpoint"
among CyAPI library interface classes at PC application software occurs,
following code as shown below have been added.

               glEp0Buffer[0] = status;
            status = CyU3PUsbSendEP0Data(1, glEp0Buffer);

However, timeout error (65) occured in CyU3PUsbSendEP0Data.
I would like to know if there is some way to get this problem solved.


/* Callback to handle the USB setup requests. */
CyFxUSBSetupCB (
        uint32_t setupdat0,
        uint32_t setupdat1
    uint8_t attr, rqt, i2cAddr = 0;
    uint16_t value, index, length;
    CyBool_t isHandled = CyTrue;
    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

    /* Parse the control request parameters. */
    attr    =  (uint8_t) (setupdat0 & 0x000000FF);
    rqt     =  (uint8_t)((setupdat0 & 0x0000FF00) >> 8);
    value   = (uint16_t) (setupdat0 >> 16);
    index   = (uint16_t) (setupdat1 & 0x0000FFFF);
    length  = (uint16_t) (setupdat1 >> 16);

   /* Fast enumeration is used. Only vendor is handled here. */
    if ((attr & CY_U3P_USB_TYPE_MASK) != CY_U3P_USB_VENDOR_RQT)
        return CyFalse;

    switch (rqt)

            i2cAddr = 0xA0 | ((value & 0x0007) << 1);
            status  = CyU3PUsbGetEP0Data(length, glEp0Buffer, NULL);
            if (status == CY_U3P_SUCCESS)
                CyFxFlashProgI2cTransfer (index, i2cAddr, length,
                        glEp0Buffer, CyFalse);

            glEp0Buffer[0] = status;
            status = CyU3PUsbSendEP0Data(1, glEp0Buffer);

            /* This is unknown request. */
            isHandled = CyFalse;

    /* If there was any error, return not handled so that the library will
     * stall the request. Alternatively EP0 can be stalled here and return
     * CyTrue. */
    if (status != CY_U3P_SUCCESS)
        isHandled = CyFalse;

    return isHandled;

aasi's picture
Cypress Employee
1166 posts

Write() of CCyControlEndpoint is for OUT transfer and CyU3PUsbSendEP0Data() is used to respond to IN packet. Looks you're confusing the direction of transfers.



Log in to post new comments.