AT32F425
Series Reference Manual
2022.03.30
Page 367
Ver 2.01
The application can receive up to 64-byte data for a single IN data transfer of control endpoint 0.
If the application expects to receive more than 64-byte data during data IN stage, it must re-enable
the endpoint to receive another 64-byte data, and it must contine this operation until the completion of
all data transfers in data stage
Repeat above-mentioned steps until the XFERC interrupt is generated in the OTGFS_DIEPINTx
register for each IN transfer on the endpoint
When the XFERC interrupt is set in the OTGFS_DOEPINTx register during the last IN transfer, it
indicates the end of data OUT stage of control transfer
To execute data OUT transfer at status OUT stage, the application must configure the controller.
This is optional.
The application must program the NZSTSOUTHSHK bit in the OTGFS_DCFG register, and then
send data OUT transfer at status stage
The XFERC interrupt bit is set in the OTGFS_DOEPINTx register to indicate the end of status OUT
stage of control transfer, marking the completion of control read transfers.
20.5.4.10
Control transfers (SETUP/Status IN)
This section describes the two-phase control transfer operation..
The application programming process is as follows:
1.
When the SETUP bit is set in the OTGFS_DOEPINTx register, it indicates that a valid SETUP packet
has been sent to the application, and data stage is initiated, see OUT data transfers. At the end of
the SETUP stage, the application must rewrite 3 to the SUPCNT bit in the OTGFS_DOEPTSIZx
register to receive the subsequent SETUP packet
2.
The application decodes the last SETUP packet received before the generation of the SETUP
interrupt. If the SETUP packet indicates two-level control commands, the application must perform
the following steps:
Set OTGFS_DOEPCTLx.EPENA = 0x1
The application must program the registers in the controller to perform the received SETUP
commands
3. For status IN stage, the application must program the registers based on Non-periodic (bulk and
control) IN data transfers to perform data IN transfers
4. The XFERC interrupt bit is set in the OTGFS_DIEPINTx register to indicate the end of status IN
stage of control transfers.
20.5.4.11
Read FIFO packets
This section describes how to read FIFO packets (OUT data and SETUP packets)
1.
The application must read the OTGFS_GRXSTSP register as soon as the RXFLVL interrupt bit is
detected in the OTGFS_GINTSTS register
2.
The application can mask the RXFLVL interrupt bit in the OTGFS_GINTSTS register by setting
RXFLVL = 0x0 in the OTGFS_GINTMSK register, until it has read the data packets from the receive
FIFO
3.
If the received packet byte is not 0, the byte count amount of data is popped from the receive data
FIFO and stored in memory. If the received packet byte count is 0, no data is read from the receive
data FIFO
4. The receive FIFO packet status reading indicates one of the following conditions:
5. Global OUT NAK mode: PKTSTS = Global OUT NAK, BCNT = 0x000, EPNUM = Dont Care (0x0) and
DPID = Dont Care (0x00), indicating that the global OUT NAK bit has taken effect
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