GD32VF103 User Manual
471
Figure 21-8. Device mode FIFO access register map
IEP0 FIFO Write
IEP1 FIFO Write
1000h-1FFFh
IEP3 FIFO Write
...
2000h-2FFFh
4000h-4FFFh
Can be read by any
OUT endpoint FIFO
21.5.6.
Operation guide
This section describes the advised operation guide for USBFS.
Host 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_HNPTFLEN_DIEP0TFLEN and USBFS_HPTFLEN
register to configure the data FIFOs according to application
’s demand.
5. Program USBFS_GINTEN register to enable Mode Fault and Host Port interrupt and set
GINTEN bit in USBFS_GAHBCS register to enable global interrupt.
6. Program USBFS_HPCS register and set PP bit.
7. Wait for a device
’s connection, and once a device is connected, the connection interrupt
PCD in USBFS_HPCS register will be triggered. Then set PRST bit to perform a port
reset. Wait for at least 10ms and then clear PRST bit.
8. Wait PEDC interrupt in USBFS_HPCS register and then read PE bit to ensure that the
port is successfully enabled. Read PS [1:0] bits to get the connected device
’s speed and
then program USBFS_HFT register to change the SOF interval if needed.