R01UH0823EJ0100 Rev.1.00
Page 868 of 1823
Jul 31, 2019
RX23W Group
32. USB 2.0 Host/Function Module (USBc)
FRDY Flag (FIFO Port Ready Flag)
The FRDY flag indicates whether the FIFO port can be accessed by the CPU or DMAC/DTC.
In the following cases, the USB sets the FRDY flag to 1 but data cannot be read via the FIFO port because there is no
data to be read. In these cases, set the BCLR bit to 1 to clear the FIFO buffer, and enable transmission and reception of
the next data.
A zero-length packet is received when the FIFO buffer assigned to the selected pipe is empty.
A short packet is received and the data is completely read while the PIPECFG.BFRE bit = 1.
The BCLR bit should be set to 1 to clear the FIFO buffer on the CPU side for the selected pipe.
When double buffer mode is set for the FIFO buffer assigned to the selected pipe, the USB clears only one plane of the
FIFO buffer even when both planes are read-enabled.
When the selected pipe is the DCP, setting the BCLR bit to 1 allows the USB to clear the FIFO buffer regardless of
whether the FIFO buffer is on the CPU side or SIE side. To clear the buffer on the SIE side, set the DCPCTR.PID[1:0]
bits for the DCP to 00b (NAK) before setting the BCLR bit to 1.
When the selected pipe is in the transmitting direction, if 1 is written to the BVAL bit and the BCLR bit simultaneously,
the USB clears the data that has been written before it, enabling transmission of a zero-length packet.
When the selected pipe is not the DCP, writing 1 to the BCLR bit should be done while the FRDY flag in the FIFO port
control register is 1 (set by the USB).
BVAL Bit (Buffer Memory Valid)
The BVAL bit should be set to 1 when data has been completely written to the FIFO buffer on the CPU side for the pipe
selected using the CURPIPE[3:0] bits (selected pipe).
When the selected pipe is in the transmitting direction, set the BVAL bit to 1 in the following cases. Then, the USB
switches the FIFO buffer from the CPU side to the SIE side, thus enabling transmission.
To transmit a short packet, set the BVAL bit to 1 after data has been written.
To transmit a zero-length packet, set the BVAL bit to 1 before data is written to the FIFO buffer.
When data of the maximum packet size has been written for the pipe in continuous transfer mode, the USB sets the
BVAL bit to 1 and switches the FIFO buffer from the CPU side to the SIE side, thus enabling transmission.
Writing 1 to the BVAL bit should be done while the FRDY flag is 1 (set by the USB).
When the selected pipe is in the receiving direction, do not set the BVAL bit to 1.