
AT32F413
Series Reference Manual
2022.06.27
Page 322
Rev 2.00
When SBUF=1, USBFS uses RnADDR_0 and RnLEN_0, while the user application uses
RnADDR_1 and RnLEN_1;
When SBUF=0, USBFS uses RnADDR_1 and RnLEN_1, while the user application uses
RnADDR_0 and RnLEN_0
Double-buffered IN endpoint:
SBUF corresponds to bit 14 in the USB_EPTn
When SBUF=1, USBFS uses TnADDR_0 and TnLEN_0, while the user application uses
TnADDR_1 and TnLEN_1
When SBUF=0, USBFS uses TnADDR_1 and TnLEN_1, while the user application uses
TnADDR_0 and TnLEN_0
Note: Endpoint 0 cannot be used as a double -buffered endpoint.
21.3.5 SOF output
A SOF flag is generated when the USBFS receives a SOF sent by the host. Meanwhile, the current
frame number can be read from the USBFS_SOFRNUM register. By setting the SOFOUTEN bit in the
USBFS_CFG register, a SOF pulse sigal with a width of 24 APB1 clock cycles will be output onto the
pin.
21.3.6 Suspend/Resume
The USB2.0 full-speed standard defines a low-power state, called Suspend. A Suspend state is entered
when the idle state is detected on the bus for more than 3ms. The USBFS can enter suspend state in
two ways:
1.
Detect the lack of three consecutive SOF packets
2.
Control register SSP is set by the application
When the device detects the lack of three consecutive SOF packets, the SSP and LPM registers must
be set by the application in order to disable SOF detection and the statistic power consumtion of the
USB physical transceiver.
Resume refers to a process when the USB device returns from a suspend state to a normal state. When
the USB device is in suspend mode, any non-idle state (such as packet start signal SOF) of its upstream
port can resume it. In addition, the USB device can also apply to activate resume operation by setting
the GRESUME register, which is called a remote wakeup.
21.4 USB interrupts
Low-priority interrupts:
interrupt vector number 20 and 74. When a high-priority interrupt is disabled,
all the USBFS interrupts can be handled by low-priority interrupts.
High-priority interrupts:
interrupt vector number 19 and 73. Only isochronous transfer and double-
buffered bulk endpoints can trigger high-priority interrupts.
USB wakeup interrupts:
interrupt vector number 42. While the USB enters a suspend state, the chip
can be waken up by this interrupt after moving to Deep Sleep mode.
By default, the USBFS shares the interrupt vector number (19 and 20) with the CAN1, causing that the
USBFS and CAN1 cannot be used at the same time. For this reason, new interrupt vector numbers (73
and 74) are created. The user application can map the USBFS interrupt vector numbers to 73 and 74 by
setting the USBINTMAP bit in the CRM_INTMAP register.
21.5 USBFS registers
These peripheral registers must be accessed by words (32 bits).
Table 21-2
USBFS register map and reset values
Register
Offset
Reset value
USBFS_EPT0
0x00
0x0000
USBFS_EPT1
0x04
0x0000
USBFS_EPT2
0x008
0x0000
USBFS_EPT3
0x0C
0x0000