USB on-the-go high-speed (OTG_HS)
RM0090
1510/1731
DocID018909 Rev 11
(maximum packet size or short packet) written to the receive FIFO decrements the
packet count field for that endpoint by 1.
–
OUT data packets received with bad data CRC are flushed from the receive FIFO
automatically.
–
After sending an ACK for the packet on the USB, the core discards
nonisochronous OUT data packets that the host, which cannot detect the ACK, re-
sends. The application does not detect multiple back-to-back data OUT packets
on the same endpoint with the same data PID. In this case the packet count is not
decremented.
–
If there is no space in the receive FIFO, isochronous or nonisochronous data
packets are ignored and not written to the receive FIFO. Additionally,
nonisochronous OUT tokens receive a NAK handshake reply.
–
In all the above three cases, the packet count is not decremented because no data
are 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 that endpoint is set. Once the NAK bit is set, the isochronous or
nonisochronous data packets are ignored and not written to the receive FIFO, and
nonisochronous OUT tokens receive a NAK handshake reply.
4. After the data are written to the receive FIFO, the application reads the data from the
receive FIFO and writes it to external memory, one packet at a time per endpoint.
5. At the end of every packet write on the AHB to external memory, the transfer size for
the endpoint is decremented by the size of the written packet.
6. The OUT data transfer completed pattern for an OUT endpoint is written to the receive
FIFO on one of the following conditions:
–
The transfer size is 0 and the packet count is 0
–
The last OUT data packet written to the receive FIFO is a short packet
(0
≤
packet size < maximum packet size)
7. When either the application pops this entry (OUT data transfer completed), a transfer
completed interrupt is generated for the endpoint and the endpoint enable is cleared.
Application programming sequence:
1.
Program the OTG_HS_DOEPTSIZx register for the transfer size and the
corresponding packet count.
2. Program the OTG_HS_DOEPCTLx register with the endpoint characteristics, and set
the EPENA and CNAK bits.
–
EPENA = 1 in OTG_HS_DOEPCTLx
–
CNAK = 1 in OTG_HS_DOEPCTLx
3. Wait for the RXFLVL interrupt (in OTG_HS_GINTSTS) and empty the data packets
from the receive FIFO.
–
This step can be repeated many times, depending on the transfer size.
4. Asserting the XFRC interrupt (OTG_HS_DOEPINTx) marks a successful completion of
the nonisochronous OUT data transfer.
5. Read the OTG_HS_DOEPTSIZx register to determine the size of the received data
payload.
•
Generic isochronous OUT data transfer
This section describes a regular isochronous OUT data transfer.
Application requirements: