
GD32F403xx User Manual
638
Figure 23-3. Connection with OTG mode
DP
ID
DM
VBUS
5V Power
Supply
VDD
U
S
B
M
icr
o
/M
in
i co
n
ne
ct
o
r
GPIO
USBFS
GND
VBUS
DM
DP
ID
23.5.2.
USB host function
USB Host Port State
Host application may control state of the USB port via USBFS_HPCS register. After system
initialization, the USB port stays at power-off state. After PP bit is set by software, the internal
USB PHY is powered on, and the USB port changes into disconnected state. Af ter a
connection is detected, USB port changes into connected state. The USB port changes into
enabled state after a port reset is performed on USB bus.
Figure 23-4. State transition diagram of host port
Power-off
Dis-connected
Connected
Enabled
set PP bit
clear PP bit or VBUS is
not valid in OTG host mode
connection event
disconnection event
port reset
Clear PP bit
disconnection event
clear PE bit
clear PP bit
Connection, Reset and Speed identification
As a USB host, USBFS will trigger a connection f lag for application af ter a connection is
detected and will trigger a disconnection flag after a disconnection event.