PKTEND is usually used when the external master wishes to send a ‘short’ packet (for example, a packet smaller than the size specified in the EPxAUTOINLENH:L registers).
Assume that EP4AUTOINLENH:L is set to 512 bytes and AUTOIN = 1 (EP4FIFOCFG bit3), the external master can stream data to Endpoint 4 continuously, and EZ-USB automatically commits a packet to USB whenever Endpoint 4 fills with 512 bytes.
If the external master wants to send a stream of data whose length is not a multiple of 512, the last packet is not be automatically committed to USB because it is smaller than 512 bytes. To commit that last packet, the external master can do one of two things:
- The external master can pad the packet with dummy data in order to make it exactly 512 bytes long,
- The external master can write the short packet to Endpoint buffer, then pulse the PKTEND pin.
By default, PKTEND pin is active-low; its polarity can be changed via the FIFOPINPOLAR register.
If the Endpoint FIFO is configured to allow zero-length packets (EPxFIFOCFG.2 = 1), pulsing the PKTEND pin when a FIFO buffer is available commits a zero-length packet.
In synchronous mode, there is no specific timing requirement for PKTEND assertion with respect to SLWR assertion. PKTEND can be asserted anytime.
In asynchronous mode, SLWR and PKTEND should not be pulsed at the same time. PKTEND should be asserted after SLWR has been deasserted for the minimum deasserted pulse width.