Endpoint-Timeouts

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

cross mob
Anonymous
Not applicable

I have a problem with the Endpoint-Timeouts. To send commands to the FX3 I have added two Bulk-Endpoints (0x02 and 0x82 / MANUAL_IN and MANUAL_OUT).

   

The main loop on the FX3 is very similar to the one in “cyfxbulklpmaninout”.     

 

   

I am waiting for a command, “doing something”, and sending an answer.     

 

   

“Doing something” will last some time. To show the problem I have extended this time to 10 seconds.     

 

   

I have also modified the “USB Control Center” (.NET) and set the timeout for the endpoint from 2 seconds to 20 seconds.     

 

   

Now I am sending a command (8 Bytes) with the “USB Control Center” to the FX3 and trying to read the answer (128 Bytes). The following happens.     

 

   

FX3 in USB 2.0 Mode:

   
        
  •       

     

    I am sending the command (EP 0x02)
  •     
  •       

     

    I am reading the answer (EP 0x82)      

     

  •     
  • 10 Seconds after sending the command I am receiving the answer.      

     

  •    
   

FX3 in USB 3.0 Mode:     

 

   
        
  • I am sending the command (EP 0x02)      

     

  •     
  • I am reading the answer (EP 0x82)      

     

  •     
  • 20 Seconds after trying to read the answer I am getting an Error (997)      

     

  •     
  • I am reading the answer again and getting it immediately 
  •    
   

The USB 2.0 behavior is what I am expecting. I am starting the transfer with XferData and receiving an answer when it is sent by the FX3. If no answer is sent, I will get the Timeout-Error after 20 seconds.     

 

   

The USB 3.0 behavior looks to me like XferData is always waiting until timeout occurs, when the data is not already available. Is this the way it should work?     

 

   

To solve this, I did change the endpoint timeout to 10ms in my application and retrying the transfer in case of a timeout. However with this I have got some lost answers (seen with USB 2.0). Looks to me like an answer may get lost, when it comes almost at the same time when the timeout occurs     

 

   

Any hints how I can handle this?     

 

   

        

 

0 Likes
4 Replies
RoKl_290166
Level 4
Level 4
Welcome!
        hi, did you analyze the USB-transfer with a protocol analyzer? You should do this to find out why it behaves like that because there can be several root-causes. First things which come into my mind are: 1.) the FX3 doesn't come back to state U0 after it was set to U1 by host. Hence, FX3 can't send out the data. Cypress provided a workaround to force the FX3 back to U0. 2.) What's the number of bytes you want to transmit in the answer and how large is the RX-buffer you committed to the USB-driver to receive the data at host-software? Usually, a transfer won't be completed if you want to transmit a number of data-bytes which is equal to the endpoint-size but the RX-buffer at host-software is larger than this. To complete the transfer you have to send a ZLP after sending the data or you use RX-buffer sizes which are equal the endpoint-size. Regards, Robert   
0 Likes
Anonymous
Not applicable
        Hello RobK, thank you very much for your help. Looks like the U0 issue is the problem. So far I did not really care about the USB 3.0 power states. Now I have changed the return value for the “CyFxApplnLPMRqtCB“ callback from CyTrue to CyFalse, which should avoid leaving the U0 state. Now USB 3.0 seems to work like USB 2.0. Do you see any problems when I am always returning CyFalse? The larger power consumption is not really a problem (no battery device). So far I am owning no USB analyzer. Can you recommend an analyzer?   
0 Likes
Anonymous
Not applicable
        Try Cat-C analyzer or Lecroy   
0 Likes
RoKl_290166
Level 4
Level 4
Welcome!

Hi,

   

if you always reject LGO_U1 you will fail in one of the USB-compliance test which tests if the devcie enters U1.

   

If you don't care about USB-compliance you can do it like that.

   

I tried 2 different USB-analyzers: LeCroy and Ellisys. But for me Ellisys seems to be the more comfortable one.

   

It's more stable, easier to handle and the trace-layout is much more clear and better to understand than LeCroy.

   

At the end it depends on the taste of the user.

   

 

   

Regards,

   

Robert

0 Likes