Flushing the Committed Endpoints of FX2LP - KBA222444
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Version: **
Translation - Japanese: FX2LPのコミットされたエンドポイントのフラッシュ - KBA222444 - Community Translated (JA)
Question:
How can I clear or flush data from the committed endpoints when FX2LP is operating in AUTO mode, and if the host application fails to read the same within a specified time?
Answer:
There can be situations where FX2LP is operating in AUTO mode and data is streamed into the FX2LP device from an external interface and is automatically committed to the host, but the host application is not ready to read the data. Since FX2LP is operating in AUTO mode, the firmware has no control over the endpoint FIFOs. If the host has not read the committed data from the FX2LP device for a specified time and the data needs to be discarded; FX2LP must be switched to manual mode to have control over the endpoint FIFOs. Follow the below sequence to clear the same:
- Set the NAKALL bit
- Switch to manual mode
- Reset the FIFOs
- Switch to auto mode
- Release the NAKALL bit
Example Code Snippet:
TD_Poll ( ) :
… … …
if (FIFO_RESET)
{
//This is an example code segment which resets the EP6 FIFO
//where EP6 has been configured as AUTOIN
//Note: Settings of other bits of EPxFIFOCFG are ignored here
FIFORESET = 0x80; // activate NAK-ALL to avoid race conditions
SYNCDELAY;
EP6FIFOCFG = 0x00; //switching to manual mode
SYNCDELAY;
FIFORESET = 0x06; // Reset FIFO 6 It has to be noted that the NAKALL bit should be set to 0 at this stage. Setting it to 1 will not
SYNCDELAY; // result in the desired operation
EP6FIFOCFG = 0x0C; //switching to auto mode
SYNCDELAY;
FIFORESET = 0x00; // Release NAKALL.
SYNCDELAY;
}