R01UH0823EJ0100 Rev.1.00
Page 944 of 1823
Jul 31, 2019
RX23W Group
32. USB 2.0 Host/Function Module (USBc)
32.3.6.2
Control Transfers When the Function Controller is Selected
(1) Setup Stage
The USB sends an ACK response for a correct setup packet targeted to the USB. The operation of the USB in the setup
stage is described below.
When receiving a new setup packet, the USB sets the following bits.
Set the INTSTS0.VALID flag to 1.
Set the DCPCTR.PID[1:0] bits to 00b (NAK).
Set the DCPCTR.CCPL bit to 0.
When receiving a data packet right after the setup packet, the USB stores the USB request parameters in registers
USBREQ, USBVAL, USBINDX, and USBLENG.
Response processing with respect to the control transfer should be carried out after setting the VALID flag = 0. In the
VALID flag = 1 state, PID[1:0] = 01b (BUF) cannot be set, and the data stage cannot be terminated.
Using the function of the VALID flag, the USB can suspend the current request processing when receiving a new USB
request during a control transfer, and can send a response to the newest request.
In addition, the USB automatically detects the direction bit (bit 8 of bmRequestType) and the request data length
(wLength) of the received USB request, distinguishes between control read transfer, control write transfer, and no-data
control transfer, and controls stage transitions. For a wrong sequence, the sequence error of the control transfer stage
transition interrupt is generated, and the software is notified of occurrence of the error. For the stage control of the USB,
refer to
.
(2) Data Stage
Data transfers corresponding to received USB requests should be done using the DCP. Before accessing the DCP buffer
memory, the access direction should be specified using the CFIFOSEL.ISEL bit.
If the transfer data is larger than the size of the DCP buffer memory, the data transfer should be carried out using the
BRDY interrupt for control write transfers and the BEMP interrupt for control read transfers.
(3) Status Stage
Control transfers are terminated by setting the DCPCTR.CCPL bit to 1 while the DCPCTR.PID[1:0] bits are set to 01b
(BUF).
After the above settings have been made, the USB automatically executes the status stage in accordance with the data
transfer direction determined at the setup stage. The specific procedure is as follows.
For control read transfers
A zero-length packet is received from the USB host and an ACK response is sent.
For control write transfers and no-data control transfers
A zero-length packet is transmitted and an ACK response is received from the USB host.
(4) Control Transfer Auto Response Function
The USB automatically responds to a correct SET_ADDRESS request. If any of the following errors occurs in the
SET_ADDRESS request, a response from the software is necessary.
bmRequestType is not 00h: Any transfer other than a control write transfer
wIndex is not 00h: Request error
wIndex is not 00h: Any transfer other than a no-data control transfer
wValue is larger than 7Fh: Request error
INTSTS0.DVSQ[2:0] are 011b (Configured state): Control transfer of a device state error
For all requests other than the SET_ADDRESS request, a response is required from the corresponding software.