AT32F425
Series Reference Manual
2022.03.30
Page 373
Ver 2.01
If there is no space in the receive FIFO, synchronous or non-synchronous data packets are
ignored and not written to the receive FIFO. Besides, the non-synchronous OUT tokens receive a
NAK handshake response.
In all the above-mentioned cases, the packet count is not decremented because no data is
written to the receive FIFO.
3. When the packet count becomes 0 or when a short packet is received on the endpoint, the NAK bit
for the endpoint is set. Once the NAK bit is set, the synchronous or non-synchronous data packets are
ignored and not written to the receive FIFO, and non-synchronous OUT tokens receive a NAK
handshake response.
4. After the data is written to the receive FIFO, the application reads the data from the receive FIFO and
writes it to the external memory, once packet at a time per endpoint.
5. At the end of data packet write to the external memory, the transfer size for the endpoint is
decremented with the size of the written packet.
6. The OUT data transfer completed mode for an OUT endpoint is written to the receive FIFO one one
of the following conditions:
The transfer size and packet count are both 0
The last OUT data packet written to the receive FIFO is a short packet (0 ≤ data packet size <
largest packet size)
7. When the application pops this entry (OUT data transfer complete), a transfer completed interrupt is
generated and the endpoint enable bit is cleared.
【
Application programming sequence
】
1. Program the OTGFS_DOEPTSIZx register with the transfer size and the corresponding packet count.
2. Program the OTGFS_DOEPCTLx register with the endpoint characteristics, and set the endpoint
enable and ClearNAK bits.
OTGFS_DOEPCTLx.EPENA = 0x1
OTG-DOEPCTLx.CNAK = 0x1
3. Wait for the RXFLVL interrupt in the OTGFS_GINTSTS register, and read out all data packets from
the receive FIFO.
This step can be repeated, depending on the transfer size
4. When the XFERC interrupt is set in the OTGFS_DOEPINTx register, it indicates a successful
completion of the non-synchronous OUT data transfer. Read the OTGFS_DOEPTSIZx register to
determine how much data has been received.
【
Bulk OUT transfer
】
describes the reception of a single bulk OUT data packet from the USB to the AHB and
shows the events involved in the process.