
AN1886 - APPLICATION NOTE
12/54
3.
Get Configuration.
The host sends a get configuration. The device replies with its configuration
descriptor, interface descriptor and endpoint descriptor. The configuration descriptor describes the
number of interfaces provided by the configuration, the power source (Bus or Self powered) and the
maximum power consumption of the USB device from the bus. The Interface descriptor describes the
number of endpoints used by this interface. The Endpoint descriptor describes the transfer type
supported, and the bandwidth requirements. Depending on the function implemented, other class-
specific descriptors may be returned by the device.
Set Configuration.
The host assigns a configuration value to the device, based on the configuration
information. The device is then in the Configured state, and can draw the amount of power described
in the configuration descriptor. The device is now configured and ready to be used.
4.
Endpoint0
Endpoint0 is used, in this example, for all enumeration traffic: sending data to, and receiving data from,
the μPSD unit, sending commands to the μPSD.
The main USB interrupt service routine services the main and most important tasks connected with
Endpoint0. This routine is shown in
APPENDIX A.
.
Endpoint1 (LCD display mirror)
Periodically and automatically sent data packets from Endpoint1 implement the LCD mirror. Each data
packet consists of eight bytes, and has the format shown in
Table 9.
.
Table 9. Endpoint Packet Byte Function Assignment
Carriage Return (CR, 0x0D) and Line Feed (LF, 0x0A) characters are inserted at the end of every display
line, and a terminating null character (NUL, 0x00) is inserted at the end. For example, if the display has
the following content:
USB DEMO V2.0_FP
199 04 04M 12566
It will be transmitted as:
Packet: 0x00,‘U‘,‘S‘,‘B‘,‘ ‘,‘D‘,‘E‘,‘M‘
Packet: 0x07,‘O‘,‘ ‘,‘V‘,‘2‘,‘.‘,‘0‘,‘_‘
Packet: 0x0E,‘F‘,‘P‘,0x0D,0x0A,‘1‘,‘9‘,‘9‘
Packet: 0x15,‘ ‘,‘0‘,‘4‘,‘ ‘,‘0‘,‘4‘,‘M‘
Packet: 0x1C,‘ ‘,‘1‘,‘2‘,‘5‘,‘6‘,‘6‘,0x00
The code that is responsible for doing this can be found in
main.c
. This routine is shown in
APPENDIX B.
.
USB Setup Packet Handling – Standard Device Requests
Most of the enumeration steps, mentioned earlier in this document, are processed in the
uPSD_USB.c/
OnSetupPacket
routine. It is responsible for servicing the standard device requests that have been re-
ceived from the host. The routine is shown in
APPENDIX C.
.
Byte
0
1
2
3
4
5
6
7
Description
Start
Position
Character
@
POS+0
Character
@
POS+1
Character
@
POS+2
Character
@
POS+3
Character
@
POS+4
Character
@
POS+5
Character
@
POS+6