GD32VF103 User Manual
468
The Host Negotiation Protocol (HNP) allows the host function to be switched between two
directly connected On-The-Go devices and eliminates the necessity of switching the cable
connections for the change of 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 for host,
Micro-B plug for device) is inserted. By utilizing the Host Negotiation Protocol (HNP), an On-
The-Go B-Device, which is the default device, may make a request to be a host. The process
for the exchange of the role to a host is described in this section. This protocol eliminates the
necessity of switching the cable connection for the change of the roles of the connected
devices.
When USBFS is in OTG A-Device host mode and it wants to give up its host role, it may firstly
set PSP bit in USBFS_HPCS register to make the USB bus enter in suspend status. Then,
the B-Device will enter in suspend state 3ms later. If the B-Device wants to change to be a
host, HNPREQ bit in USBFS_GOTGCS register should be set and the USBFS will begin to
perform HNP protocol on bus, and at last, the result of HNP is reported in HNPS bit in
USBFS_GOTGCS register. Besides, it is always available to get the current role (host or
device) from COPM bit in USBFS_GINTF register.
SRP
The Session Request Protocol (SRP) allows a B-Device to request the A-Device to turn on
VBUS and start a session. This protocol allows the A-Device, which may be battery powered,
to conserve power by turning VBUS off when there is no bus activity while still providing a
means for the B-Device to initiate bus activity. As described in OTG protocol, an OTG device
must compare VBUS voltage with several threshold values and the compare result should be
reported in ASV and BSV bits in USBFS_GOTGCS register.
Set SRPREQ bit in USBFS_GOTGCS register to start a SRP request when USBFS is in B-
Device OTG mode and USBFS will generate a success flag SRPS in USBFS_GOTGCS
register if the SRP request successfully.
When USBFS is in OTG A-Device mode and it has detected a SRP request from a B-Device,
it sets a SESIF flag in USBFS_GINTF register. The 5V power supply for VBUS pin should be
prepared to switch on after getting this flag.
21.5.5.
Data FIFO
The USBFS contains a 1.25K bytes data FIFO for packet data storage. The data FIFO is
implemented by using an internal SRAM in USBFS.
Host Mode
In host mode, the data FIFO space is divided into 3 parts: Rx FIFO for received packet, Non-
Periodic Tx FIFO for non-period transmission packet and Periodic Tx FIFO for periodic