
GD32F403xx User Manual
647
4. When the request entry reaches the top of the request queue, USBFS begins to process
this request entry. If bus time for the transaction indicated by the request entry is enough,
USBFS starts the OUT transaction on USB bus.
5. When the OUT transaction indicated by the request entry has been finished on USB bus,
PCNT in USBFS_HCHxLEN register is decreased b y 1. If the transaction is f inished
successfully (ACK handshake received), the ACK flag is triggered. Otherwise, the status
f lag (NAK) reports the transaction result.
6. If the OUT transaction described in step 5 is successful and PCNT is larger than 1 in
step2, return to step 3 and continues to send the remaining packets. If the OUT
transaction described in step 5 is not successful, return to step 3 to resend the packet
again.
7. Af ter all the transactions in a transf er are successfully sent on USB bus, USBFS
generates TF f lag to indicate that the transfer successfully finishes.
8. Disable the channel. Now the channel is in IDLE state and is ready for other transfers.
Device 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, USBFS_DIEPxTFLEN
register to configure the data FIFOs according to application’s demand.
5. Program USBFS_GINTEN register to enable Mode Fault, Suspend, SOF, Enumeration
Done and USB Reset interrupt, and then, set GINTEN bit in USBFS_GAHBCS register
to enable global interrupt.
6.
Program USBFS_DCFG register according to application’s demand, such as the device
address, etc.
7. Af ter the device is connected to a host, the host will perform port reset on USB bus and
this will trigger the RST interrupt in USBFS_GINTF register.
8. Wait f or ENUMF interrupt in USBFS_GINTF register.
Endpoint initialization and enable sequence
1. Program USBFS_DIEPxCTL or USBFS_DOEPxCTL register with desired transfer type,
packet size, etc.
2. Program USBFS_DIEPINTEN or USBFS_DOEPINTEN register. Set the desired interrupt
Содержание GD32F403 Series
Страница 1: ...GigaDevice Semiconductor Inc GD32F403xx Arm Cortex M4 32 bit MCU User Manual Revision 2 6 Jul 2022 ...
Страница 177: ...GD32F403xx UserManual 177 Peripheral Channel 0 Channel 1 Channel 2 Channel 3 Channel 4 SDIO SDIO ...
Страница 217: ...GD32F403xx UserManual 217 ensures that no conversion is in progress ...