![GigaDevice Semiconductor GD32F20 Series User Manual Download Page 887](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32f20-series/gd32f20-series_user-manual_2225801887.webp)
GD32F20x User Manual
887
this request entry. If bus time for the transaction indicated by the request entry is enough,
USBFS starts the OUT transaction on USB bus.
5.
When the OUT transaction indicated by the request entry has been finished on USB bus,
PCNT in USBFS_HCHxLEN register is decreased by 1. If the transaction is finished
successfully (ACK handshake received), the ACK flag is triggered. Otherwise, the status
flag (NAK) reports the transaction result.
6.
If the OUT transaction described in step 5 is successful and PCNT is larger than 1 in
step 2, returns to step 3 and continues to send the remaining packets. If the OUT
transaction described in step 5 is not successful, return to step 3 to re-send the packet
again.
7.
After all the transactions in a transfer are successfully sent on USB bus, USBFS
generates TF flag to indicate that the transfer successfully finishes.
8.
Disable the channel. Now the channel is in IDLE state and is ready for other transfers.
Device mode
Global register initialization sequence
1.
Program USBFS_GAHBCS register according to application’s demand, such as the
TxFIFO’s empty threshold, etc. GINTEN bit should be kept cleared at this time.
2.
Program USBFS_GUSBCS register according to application’s demand, such as: the
operation mode (host, device or OTG) and some parameters of OTG and USB protocols.
3.
Program USBFS_GCCFG register according to application’s demand.
4.
Program USBFS_GRFLEN, USBFS_DIEP0TFLEN, USBFS_DIEPxTFLEN register to
configure the data FIFOs acco
rding to application’s demand.
5.
Program USBFS_GINTEN register to enable Mode Fault, Suspend, SOF, Enumeration
Done and USB Reset interrupt, and then, set GINTEN bit in USBFS_GAHBCS register
to enable global interrupt.
6.
Program USBFS_DCFG register according t
o application’s demand, such as the device
address, etc.
7.
After the device is connected to a host, the host will perform port reset on USB bus and
this will trigger the RST interrupt in USBFS_GINTF register.
8.
Wait for ENUMF interrupt in USBFS_GINTF register.
Endpoint initialization and enable sequence
1.
Program USBFS_DIEPxCTL or USBFS_DOEPxCTL register with desired transfer type,
packet size, etc.
2.
Program USBFS_DIEPINTEN or USBFS_DOEPINTEN register. Set the desired
interrupt enable bits.
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 ...