2. Enable the ATTACH interrupt (INT_ENB[ATTACH]=1).
3. Wait for ATTACH interrupt (INT_STAT[ATTACH]). Signaled by USB Target pull-
up resistor changing the state of DPLUS or DMINUS from 0 to 1 (SE0 to J or K
state).
4. Check the state of the JSTATE and SE0 bits in the control register. If the connecting
device is low speed (JSTATE bit is 0), set the low-speed bit in the address registers
(ADDR[LS_EN]=1) and the Host Without Hub bit in endpoint 0 register control
(ENDPT0[HOSTWOHUB]=1).
5. Enable RESET (CTL[RESET]=1) for 10 ms.
6. Enable SOF packet to keep the connected device from going to suspend
(CTL[USB_EN=1]).
7. Start enumeration by sending a sequence of device framework commands, device
frame work packets to the default control pipe of the connected device. See the
Universal Serial Bus Revision 2.0 specification, "Chapter 9 USB Device Framework"
(http://www.usb.org/developers/docs).
To complete a control transaction to a connected device:
1. Complete all the steps to discover a connected device
2. Set up the endpoint control register for bidirectional control transfers ENDPT0[4:0]
= 0x0d.
3. Place a copy of the device framework setup command in a memory buffer. See the
Universal Serial Bus Revision 2.0 specification, "Chapter 9 USB Device Framework"
(http://www.usb.org/developers/docs).
4. Initialize current even or odd TX EP0 BDT to transfer the 8 bytes of command data
for a device framework command (for example, a GET DEVICE DESCRIPTOR).
• Set the BDT command word to 0x00080080 –Byte count to 8, OWN bit to 1.
• Set the BDT buffer address field to the start address of the 8 byte command
buffer.
5. Set the USB device address of the target device in the address register (ADDR[6:0]).
After the USB bus reset, the device USB address is zero. It is set to some other value
usually 1 by the Set Address device framework command.
6. Write the token register with a SETUP to Endpoint 0 the target device default control
pipe (TOKEN=0xD0). This initiates a setup token on the bus followed by a data
packet. The device handshake is returned in the BDT PID field after the packets
Chapter 35 Universal Serial Bus OTG Controller (USBOTG)
KL25 Sub-Family Reference Manual, Rev. 3, September 2012
Freescale Semiconductor, Inc. 645