![](http://datasheet.mmic.net.cn/Freescale-Semiconductor/MCF5272VF66J_datasheet_98909/MCF5272VF66J_291.png)
Universal Serial Bus (USB)
MCF5272 ColdFire Integrated Microprocessor User’s Manual, Rev. 3
Freescale Semiconductor
12-33
12.4.4.1
Control, Bulk, and Interrupt Endpoints
The data flow for control, bulk, and interrupt endpoints can be handled the same way for all 3 types of
endpoints. Control, bulk, and interrupt endpoints all support guaranteed data delivery. If the host detects
an error during the read of a packet from an IN endpoint, it requests that the packet be resent from the
device. The USB FIFO mechanism takes care of this without interrupting the CPU. In a similar fashion,
the USB FIFO mechanism keeps a received packet from being read by the user until the control logic
validates the packet for transmission errors.
12.4.4.1.1
IN Endpoints
The following example demonstrates how to transmit a transfer on an IN endpoint:
1. Wait until the last transfer is complete (an EOT interrupt has occurred).
2. Write data to the FIFO to fill it.
3. Wait for EOP interrupt or poll EOP bit.
4. Read EPnDP to determine the number of bytes that can be written to the FIFO. Normally, only one
packet should be written unless the software does not service the EOP immediately.
5. Write data to the FIFO to fill it or until all of the data for the transfer has been written.
6. Repeat steps 5–7 until all of the data for the transfer has been written to the FIFO.
7. Clear EPnCTL[IN_DONE].
8. Wait for the EOT interrupt or poll the EOT bit. The user can now begin processing the next transfer.
12.4.4.1.2
OUT Endpoints
The following example demonstrates how to handle a received transfer on an OUT endpoint:
1. Wait for the EOP interrupt or poll the EOP bit.
2. Read EPnDP to determine number of bytes in the FIFO.
3. Read the indicated number of bytes of data from the FIFO into a buffer.
4. Repeat steps 1–3 until EOT is set.
5. When EOT is set, the transfer is complete. While EOT is set, the FIFO is locked and any packets
sent for the next transfer cause a NAK response.
6. Read EPnDP to determine the number of bytes in the FIFO if any for the last transfer. The EOT bit
can be cleared once this register has been read.
7. Read the indicated number of bytes of data from the FIFO into a buffer.
8. The user can now process the received transfer.
12.4.4.2
Isochronous Endpoints
The data flow for isochronous endpoints must be handled differently than the data flow for
non-isochronous endpoints. Data on isochronous endpoints is generally streaming data. Therefore, there
is no concept of transfers and EOT. In addition, isochronous endpoints differ from other endpoint types in
two distinct ways. Isochronous endpoints support packet sizes up to 1023 bytes and isochronous packets
are never resent. In order to support the large packet sizes, the FIFO size can be less than two times the