RM0008
Reception byte count n (USB_COUNTn_RX)
Address offset: [USB_BTABLE] + n*16 + 12
USB local Address: [USB_BTABLE] + n*8 + 6
15
14
13
BLSIZE
NUM_BLOCK[4:0]
rw
rw
rw
This table location is used to store two different values, both required during packet
reception. The most significant bits contains the definition of allocated buffer size, to allow
buffer overflow detection, while the least significant part of this location is written back by the
USB peripheral at the end of reception to give the actual number of received bytes. Due to
the restrictions on the number of available bits, buffer size is represented using the number
of allocated memory blocks, where block size can be selected to choose the trade-off
between fine-granularity/small-buffer and coarse-granularity/large-buffer. The size of
allocated buffer is a part of the endpoint descriptor and it is normally defined during the
enumeration process according to its maxPacketSize parameter value (See "Universal
Serial Bus Specification").
Bit 15 BL_SIZE: BLock size
– If BL_SIZE=0, the memory block is 2 byte large, which is the minimum block allowed in a
– If BL_SIZE=1, the memory block is 32 byte large, which allows to reach the maximum
Bits 14:10 NUM_BLOCK[4:0]: Number of blocks
Bits 9:0 COUNTn_RX[9:0]: Reception byte count
Note:
Double-buffered and Isochronous IN Endpoints have two USB_COUNTn_TX registers:
named USB_COUNTn_TX_1 and USB_COUNTn_TX_0 with the following content.
31
30
29
BLSIZE
NUM_BLOCK_1[4:0]
_1
rw
rw
rw
15
14
13
BLSIZE
NUM_BLOCK_0[4:0]
_0
rw
rw
rw
12
11
10
9
rw
rw
rw
r
This bit selects the size of memory block used to define the allocated buffer area.
word-wide memory. With this block size the allocated buffer size ranges from 2 to 62 bytes.
packet length defined by USB specifications. With this block size the allocated buffer size
ranges from 32 to 1024 bytes, which is the longest packet size allowed by USB standard
specifications.
These bits define the number of memory blocks allocated to this packet buffer. The actual
amount of allocated memory depends on the BL_SIZE value as illustrated in
These bits contain the number of bytes received by the endpoint associated with the
USB_EPnR register during the last OUT/SETUP transaction addressed to it.
28
27
26
25
rw
rw
rw
r
12
11
10
9
rw
rw
rw
r
Universal serial bus full-speed device interface (USB)
8
7
6
r
r
r
24
23
22
COUNTn_RX_1[9:0]
r
r
r
8
7
6
COUNTn_RX_0[9:0]
r
r
r
DocID13902 Rev 15
5
4
3
2
COUNTn_RX[9:0]
r
r
r
r
21
20
19
18
r
r
r
r
5
4
3
2
r
r
r
r
1
0
r
r
Table
177.
17
16
r
r
1
0
r
r
642/1128
644
Need help?
Do you have a question about the STM32F101 series and is the answer not in the manual?
Questions and answers