
AT32F413
Series Reference Manual
2022.06.27
Page 319
Rev 2.00
21
Universal serial bus full-seed device
interface (USBFS)
21.1 USBFS introduction
The USBFS implements the USB2.0 full-speed protocols. The bus speed is 12 Mb/s. It supports control
transfer, bulk transfer, synchronous transfer and interrupt transfer, as well as USB suspend/resume.
The USBFS has eight programmable bidirectional endpoints that can be configured as different types of
transfers according to specific requirements. It contains a SRAM with dual endpoints for data exchange
between the endpoint and user application. In the meantime, it has achieved a dual-buffer mechanism
for bulk/synchronous endpoints in order to enhance the transfer efficiency.
21.2 USBFS clock and pin configuration
21.2.1 USB clock configuration
The USB full-speed device module interface has two clocks: USB control clock and APB1 bus clock.
The USB full-speed device bus speed standard is 12 Mb/s
±
0.25%, so it is necessary to supply 48MHz
±
0.25% for the USBFS to implement USB bus sampling.
USBFS 48M clock has two sources:
HICK 48M
When the HICK 48M clock is used as a USB control clock, it is recommended to enable ACC feature.
Divided by PLL
The PLL output frequency must ensure that the USBDIV (see the CRM_CFG register) can be
divided to 48MHz.
Note: The APB1 clock frequency must be greater than 12MHz when the USBFS is enabled.
21.2.2 USB pin configuration
When the USB module is enabled in the CRM, PA11 and PA12 can be multiplexed as DP/DM;
When the USB module is enabled in the CRM and PA8 is configured as the push-pull output, the PA8
can be used as an alternate function of SOF output.
Pin
GPIO
Condition
USB_DM
PA11
USB module enabled in the CRM
USB_DP
PA12
USB module enabled in the CRM
USB_SOF
PA8
Optional. If the USB module is enabled in the CRM, the SOF
output feature is enabled, and the PA8 is configured as a
push-pull output.
21.3 USBFS functional description
21.3.1 USB initialization
After the USB module is enabled (enalbe USBFS clock in the CRM), it is necessary to initialize the
USBFS prior to the host enumeration as follows:
1.
Clear software set by setting CSRST = 0
2.
Clear all status flags by setting INTSTS=0
3.
Enable USB Core by setting DEVADDR.CEN=1
4.
Configure interrupt enable bits
5.
Enable USB PHY by setting CTRL.DISUSB=0