AnsweredAssumed Answered

Under certain circumstances "Flushing/De-priming an Endpoint" never completes

Question asked by James Ledwith on Nov 1, 2013
Latest reply on Jan 9, 2014 by James Ledwith

I've run into a scenario where "Flushing/De-priming and Endpoint" as described in the iMX 25 reference manual (Section never completes because the ENDPTFLUSH register is never set to zero.


The scenario is very specific - I have an externally powered device (with an iMX-25) connected via USB to a host (Windows laptop). Then a user powers down the host. The USB cable and external power are still connected. The device detects the loss of connection and in software closes the USB interface/driver.


While closing the USB driver, the driver attempts to flush all endpoints. In this specific sequence of events the process described in never completes because the ENDPTFLUSH register never clears to all zeroes, it stays stuck at 0x00FF00FF. The reference manual does not describe what to do in the event that the ENDPTFLUSH register never clears, it just says "Wait until all bits are 0."


If a user unplugs the USB cable, causes a reset, or re-enumeration the endpoint flush works as described. We've only seen this error under these very specific conditions.


I have a few questions:


1 - Is it proper practice to flush all endpoints when closing a USB connection? Depending on the device configuration we could have 2 or 3 endpoints primed to read at any given time.

2 - What should be done in software in the event that the ENDPTFLUSH register never goes to zero?