Universal Serial Bus (USB) Interface
Device Management with Endpoint 0
USB08 Evaluation Board
Designer Reference Manual
MOTOROLA
Universal Serial Bus (USB) Interface
71
The type of standard request is coded in the field bRequest. For
continuation of the enumeration, the host should send the standard
device request SET_ADDRESS and the handleSETUP() routine should
branch to the function setAddress().
The function first validates the contents of the fields of SetupBuffer. In
the case of an error, a STALL handshake is initiated to give the host
problem feedback.
Before the device address in the field wValue is finally accepted, the
MCU has to prepare the transmission of a receive acknowledgment.
This acknowledgement still is completed using the old device address
zero. An additional safety feature is the mandatory control transfer status
stage.
The handshake takes place via a telegram with a data length of zero,
which is requested by the host by means of an IN transaction. For this
purpose, the length TP0SIZx is defined as zero and the TX0E bit is set
in the USB control register 0 (UCR0). This enables the transmitter of the
endpoint 0.
This handshake transaction always uses a DATA1 packet; therefore,
T0SEQ is set.
The routine setAddress() now returns to handleSETUP() where the
receive interrupt for EP0 is re-enabled. Finally, the MCU terminates the
interrupt service routine isrUSB().
The device address is still located in the SetupBuffer. The service
routine isrUSB() is again activated by a transmit interrupt for EP0. After
decoding, if it was determined that the cause of the interrupt was an IN
Bit 7
6
5
4
3
2
1
Bit 0
Read:
T0SEQ
0
Tx0E
Rx0E
TP0SIZ3
TP0SIZ2
TP0SIZ1
TP0SIZ0
Write:
Reset:
0
0
0
0
0
0
0
0
= Unimplemented
Figure 4-7. USB Control Register 0 (UCR0)