AT32F425
Series Reference Manual
2022.03.30
Page 366
Ver 2.01
2. Once the endpoint is activated, the controller starts deconding the tokens issued to this endpoint and
sends out a valid handshake for each valid token received for the endpoint
20.5.4.7 USB endpoint deactivation
This section describes how to deactivate an existing endpoint. Disable the suspended transfer before
performing endpoint deactivation.
Clear the USB valid endpoint bit in the OTGFS_DIEPCTLx register (for IN or bidirectional
endpoints) or the OTGFS_DOEPCTLx register (for OUT or bidirectional endpoints)
Once the endpoint is deactivated, the controller will ignore the tokens issued to this endpoint,
which causes a USB timeout.
20.5.4.8 Control write transfers (SETUP/Data OUT/Status IN)
This section descrbies the steps required for control write transfers.
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. If the last SETUP packet received before the generation of the SETUP interrupt indicates data OUT
stage, program the controller to perform OUT transfers based on Asynchronous OUT data transfer
operation
3. The application can receive up to 64-byte data for a single OUT data transfer of control endpoint 0. If
the application expects to receive more than 64-byte data during data OUT 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 reception in data stage
4.
When the XFERC interrupt is set in the OTGFS_DOEPINTx register during the last OUT transfer, it
indicates the end of data OUT stage of control transfer
5. Once the completion of data OUT stage, the application must perform the following steps:
If the application needs to transfer a new SETUP packet, it must re-enable control OUT
endpoints (refer to OUT data transfers)
OTGFS_DOEPCTLx.EPENA = 0x1
To execute the received SETUP commands, the application must configure the corresponding
registers in the controller. This is optional, depending on the received SETUP command type
6. During status IN stage, the application must follow the requirements of Non-periodic (for bulk and
control) IN data transfers to program registers to perform data IN transfers
7. When the XFERC interrupt is set in the OTGFS_DOEPINTx register is set, it indicates that the status
stage of control transfers is started. As soon as Data transfer complete mode and Status stage start bit
are set in the receive FIFO packet status register, the controller generates an interrupt. The Transfer
complete interrupt can be cleared through the XFERC bit in the OTGFS_DOEPINTx register
Repeat above-mentioned steps until an interrupt (XFERC bit in the OTGFS_DIEPINTx register) is
generated on the endpoint, which indicates the end of control write transfers.
20.5.4.9 Control read transfers (SETUP/Data IN/Status OUT)
This section descrbies the steps required for control read transfers.
The application programming process is as follows:
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
If the last SETUP packet received before the generation of the SETUP interrupt indicates data IN
stage, program the controller to perform IN transfers based on Non-periodic IN data transfer
operation