Architecture
1617
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Universal Serial Bus 2.0 (USB) Controller
34.2.7.1.1.3 Read Requests
Read requests have a packet (or packets) of data sent from the function to the host after the 8-byte
command. Examples of Read Standard Device Requests are:
•
GET_CONFIGURATION
•
GET_INTERFACE
•
GET_DESCRIPTOR
•
GET_STATUS
•
SYNCH_FRAME
The sequence of events will begin, as with all requests, when the software receives an endpoint 0
interrupt. The RXPKTRDY bit of PERI_CSR0 (bit 0) will also have been set. The 8-byte command should
then be read from the endpoint 0 FIFO and decoded. The PERI_CSR0 register should then be written to
set the SERV_RXPKTRDY bit (bit 6) (indicating that the command has read from the FIFO).
The data to be sent to the host should then be written to the endpoint 0 FIFO. If the data to be sent is
greater than the maximum packet size for endpoint 0, only the maximum packet size should be written to
the FIFO. The PERI_CSR0 register should then be written to set the TXPKTRDY bit (bit 1) (indicating that
there is a packet in the FIFO to be sent). When the packet has been sent to the host, another endpoint 0
interrupt will be generated and the next data packet can be written to the FIFO.
When the last data packet has been written to the FIFO, the PERI_CSR0 register should be written to set
the TXPKTRDY bit and to set the DATAEND bit (bit 3) (indicating that there is no more data after this
packet).
When the host moves to the status stage of the request, another endpoint 0 interrupt will be generated to
indicate that the request has completed. No further action is required from the software: the interrupt is
just a confirmation that the request completed successfully.
If the command is an unrecognized command, or for some other reason cannot be executed, then when it
has been decoded, the PERI_CSR0 register should be written to set the SERV_RXPKTRDY bit (bit 6) and
to set the SENDSTALL bit (bit 5). When the host requests data, the controller will send a STALL to tell the
host that the request was not executed. An endpoint 0 interrupt will be generated and the SENTSTALL bit
of PERI_CSR0 (bit 2) will be set.
If the host requests more data after DATAEND (bit 3) has been set, then the controller will send a STALL.
An endpoint 0 interrupt will be generated and the SENTSTALL bit of PERI_CSR0 (bit 2) will be set.
34.2.7.1.1.4 Endpoint 0 States
When the USB controller is operating as a peripheral device, the endpoint 0 control needs three modes –
IDLE, TX and RX – corresponding to the different phases of the control transfer and the states endpoint 0
enters for the different phases of the transfer (described in later sections).
The default mode on power-up or reset should be IDLE. RXPKTRDY bit of PERI_CSR0 (bit 0) becoming
set when endpoint 0 is in IDLE state indicates a new device request. Once the device request is unloaded
from the FIFO, the controller decodes the descriptor to find whether there is a data phase and, if so, the
direction of the data phase of the control transfer (in order to set the FIFO direction). See
.
Depending on the direction of the data phase, endpoint 0 goes into either TX state or RX state. If there is
no Data phase, endpoint 0 remains in IDLE state to accept the next device request.
The actions that the CPU needs to take at the different phases of the possible transfers (for example,
loading the FIFO, setting TXPKTRDY) are indicated in
.
NOTE:
The controller changes the FIFO direction, depending on the direction of the data phase
independently of the CPU.