28 USB FUNCTION CONTROLLER (USB)
S1C33L26 TECHNICAL MANUAL
Seiko Epson Corporation
28-9
Do not set the CPU and Port interfaces with the CPU_JoinRd and DMA_Join registers for reading from the
same endpoint. Additionally, be sure to start reading data after ensuring that no data return responses are
returned to IN transactions by setting the ForceNAK bit, for example, if you want to set an IN endpoint for
data reading using the CPU_JoinRd register.
Data cannot be read from the IN endpoint via the Port interface.
If the FIFO has available space for receiving data packets, the macro automatically responds to OUT trans-
actions to receive data. This enables the firmware to perform OUT transfer without individual transaction
control. Note, however, that the EP
x
{
x
=a,b,c,d}Control.ForceNAK bit of the endpoint is set if short packets
are received (including zero-length data packet) when the EP
x
{
x
=a,b,c,d}Control.DisAF_NAK_Short bit is
cleared. Clear this bit when the next data transfer is ready.
Figure 28.5.1.6 illustrates the data flow in OUT transfer. The FIFO region for an OUT endpoint is con-
nected to the Port interface. Also, the FIFO region assigned to this endpoint is assumed to be twice as large
as the maximum packet size.
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
U2
U1
USB
Port reading
Port reading
Port
FIFO
5.1.6 Example of Data Flow in OUT Transfer
Figure 28.
(U1) Data transfer of the maximum packet size is performed in the first OUT transaction.
(U2) Data transfer of the maximum packet size is performed in the second OUT transaction.
(F1) The FIFO is blank. Although the Port interface is invoked, no transfer is performed since the FIFO is
blank. (The PDREQ signal is negated.)
(F2) An OUT transaction is developing, and data reception has started in the FIFO. At this point, the FIFO
data is not considered to be valid since the transaction is not closed.
(F3) Although data packet reception is completed from the OUT transaction, the FIFO data is not consid-
ered to be valid since the transaction is not closed.
(F4) The OUT transaction is closed and the received data are considered to be valid.
(F5) The presence of valid data in the FIFO triggers data transfer via the Port interface. (The PDREQ sig-
nal is asserted.)
(F6) As Port transfer develops, the amount of the remaining valid data in the FIFO is reduced.
(F7) Starting the next transaction starts writing data. Port transfer continues as long as any valid data re-
mains.
(F8) Port transfer has stopped as there is no valid data left. The second OUT transaction is not closed yet.
(F9) The second OUT transaction is closed, causing the FIFO data to become valid.
(F10) The presence of valid data in the FIFO restarts Port transfer.
IN transfer
Place data transmitted thorough IN transfer on each endpoint’s FIFO. The FIFO data can be written via ei-
ther the CPU interface (EP0, EPa, EPb, EPc, EPd) or the Port interface (EPa, EPb, EPc, EPd).
To write data into the FIFO via the CPU interface, select one and only one endpoint using the CPU_JoinWr
register. Data can be written in the selected endpoint’s FIFO by using the EPnFIFOforCPU register, which
are transmitted in data packets in the order of writing. Also, you can refer to the EPnWrRemain_H and EP-
nWrRemain_L registers to check the available space in the FIFO. An attempt to write in a full FIFO causes
dummy writing to be performed.