What triggers CY_U3P_USB_EVENT_EP_UNDERRUN on EP 0x80?

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

cross mob
Anonymous
Not applicable

Hello,

   

Context:

   

We have a transient problem while receiving data from FX3 via a BULK IN endpoint and simultaneously issuing vendor requests towards the FX3 device.  I use the FX3 SDK version 1.3.1.

   

Problem:

   

At random, a USB event CY_U3P_USB_EVENT_EP_UNDERRUN on endpoint 0x80 is reported and starting from this point in time, all data responses from FX3 to vendor requests via CyU3PSendEP0Data are received on the host as garbage (completely corrupted data).

   

Following facts are holding in the error condition:

   

.) Endpoint 0x80 and 0x00 are not stalled or not nak as i checked with UsbGetEpCfg on endpoint 0x80.

   

.) The data streamed via BULK IN endpoint is still working although. 

   

.) Vendor Requests are received and CyU3PUSBSetupCb_t is called correctly (Only the SendEp0Data response gets corrupted).

   

.) My processing in the CyU3PUSBSetupCb_t only does EventSet and GpioGetValue so it returns very quickly.

   

.) I am calling only one of these functions in CyU3PUSBSetupCb_t: UsbAckSetup, UsbStall, SendEP0Data, GetEP0Data.

   

.) I return the value CyTrue from CyU3PUSBSetupCb_t at least in case of SendEP0Data or GetEP0Data.

   

Question:

   

Under what conditions does the USB event CY_U3P_USB_EVENT_EP_UNDERRUN occur and how can i recover from this situation or avoid it ?

   

kind regards,

   

Julian

0 Likes
6 Replies
Anonymous
Not applicable

Hi,

   

In the callback, please stall the endpoint 0x80. Now when the host sends a clear feature, it will be internally handled by the library which will remove the stall and reset the endpoint. Now you will be able to use 0x80

   

Regards,

   

-Madhu Sudhan

0 Likes
Anonymous
Not applicable

Hi Madhu,

   

Thank you for your reply.

   

I tried to call CyU3PUsbStall(0x80, CyTrue, CyFalse) from the callback as soon as the EP_UNDERRUN event is detected but this did not make the EP0 (Device-to-Host) usable again. The SendEP0 function always returns with a success code.

   

Please provide me with more information on what is causing the EP_UNDERRUN event error to be able to debug this problem.

   

kind regards,

   

julian

0 Likes
Anonymous
Not applicable

Hi Madhu,

   

Do you already have an update to my question about the circumstances causing the EP_UNDERRUN ?

   

Your help is very much appreciated,

   

Best,

   

Julian

0 Likes
Anonymous
Not applicable

Julian,

   

Can you try using the following API and check for the issue:

   

>> CyU3PUsbResetEndpointMemories()

   

Can be used when you get the clear feature request from the host.

   

-Ramesh

0 Likes
Anonymous
Not applicable

Thank you for your help. 

   

Using this API call in the USB event Callback upon receiving EP_UNDERRUN does not corrupt data anymore.

   

Meanwhile i tried to use the new 1.3.3 SDK Version which also fixed the problem but lead to following problem:

   

If the fx3 bootloader after powerup enumerates with the host using Product ID 0x00F3, then everything works fine.

   

In the case, the fx3 bootloader enumerates with 0x00BC, the device complete crashes after downloading the user application.

   

I know the different product ids are due to PMODE pins, but i when i only want USB download, the F11 is the correct connection as stated in the datasheet. In other words PMODE2 must be floating. 

   

Can you comment on this issue ?

0 Likes
FuBe_4381791
Level 4
Level 4
10 questions asked 50 sign-ins 25 replies posted

I'm bumping this old thread cause I'm getting EP underrun error on 0x80 too (1.3.4 SDK) and as far as I can see, nothing is actually using EP 0x80 so I think it's an internal SDK/lower level driver issue..... Stalling the endpoint makes it work but I want to prevent it from happening in the first place....

Why does this happen?

Regards!

0 Likes