DocID025202 Rev 7
RM0365
Universal serial bus full-speed device interface (USB)
1036
Figure 394. Packet buffer areas with examples of buffer description table locations
Each packet buffer is used either during reception or transmission starting from the bottom.
The USB peripheral will never change the contents of memory locations adjacent to the
allocated memory buffers; if a packet bigger than the allocated buffer length is received
(buffer overrun condition) the data will be copied to the memory only up to the last available
location.
Endpoint initialization
The first step to initialize an endpoint is to write appropriate values to the
ADDRn_TX/ADDRn_RX registers so that the USB peripheral finds the data to be
transmitted already available and the data to be received can be buffered. The EP_TYPE
bits in the USB_EPnR register must be set according to the endpoint type, eventually using
the EP_KIND bit to enable any special required feature. On the transmit side, the endpoint
must be enabled using the STAT_TX bits in the USB_EPnR register and COUNTn_TX must
be initialized. For reception, STAT_RX bits must be set to enable reception and
COUNTn_RX must be written with the allocated buffer size using the BL_SIZE and
NUM_BLOCK fields. Unidirectional endpoints, except Isochronous and double-buffered bulk
endpoints, need to initialize only bits and registers related to the supported direction. Once
the transmission and/or reception are enabled, register USB_EPnR and locations
ADDRn_TX/ADDRn_RX, COUNTn_TX/COUNTn_RX (respectively), should not be modified
by the application software, as the hardware can change their value on the fly. When the
data transfer operation is completed, notified by a CTR interrupt event, they can be
accessed again to re-enable a new operation.
06Y9
B(
&2817B7;B
$''5B7;B
&2817B7;B
$''5B7;B
&2817B5;B
$''5B5;B
&2817B5;B
$''5B5;B
&2817B5;
$''5B5;
&2817B7;
$''5B7;
&2817B5;
$''5B5;
&2817B7;
$''5B7;
B&
B$
B
B
B
B
B
B(
B&
B$
B
B
B
B
B
%XIIHUGHVFULSWLRQWDEOHORFDWLRQV
%XIIHUIRU
GRXEOHEXIIHUHG
,1(QGSRLQW
%XIIHUIRU
GRXEOHEXIIHUHG
287(QGSRLQW
7UDQVPLVVLRQ
EXIIHUIRU
VLQJOHEXIIHUHG
(QGSRLQW
5HFHSWLRQEXIIHU
IRU
(QGSRLQW
7UDQVPLVVLRQ
EXIIHUIRU
(QGSRLQW
3DFNHWEXIIHUV