RM0090 Rev 18 1519/1749
RM0090 USB on-the-go high-speed (OTG_HS)
1543
Figure 426. Receive FIFO packet read in slave mode
• SETUP transactions
This section describes how the core handles SETUP packets and the application’s
sequence for handling SETUP transactions.
• Application requirements
1. To receive a SETUP packet, the STUPCNT field (OTG_HS_DOEPTSIZx) in a control
OUT endpoint must be programmed to a nonzero value. When the application
programs the STUPCNT field to a nonzero value, the core receives SETUP packets
and writes them to the receive FIFO, irrespective of the NAK status and EPENA bit
setting in OTG_HS_DOEPCTLx. The STUPCNT field is decremented every time the
control endpoint receives a SETUP packet. If the STUPCNT field is not programmed to
a proper value before receiving a SETUP packet, the core still receives the SETUP
packet and decrements the STUPCNT field, but the application may not be able to
determine the correct number of SETUP packets received in the Setup stage of a
control transfer.
– STUPCNT = 3 in OTG_HS_DOEPTSIZx
2. The application must always allocate some extra space in the Receive data FIFO, to be
able to receive up to three SETUP packets on a control endpoint.
– The space to be reserved is 10 words. Three words are required for the first
SETUP packet, 1 word is required for the Setup stage done word and 6 words are
required to store two extra SETUP packets among all control endpoints.
– 3 words per SETUP packet are required to store 8 bytes of SETUP data and 4
bytes of SETUP status (Setup packet pattern). The core reserves this space in the
receive data.
– FIFO to write SETUP data only, and never uses this space for data packets.
3. The application must read the 2 words of the SETUP packet from the receive FIFO.
4. The application must read and discard the Setup stage done word from the receive
FIFO.
• Internal data flow
dword_cnt =
BCNT[11:2] +C
(
BCNT[1]
| BCNT[1])
rcv_out_pkt()
rd_data = rd_reg (OTG_FS_GRXSTSP);
mem[0:dword_cnt-1] =
rd_rxfifo(rd_data.EPNUM,
dword_cnt)
N
rd_data.BCNT = 0
wait until RXFLVL in OTG_FS_GINTSTSG
packet
store in
memory
Y
ai15677