![ARTERY AT32WB415 Series Reference Manual Download Page 314](http://html1.mh-extra.com/html/artery/at32wb415-series/at32wb415-series_reference-manual_2977599314.webp)
AT32WB415
Series Reference Manual
2022.04.13
Page 314
Ver 2.00
SETUP packet mode: PKTSTS = SETUP, BCnt = 0x008, EPNUM = Control EP Num and DPID =
D0, indicating that a SETUP packet for the specified endpoint is now available for reading from
the receive FIFO
Setup stage done mode: PKTSTS = Setup Stage Done, BCNT = 0x0, EPNUM = Control EP Num
and DPID = Don’t Care (0x00), indicating the completion of the Setup stage for the specified
endpoint, and the start of the data stage. After this request is popped from the receive FIFO, the
controller triggers a Setup interrupt on the speficied control OUT endpoint
Data OUT packet mode: PKTSTS = DataOUT, BCnt =size of the received data OUT packet (0 ≤
BCNT ≤ 1024), EPNUM =Endpoint number on which the data packet was received, DPID =Actual
data PID
Data transfer complete mode: PKTSTS = Data OUT transfer done, BCNT = 0x0, EPNUM =OUT
endpoint number on which the data transfer is complete, DPID = Don’t Care (0x00). These data
indicate that an OUT data transfer for the specified OUT endpoint has been complete. After this
request is popped from the receive FIFO, the controller triggers a Transfer Completed interrupt on
the specified OUT endpoint. PKTSTS code can be found in the OTGFS_GRXSTSR /
OTGFS_GRXSTSP register
6.
After the valid data is popped from the receive FIFO, the RXFLVL interrupt bit in the
OTGFS_GINTSTS register must be unmasked
7.
Step 1-5 must be repeated each time the application detects the interrupt line due to the RXFLVL bit
in the OTGFS_GINTSTS register. Reading an empty receive FIFO will result in unexpected behavior.
Figure 20-10 Read receive FIFO
Frame transfer
completed
?
rd_data.BCNT=0
wait until GINSTS.RXFLVL
mem[0:dword_cnt-
1]=rd_rxfifo(rd_data.EPNU
M,dword_cnt)
Y
rd_data=rd_reg(GRXSTSP);
N
dword_cnt=B
CNT[11:2]+(B
CNT[1] |
BCNT[0])
rcv_out_pkt()
packet store in
memory
20.5.4.12
OUT data transfers
This section describes the internal data flow during data OUT and SETUP transfers, and how the
application handles SETUP transfers.
(1) Setup transfers
This section describes how to handle SETUP data packets and the application’s operating sequence of
handling SETUP transfers. After power-on reset, the application must follow the OTGFS Initilization
process to initialize the controller. Before communicating with the host, the application must initialize the