GD32F20x User Manual
879
detected and will trigger a disconnection flag after a disconnection event.
PRST bit in USBFS_HPCS register is used for USB reset sequence. Application may set this
bit to start a USB reset and clear this bit to finish the USB reset. This bit only takes effect
when port is at connected or enabled state.
The USBFS performs speed identification during connection, and the speed information will
be reported in PS field in USBFS_HPCS register. USBFS identifies the device speed by the
voltage level of DM or DP. As described in USB protocol, full-speed device pulls up DP line,
while low-speed device pulls up DM line.
Suspend and resume
USBFS supports suspend state and resume operation. When USBFS port is at enabled state,
writing 1 to PSP bit in USBFS_HPCS register will cause USBFS to enter into suspend state.
In suspend state, USBFS stops sending SOFs on USB bus, and it will lead the connected
USB device to enter into suspend state after 3ms. Application can set the PREM bit in
USBFS_HPCS register to start a resume sequence, so as to wake up the suspended device,
and clear this bit to stop the resume sequence. The WKUPIF bit in USBFS_GINTF will be set
and the USBFS wakeup interrupt will be triggered if a host in suspend state detects a remote
wakeup signal.
SOF generate
USBFS sends SOF tokens on USB bus in host mode. As described in USB 2.0 protocol, SOF
packets are generated (by the host controller or hub transaction translator) every 1ms in full-
speed links.
Once that USBFS entered into enabled state, it will send the SOF packet periodically and the
period is defined in USB 2.0 protocol. In addition, application may adjust the length of a frame
by writing FRI field in USBFS_HFT registers. The FRI bits define the number of USB clock
cycles in a frame, so its value should be calculated based on the frequency of USB clock
which is used by USBFS. The FRT field bits show that the remaining clock cycles of the
current frame and it stops changing during suspend state.
USBFS is able to generate a pulse signal for each SOF packet and output it to a pin. The
pulse length is 16 HCLK cycles. If application desires to use this function, it needs to set
SOFOEN bit in USBFS_GCCFG register and configure the related pin registers in GPIO.
USB Channels and Transactions
USBFS includes 8 independent channels in host mode. Each channel is able to communicate
with an endpoint in USB device. The transfer type, direction, packet length and other
information are all configured in channel related registers such as USBFS_HCHxCTL and
USBFS_HCHxLEN.
USBFS supports all the four types of transfer: control, bulk, interrupt and isochronous. USB
2.0 protocol divides these transfers into 2 kinds: non-periodic transfer (control and bulk) and
periodic transfer (interrupt and isochronous). Based on this, USBFS includes two request
queues: periodic request queue and non-periodic request queue, to perform efficient
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 ...