Reasonable timeout in Mass storage class WaitForTransferComplete function

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Reasonable timeout in Mass storage class WaitForTransferComplete function

1,487 次查看
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 项奖励
回复
6 回复数

1,378 次查看
Alexis_A
NXP TechSupport
NXP TechSupport

Dear S.S,

Could you let me know which MCU are you using?

Best Regards,

Alexis Andalon

0 项奖励
回复

1,378 次查看
ssudhir
Contributor II

LPC4357

0 项奖励
回复

1,378 次查看
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 项奖励
回复

1,378 次查看
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 项奖励
回复

1,378 次查看
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 项奖励
回复

1,378 次查看
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 项奖励
回复