
AT32F413
Series Reference Manual
2022.06.27
Page 321
Rev 2.00
In the USBFS module, each endpoint register corresponds to a buffer description field, which is used to
describe the buffer area and data length of the endpoint receive/transmit. A general structure of an
endpoint register buffer description field is shown as follows (dual buffer description table is detailed in
the next section):
Endpoint n:
0
2
4
6
8
10
12
14
TnADDR
Reserved
TnLEN
Reserved RnADDR
Reserved
RnLEN
Reserved
Transmit buffer description
Buffer receive description
The start address of a buffer description field=buffer a BTADDR*2. The user application can put
the endpoint register buffer description in different locations according to the specific needs. The
BTADDR is 0 by default.
The USBFS module contains 8 endpoint registers. Each endpoint register description table acutally
occupies 8 bytes. When programming, the user should reserve enough space for buffer description field
according to the endpoint register used. While allocating transmit/receive buffer to the endpoint, the
offset address is not allowed to occupy the buffer description and transmit/receive buffer area of other
endpoints.
Note: The APB1 bus width is 32 bits, while the buffer is 16-bit wide memory, meaning that the APB1 bus
can write only two-byte data to a packet buffer each time. For this reason, 8 consecutive write accesses
are required when a 16-byte data is to be written.
21.3.4 Double-buffered endpoints
Double-buffered mode is designed in the USBFS module in order to increase the transaction rate of bulk
transfer and isochronous transfer.
One IN endpoint (or OUT endpoint) corresponds to two buffers.
buffer description table between regular endpoint and double-buffered endpoint.
Figure 21-1
Buffer description table of regular endpoint vs. double-buffered endpoint
Endpoint 1
USB_T1ADDR
USB_T1LEN
USB_R1ADDR
USB_R1LEN
Double-
buffered
IN endoint 1
USB_T1ADDR_0
USB_T1LEN_0
Double-buffered
OUT endpoint 1
USB_R1ADDR_1
USB_R1LEN_1
USB_T1ADDR_1
USB_T1LEN_1
USB_R1ADDR_0
USB_R1LEN_0
(a)
(b)
(c)
There are two endpoint transfer modes supporting double-buffered function:
Bulk transfer endpoints
Enable double-buffered feature by setting TRANS_TPYE=00 and EXF=1
Isochronous transfer endpoints
When TRANS_TPYE=10, double-buffered feature is enabled.
Two buffers are used to increase the transfer rate. The USBFS and the user application can access
to the different buffer at the same time and process data simultaneously. The USBFS and the user
application must determine which one of the existing buffers is accessible, which can be indicated
by the SBUF flag in the USBFS.
Double-buffered OUT endpoint:
SBUF corresponds to bit 6 in the USB_EPTn