28 USB FUNCTION CONTROLLER (USB)
28-10
Seiko Epson Corporation
S1C33L26 TECHNICAL MANUAL
To write data into the FIFO via the Port interface, select one and only one IN endpoint using the DMA_Join
register. Perform the Port interface procedure to write data into the selected endpoint’s FIFO. These data are
transmitted in data packets in the order of writing. After the FIFO becomes full, the Port interface automati-
cally pauses to perform flow control.
Do not set the CPU and Port interfaces with the CPU_JoinWr and DMA_Join registers for writing data into
the same endpoint. Additionally, be sure to start writing data after ensuring that no data are received from
the OUT transactions by setting the ForceNAK bit, for example, if you want to set an OUT endpoint for
data writing using the CPU_JoinWr register.
Data cannot be written into an OUT endpoint via the Port interface.
If the FIFO contains data exceeding the maximum packet size, the macro automatically responds to IN
transactions to perform data transmission. This enables the firmware to perform IN transfer without individ-
ual transaction control. Note, however, that you should set the EnShortPkt bit if you need to transmit a short
packet at the end of the data transfer. Since this bit is cleared when the IN transaction which has transmitted
the short packet is closed, you can set it after data is completely written into the FIFO.
When the DMA_FIFO_Control.AutoEnShort bit is set, the EP
x
{
x
=a,b,c,d}Control.EnShortPkt bit of the
relevant endpoint is automatically set if the FIFO still contains any fractional amount of data under the
maximum packet size after writing via the Port interface is completed. Using this function provides auto-
matic control to the end that only a non-zero-length short packet is returned, eliminating return of a zero-
length data packet.
Figure 28.5.1.7 illustrates the data flow in IN transfer. The FIFO region for an IN endpoint is connected 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
U3
U2
U1
USB
Port writing
Port writing
Port
FIFO
5.1.7 Example of Data Flow in IN Transfer
Figure 28.
(U1) In the first IN transaction, a NAK response is returned since the FIFO has no valid maximum packet
size data.
(U2) Data transfer of the maximum packet size is performed in the second IN transaction.
(U3) Data transfer of the maximum packet size is performed in the third IN transaction.
(F1) The FIFO is blank.
(F2) Port transfer is started and valid data is written into the FIFO. (The PDREQ signal is asserted.)
(F3) As the FIFO still has an available space, Port transfer is continuing.
(F4) Since the FIFO contains valid maximum packet size data, the macro responds to the IN transaction
with data packet transmission. As the transaction is not closed yet, the region from which data are
transmitted is not freed. The FIFO is full, causing Port transfer to stop. (The PDREQ signal is ne-
gated.)
(F5) Although data packet transmission in the IN transaction has been completed, the FIFO region is not
freed since the transaction is not closed. Port transfer remains discontinued.
(F6) The FIFO region is freed as the transaction is closed upon reception of an ACK handshake packet.
(F7) As the FIFO now has some available space, Port transfer is resumed. (The PDREQ signal is asserted.)
(F8) The macro responds to an IN transaction and transmits a data packet. Since the FIFO has some avail-
able space, Port transfer continues.