AT32F425
Series Reference Manual
2022.03.30
Page 368
Ver 2.01
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
7.
After the valid data is popped from the receive FIFO, the RXFLVL interrupt bit in the
OTGFS_GINTSTS register must be unmasked
8.
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
endpoints based on Device Initialization, and refer to Read FIFO packets for more information.
【
Application requirements
】
1.
To receive a SETUP packet, the SUPCNT bit (OTGFS_DOEPTSIZx) on a control OUT endpoint
must be programmed to be a non-zero value. When the application sets the SUPCNT bit to a non-
zero value, the controller receives SETUP packets and writes them to the receive FIFO, irrespective