1 usb packets, 1 handshakes, 2 short packets – Freescale Semiconductor MCF5480 User Manual
Page 925: 2 sending packets, 3 receiving packets, Usb packets -51, Sending packets -51, Receiving packets -51
Software Interface
MCF548x Reference Manual, Rev. 3
Freescale Semiconductor
29-51
29.4.3.1
USB Packets
Data moves across the USB in units called packets. Packets range in size from 0 to 1024 bytes, and
depending on the transfer mode, the packet size is restricted to a small set of values. Control packet sizes
are limited to 8, 16, 32, or 64 bytes. Bulk packet sizes are limited to 8, 16, 32, 64, or 512 bytes. Isochronous
and interrupt data packets can take any size from 0 to 1024 bytes. The packet size is programmable within
the USB module on an endpoint by endpoint basis.
The terms packet and frame are used interchangeably within this document. While USB traffic occurs in
units called packets, the FIFO mechanism uses the term frames for the same blocks of data. The only
difference between frames and packets from the user’s standpoint is that packets may be as little as 0 bytes
in length, while a frame must be at least 1 byte in length.
29.4.3.1.1
Handshakes
The USB device will return a NYET handshake packet to an OUT transaction if there is already data
present in the FIFO and there are less than 2*MAXPACKETSIZE bytes free in the FIFO.
In cases where the FIFO depth is larger than 2*MAXPACKETSIZE (i.e. 3x or 4x), the following behavior
will occur. If after a transfer that returned a NYET handshake there is at least 1*MAXPACKETSIZE of
free space in the FIFO, the device will ACK the first PING request from the host and accept another
MAXPACKETSIZE transfer from the host. The device will again send a NYET handshake.
The only time the device will NAK a PING is when there is less than 1*MAXPACKETSIZE of free space
in the FIFO.
29.4.3.1.2
Short Packets
Each endpoint has a maximum packet size associated with it. In most cases, packets transferred across an
endpoint will be sent at the maximum size. Since the USB does not indicate a data transfer size, or include
an end of transfer token, short packets are used to mark the end of data. Software indicates end of data by
writing short packets into the FIFO. Incoming short packets are indicated by examining the length of a
received packet or by looking at the
end of transfer and end of frame interrupts.
29.4.3.2
Sending Packets
To send a packet of data to the USB host using programmed I/O, use the following steps:
1. For an n byte packet, write the first n-1 bytes to the FIFO data register (EPnFDR). Data may be
written as bytes, words, or longwords.
2. For the n
th
byte, set the WFR bit in the EPnFCR, then write the last data byte to the EPnFDR.
Note that data is written in big-endian format.
The multichannel DMA can also be used to send packets. Please refer to the DMA API documentation for
more information.
29.4.3.3
Receiving Packets
To receive a packet of data from the USB host, either DMA or programmed I/O may be used.
Refer to the DMA API documentation for DMA access information.
For programmed I/O, follow these steps:
1. Monitor EOF interrupt for the endpoint.