R01UH0823EJ0100 Rev.1.00
Page 899 of 1823
Jul 31, 2019
RX23W Group
32. USB 2.0 Host/Function Module (USBc)
The PID[1:0] bits specify the response type for the next transaction of the relevant pipe.
The default setting of the PID[1:0] bits are 00b (NAK). Modify the setting of the PID[1:0] bits to 01b (BUF) to use the
relevant pipe for USB transfer.
show the basic operation (operation when there are no errors
in the transmitted and received packets) of the USB depending on the PID[1:0] bit setting.
After modifying the setting of the PID[1:0] bits through software from 01b (BUF) to 00b (NAK) during USB
communication using the relevant pipe, check that the PBUSY flag is 1 to see if USB transfer using the relevant pipe has
actually entered the NAK state. However, if the USB changes the PID[1:0] bits to 00b (NAK), the PBUSY flag does not
need to be checked by software.
The USB modifies the setting of the PID[1:0] bits in the following cases.
The USB sets the PID[1:0] bits to 00b (NAK) on recognizing the completion of the transfer when the relevant pipe
is in the receiving direction and the PIPECFG.SHTNAK bit for the selected pipe has been set to 1 by software.
The USB sets the PID[1:0] bits to 11b (STALL) on receiving a data packet with a payload exceeding the maximum
packet size of the relevant pipe.
The USB sets the PID[1:0] bits to 00b (NAK) on detecting a USB bus reset when the function controller is selected.
The USB sets the PID[1:0] bits to 00b (NAK) on detecting a receive error, such as a CRC error, three consecutive
times when the host controller is selected.
The USB sets the PID[1:0] bits to 11b (STALL) on receiving the STALL handshake when the host controller is
selected.
To specify each response type, set the PID[1:0] bits as follows.
To make a transition from NAK (00b) to STALL, set 10b.
To make a transition from BUF (01b) to STALL, set 11b.
To make a transition from STALL (11b) to NAK, set 10b and then 00b.
To make a transition from STALL (11b) to BUF, set 10b, 00b, and then 01b.
To make a transition from STALL (10b) to BUF, set 00b and then 01b.
PBUSY Flag (Pipe Busy Flag)
The PBUSY flag indicates whether the relevant pipe is being currently used or not for the transaction.
The USB modifies the PBUSY flag from 0 to 1 upon start of the USB transaction for the relevant pipe, and modifies the
PBUSY flag from 1 to 0 upon completion of one transaction.
Reading the PBUSY flag after the PID[1:0] bits have been set to 00b (NAK) by software allows checking whether
modification of the pipe settings is possible.
For details, refer to
section 32.3.4.1, Pipe Control Register Switching Procedures
.
SQMON Bit (Sequence Toggle Bit Confirmation)
The SQMON flag indicates the expected value of the sequence toggle bit for the next transaction of the relevant pipe.
When the relevant pipe is not for the isochronous transfer, the USB allows the SQMON flag to toggle upon normal
completion of the transaction. However, the SQMON flag is not allowed to toggle when a data PID mismatch occurs
during the transfer in the receiving direction.
SQSET Bit (Sequence Toggle Bit Set)
The SQSET bit should be set to 1 to set DATA1 as the expected value of the sequence toggle bit for the next transaction
of the relevant pipe.
Setting the SQSET bit to 1 through software allows the USB to set DATA1 as the expected value of the sequence toggle
bit of the relevant pipe. The USB sets the SQSET bit to 0.