11. Initialize the current even or odd TX EP0 BDT to transfer the status data.
• Set the BDT command word to 0x00000080 – BC to 0 (the byte count of the
data buffer in this case), OWN bit to 1, Data toggle to Data1.
• Set the BDT buffer address field to the start address of the data buffer
12. Write the TOKEN register with a IN or OUT token to Endpoint 0, the target device
default control pipe, an OUT token for a GET DEVICE DESCRIPTOR command
(TOKEN=0x10). This initiates an OUT token on the bus followed by a zero length
data packet from the host to the device. When the data packet completes, the BDT is
written with the handshake from the device and a Token Done (ISTAT[TOKDNE])
interrupt is asserted. This completes the data phase of the setup transaction. See the
Universal Serial Bus Revision 2.0 specification,
"Chapter 9 USB Device Framework"
(http://www.usb.org/developers/docs).
To send a full speed bulk data transfer to a target device:
1. Complete all steps to discover a connected device and to configure a connected
device. Write the ADDR register with the address of the target device. Typically,
there is only one other device on the USB bus in host mode so it is expected that the
address is 0x01 and should remain constant.
2. Write 0x1D to ENDPT0 register to enable transmit and receive transfers with
handshaking enabled.
3. Setup the even TX EP0 BDT to transfer up to 64 bytes.
4. Set the USB device address of the target device in the address register (ADDR[6:0]).
5. Write the TOKEN register with an OUT token to the desired endpoint. The write to
this register triggers the USB-FS transmit state machines to begin transmitting the
token and the data.
6. Setup the odd TX EP0 BDT to transfer up to 64 bytes.
7. Write the TOKEN register with an OUT token as in step 4. Two tokens can be
queued at a time to allow the packets to be double buffered to achieve maximum
throughput.
8. Wait for the TOKDNE interrupt. This indicates that one of the BDTs has been
released back to the processor and the transfer has completed. If the target device
asserts NAKs, the USB-FS continues to retry the transfer indefinitely without
processor intervention unless the ENDPT0[RETRYDIS] is 1. If the retry disable field
is set, the handshake (ACK, NAK, STALL, or ERROR (0xf)) is returned in the BDT
Host Mode Operation Examples
K22F Sub-Family Reference Manual , Rev. 3, 7/2014
1030
Freescale Semiconductor, Inc.