Question: My FX2 firmware cannot detect zero-length packets. How can I detect when a ZLP is received in the USB buffers?
The FX2 suppresses zero-length packet signalling in the FIFO buffer status flags, depending on FIFO modes, to eliminate unneccessary overhead in data packet streams. However, if zero-length packets need to be detected for higher level signalling, then polling on the EP2468STAT SPR register FIFO status flags will indicate packets even if zero length. The endpoint interrupts can also be used. This should be used with great care since it adds 8051 overhead processing to all packets.