
AT32F413
Series Reference Manual
2022.06.27
Page 320
Rev 2.00
21.3.2 Endpoint configuration
The USBFS supports up to 8 bidirectional and 16 unidirectional endpoints (8 IN and 8 OUT). Each point
has its corresponding USBFS endpoint N register (USBFS_EPTn) that is used to store the endpoint
status. The endpoint configuration includes:
Endpoint number (by configuring the EPTADDR, the endpoint number of each endpoint register
is programmable)
Transfer type (control transfer, bulk transfer, isochronous transfer and interrupt transfer)
Buffer for IN/OUT endpoint (buffer allocation is described in the next section)
IN/OUT Toggle status (correspond to DATA0/DATA1)
IN/OUT status (VALID, NAK, STALL, DISABLE)
Note: Endpoint 0 acts as a control point by default. It is usually configuread after receiving a reset
signal from the host.
21.3.3 USB buffer
USB has a dual-port SRAM buffer for data exchange between endpoint and user application. Both the
user application and the USBFS module can access to the buffer at the same time. The buffer size can
be automatically adjusted according to the CAN status.
lists its mapping address and size.
Table 21-1
Buffer size configuration table
Working
conditions
USBBUFS
0
1
CAN1 status Enable/Disable Disable
Disable
Enable
Enable
CAN2 status Enable/Disable Disable
Enable
Disable
Enable
Buffer size
512 Byte
1280 Byte
1024 Byte
1024 Byte
768 Byte
Address range
0x4000 6000~
0x4000 63FF
0x4000 7800~
0x4000 81FF
0x4000 7800~
0x4000 7FFF
0x4000 7800~
0x4000 7FFF
0x4000 7800~
0x4000 7DFF
The buffer area is composed of the endpoint register buffer description field and the endpoint buffer. The
endpoint register description table lists the offset address of endpoint receive/transmit. The figure below
gives an example of a buffer structure (512 bytes)
Start address: 0x40006000
Endpoint 0 register buffer
description field
Endpoint 1 register buffer
description field
Endpoint 7 register buffer
description field
Endpoint 0 register transmit buffer
Endpoint 0 register receive buffer
Endpoint 7 register transmit buffer
Endpoint 7 register receive buffer
512 Byte