499
/
838
Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
accesses the Packet Buffer Memory, first find the location of the buffer description table in the Packet Buffer Memory
through the USB_BUFTAB register. The value of the USB_BUFTAB register indicates the starting address of the
buffer description table, which must be within the memory range of the Packet Buffer Memory and be 8-byte aligned.
If only endpoint 0 and endpoint 1 are used, the buffer description table only needs 16 bytes. If only endpoint 0 and
endpoint 7 are used, the buffer description table needs 64 bytes. Although endpoint 1 to endpoint 6 are not used, but
The description table of endpoint 7 starts from 56 bytes, so it will occupy 64 bytes of space.
User application access Packet Buffer Memory
The user application program on the microcontroller needs to access the Packet Buffer Memory from the APB1 bus
according to 32-bit alignment and 16-bit read and write access, that is, the address of the operation data must be 32-
bit aligned, and only 16-bit data can be read or written at a time, can't be 8-bit nor 32-bit. Figure 19-2 shows the way
in which the user application program on the microcontroller and the USB module accesses the Packet Buffer
Memory.
Figure 19-2 The user applications on the microcontrollers and the USB modules access Packet Buffer Memory
19.4.2
Buffer description table
The buffer description table defines the buffer address, size and the number of bytes to be transmitted for the endpoint
used in the communication process. Each endpoint corresponds to two endpoint data packet buffers, one for sending
and one for receiving. These endpoint packet buffers can be stored anywhere in the entire Packet Buffer Memory,
and the buffer description table is also located in the Packet Buffer Memory, whose starting address is determined by
the USB_BUFTAB register.
The buffer description table has a total of 8 entries, each entry corresponds to an endpoint register, each register has
two directions of sending and receiving, and each direction requires two 16-bit word buffer description tables, so
each table items consist of four 16-bit words, so the start address of the buffer description table must be 8-byte aligned.
Endpoint packet buffers for unused endpoints or in the unused direction of a used endpoint may be used for other
purposes. The relationship between the buffer description table and the endpoint packet buffer is shown in Figure
Packet Buffer Memory
Filling
Filling
Filling
Filling
Filling
Data
Data
Data
Data
Data
0
4
8
12
16
APB1
bus
0
2
4
6
8
USB
module