GD32F403xx User Manual
641
a resume signal on USB bus. When USBFS detects the resume signal, the WKUPIF flag in
USBFS_GINTF register will be set and the USBFS wake up interrupt will be triggered.
In suspend mode, USBFS is also able to remotely wake up the USB bus. Software may set
RWKUP bit in USBFS_DCTL register to send a remote wake-up signal, and if remote wake-
up is supported in USB host, the host will begin to send resume signal on USB bus.
Soft Disconnection
USBFS supports soft disconnection. After the device is powered on, USBFS will switch on
the pull-up resistor on DP line so that the host can detect the connection. It is able to force a
disconnection by setting the SD bit in USBFS_DCTL register. After the SD bit is set, USBFS
will directly switch off the pull-up resistor, so that USB host will detect a disconnection on USB
bus.
SOF tracking
When USBFS receives a SOF packet on USB bus, it will trigger a SOF interrupt and begin to
count the bus time by using local USB clock. The f rame number of the current f rame is
reported in FNRSOF f iled in USBFS_DSTAT register. When the USB bus time reaches EOF1
or EOF2 point (End of Frame, described in USB 2.0 protocol), USBFS will trigger an EOPFIF
interrupt in USBFS_GINTF register. These flags and registers can be used to get current bus
time and position information.
23.5.4.
OTG function overview
USBFS supports OTG f unction described in OTG protocol 1.3, OTG f unction includes SRP
and HNP protocols.
A-Device and B-Device
A-Device is an OTG capable USB device with a Standard-A or Micro-A plug inserted into its
receptacle. The A-Device supplies power to VBUS and it is host at the start of a session. B-
Device is an OTG capable USB device with a Standard -B, Micro-B or Mini-B plug inserted
into its receptacle, or a captive cable ending being a Standard -A plug. The B-Device is a
peripheral at the start of a session. USBFS uses the voltage level of ID pin to identify A -Device
or B-Device. The ID status is reported in IDPS bit in USBFS_GOTGCS register. For the details
of transfer states between A-Device and B-Device, please refer to OTG 1.3 protocol.
HNP
The Host Negotiation Protocol (HNP) allows the host f unction to be switched between two
directly connected On-The-Go devices and eliminates the necessity of switching the cable
connections for the change about control of communications between the devices. HNP will
be initialized typically by the user or an application on the On-The-Go B-Device. HNP may
only be implemented through the Micro-AB receptacle on a device.
Since On-The-Go devices have a Micro-AB receptacle, an On-The-Go device can default to
being either a host or a device, depending that which type of plug (Micro -A plug f or host,