Reasonable timeout in Mass storage class WaitForTransferComplete function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reasonable timeout in Mass storage class WaitForTransferComplete function

584 Views
ssudhir
Contributor II

Hi,

In Mass storage class – ehci.c file has a function called WaitForTransferComplete. This has a forever loop for bug catch and it gets invoked by HCDControlTransfer. So far it never got stuck there except today. We would like to add a reasonable timeout without compromising the normal operation. What would be the reasonable timeout?

Thanks

0 Kudos
6 Replies

475 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Dear S.S,

Could you let me know which MCU are you using?

Best Regards,

Alexis Andalon

0 Kudos

475 Views
ssudhir
Contributor II

LPC4357

0 Kudos

475 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Dear S S,

I was checking the example and this implementation was left blank.

This is depending of the implementation, in this example when using the commands to communicate with the device there's the next macro: MS_COMMAND_DATA_TIMEOUT_MS with the default value of 10000 ms.

Looking in other sources, the most common value is 5 seconds, so depending of your application you have a wide margin to implement this timeout.

Best Regards,

Alexis Andalon

0 Kudos

475 Views
ssudhir
Contributor II

Alexix,

In the same file ehci.c beginning of the file there is a comment

// === TODO: Unify USBRAM Section ===

Any idea?

0 Kudos

475 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Dear S S,

     1-.   Yes, you could try returning other status, only remember that the code will get stuck in the assert in the assert             instrucction. Maybe after the timeout you could try a software reset or module reinitialization.

      2.- It's important when a high speed stack is being used like USB or Ethernet that the storage is in a rapid access             memory. That's why this buffers are being stored in the second section of SRAM

pastedImage_1.png

Let me know if this helps you.

Best Regards,

Alexis Andalon

0 Kudos

475 Views
ssudhir
Contributor II

Alexis,

Thanks for the response. When it times out, should it return any specific

error code or anything other than HCD_STATUS_OK is fine. Can we

return HCD_STATUS_TRANSFER_QUEUED?

Thanks

0 Kudos