Problems with EP0 FX3 USB 2.0

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

cross mob
MaFa_974161
Level 5
Level 5
100 sign-ins 50 replies posted 50 questions asked

Hello.

I'm using FX3, USB 2.0 cable on USB 2.0 port, and I write a firmware that send 64 byte on EP0 using

CyU3PUsbSendEP0Data(64, buffer).

I notice that if I use "USB Control Center" and set "Bytes to Transfer" major than 64 I obtain TIMEOUT and no data ...

"CONTROL IN transfer failed with Error Code:997"

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

Hello,

Please refer to the attached screenshot.

I have tried to reproduce the same changes as you told and got the following results as attached in the screenshot.


Please ensure that the Direction : IN and Req Type : Vendor and Target ; Device and Req Code : 0x01.

I didn't get the 997 error when using IN and got it while using OUT, so my guess is you might be using the direction wrongly as this data comes from FX3 into PC and so the Direction should be IN.

Also, you could try to declare your buffer as what i have mentioned with a RED box in the screenshot.

Regards,

Yashwant

View solution in original post

0 Likes
7 Replies
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

Hello,


Can you please tell which frimware you are using to program FX3?

If it is not a SDK example frimware, please share the firmware as well.

Also, are the 64 Bytes sent, randomly generated data?

Error code:997 arises when the buffer are either Empty when you try to read them or Full when you try to write to them.


Regards,

Yashwant

0 Likes

I develop my firmware using

GpifToUsb from

EZ-USB FX3 SDK 1.3

and modify CyFxApplnUSBSetupCB

in this way

uint8_t glEp0Buffer[4096] __attribute__ ((aligned (32)));

/* Callback to handle the USB setup requests. */
CyBool_t
CyFxApplnUSBSetupCB (
        uint32_t setupdat0, /* SETUP Data 0 */
        uint32_t setupdat1  /* SETUP Data 1 */
    )
{
    /* Fast enumeration is used. Only requests addressed to the interface, class,
     * vendor and unknown control requests are received by this function.
     * This application does not support any class or vendor requests. */

    uint8_t  bRequest, bReqType;
    uint8_t  bType, bTarget;
    uint16_t wValue, wIndex, wLength;
    CyBool_t isHandled = CyFalse;

  

     /* Decode the fields from the setup request. */
    bReqType = (setupdat0 & CY_U3P_USB_REQUEST_TYPE_MASK);
    bType    = (bReqType & CY_U3P_USB_TYPE_MASK);
    bTarget  = (bReqType & CY_U3P_USB_TARGET_MASK);
    bRequest = ((setupdat0 & CY_U3P_USB_REQUEST_MASK) >> CY_U3P_USB_REQUEST_POS);
    wValue   = ((setupdat0 & CY_U3P_USB_VALUE_MASK)   >> CY_U3P_USB_VALUE_POS);
    wIndex   = ((setupdat1 & CY_U3P_USB_INDEX_MASK)   >> CY_U3P_USB_INDEX_POS);
    wLength  = ((setupdat1 & CY_U3P_USB_LENGTH_MASK)  >> CY_U3P_USB_LENGTH_POS);

  

   if(bType == CY_U3P_USB_VENDOR_RQT)
   {

      if(bRequest == 0x01)

      {

         uint8_t myBuf[64] = { /* some data */ };

         CyU3PUsbSend(64, myBuf);

      }

   }

}

0 Likes

Hi,

There is no API which corresponds to CyU3PUsbSend() in FX3 SDK source code and so, there's no data transfer in such a case.


You will have to use CyU3PUsbSendEP0Data() in place of the above API inorder to send data over EP0 to the host.

Please do try the above mentioned API and get back with the results.


Regards,

Yashwant

0 Likes

I'm using CyU3PUsbSendEP0Data api

but I write CyU3PUsbSendData instead of CyU3PUsbSendEP0Data in forum message.

I have problem

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

Hello,

Please refer to the attached screenshot.

I have tried to reproduce the same changes as you told and got the following results as attached in the screenshot.


Please ensure that the Direction : IN and Req Type : Vendor and Target ; Device and Req Code : 0x01.

I didn't get the 997 error when using IN and got it while using OUT, so my guess is you might be using the direction wrongly as this data comes from FX3 into PC and so the Direction should be IN.

Also, you could try to declare your buffer as what i have mentioned with a RED box in the screenshot.

Regards,

Yashwant

0 Likes

I don't understand why on my PC this still not work.

I'm using EZ-USB FX3 SDK 1.3 ... you are you using newer version ?

0 Likes

Hi,


Yes, i am using FX3 SDK 1.3.4

And everything is working as expected.

Can you please check once and update the results on SDK 1.3.4?


Regards,

Yashwant

0 Likes