GD32F20x User Manual
886
USBFS will generate a channel disable request entry in request queue after the register
setting operation. When the request entry reaches the top of request queue, it will be
processed by USBFS immediately:
For OUT channels, the specified channel will be disabled immediately. Then, a CH flag will
be generated and the CEN and CDIS bits will be cleared by USBFS.
For IN channels, USBFS pushes a channel disable status entry into Rx FIFO. Then software
should handle the Rx FIFO not empty event: read and pop this status entry, and then, a CH
flag will be generated and the CEN and CDIS bits will be cleared.
IN transfers operation sequence
1.
Initialize USBFS global registers.
2.
Initialize the channel.
3.
Enable the channel.
4.
After the IN channel is enabled by software, USBFS generates an Rx request entry in
the corresponding request queue.
5.
When the Rx request entry reaches the top of the request queue, USBFS begins to
process this request entry. If bus time for the IN transaction indicated by the request
entry is enough, USBFS starts the IN transaction on USB bus.
6.
If the IN transaction is finished successfully (ACK handshake received), USBFS pushes
the received data packet into the Rx FIFO and triggers ACK flag. Otherwise, the status
flag (NAK) reports the transaction result.
7.
If the IN transaction described in step 5 is successful and PCNT is larger than 1 in step2,
returns to step 3 and continues to receive the remaining packets. If the IN transaction
described in step 5 is not successful, returns to step 3 to re-receive the packet again.
8.
After all the transactions in a transfer have been successfully received on USB bus,
USBFS pushes a TF status entry into the Rx FIFO on top of the last packet data. Thus
after reading and popping all the received data packet, the TF status entry is read.
USBFS generates TF flag to indicate that the transfer successfully have been finished.
9.
Disable the channel. Now the channel is in IDLE state and is ready for other transfers.
OUT transfers operation sequence
1.
Initialize USBFS global registers.
2.
Initialize and enable the channel.
3.
Write a packet into the channel’s Tx FIFO (Periodic Tx FIFO or non-periodic Tx FIFO).
After the whole packet data is written into the FIFO, USBFS generates a Tx request entry
in the corresponding request queue and decreases the TLEN field in USBFS_HCHxLEN
register by the written packet’s size.
4.
When the request entry reaches the top of the request queue, USBFS begins to process
Summary of Contents for GD32F20 Series
Page 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Page 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Page 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Page 385: ...GD32F20x User Manual 385 ...
Page 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...