29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Universal serial bus full-speed device interface (USB)<br />

RM0008<br />

Table 152.<br />

Double-buffering buffer flag definition<br />

Buffer flag ‘Transmission’ endpoint ‘Reception’ endpoint<br />

DTOG DTOG_TX (USB_EPnRbit 6) DTOG_RX (USB_EPnRbit 14)<br />

SW_BUF USB_EPnR bit 14 USB_EPnR bit 6<br />

The memory buffer which is currently being used by the USB peripheral is defined by DTOG<br />

buffer flag, while the buffer currently in use by application software is identified by SW_BUF<br />

buffer flag. The relationship between the buffer flag value <strong>and</strong> the used packet buffer is the<br />

same in both cases, <strong>and</strong> it is listed in the following table.<br />

Table 153.<br />

Bulk double-buffering memory buffers usage<br />

Endpoint<br />

Type<br />

DTOG SW_BUF<br />

Packet buffer used by USB<br />

Peripheral<br />

Packet buffer used by<br />

Application Software<br />

0 1<br />

ADDRn_TX_0 / COUNTn_TX_0<br />

Buffer description table locations.<br />

ADDRn_TX_1 / COUNTn_TX_1<br />

Buffer description table locations.<br />

IN<br />

1 0<br />

ADDRn_TX_1 / COUNTn_TX_1<br />

Buffer description table locations<br />

0 0 None (1)<br />

ADDRn_TX_0 / COUNTn_TX_0<br />

Buffer description table locations.<br />

ADDRn_TX_0 / COUNTn_TX_0<br />

Buffer description table locations.<br />

1 1 None (1) ADDRn_TX_0 / COUNTn_TX_0<br />

Buffer description table locations.<br />

0 1<br />

ADDRn_RX_0 / COUNTn_RX_0<br />

Buffer description table locations.<br />

ADDRn_RX_1 / COUNTn_RX_1<br />

Buffer description table locations.<br />

OUT<br />

1 0<br />

ADDRn_RX_1 / COUNTn_RX_1<br />

Buffer description table locations.<br />

ADDRn_RX_0 / COUNTn_RX_0<br />

Buffer description table locations.<br />

0 0 None (1) ADDRn_RX_0 / COUNTn_RX_0<br />

Buffer description table locations.<br />

1 1 None (1) ADDRn_RX_1 / COUNTn_RX_1<br />

Buffer description table locations.<br />

1. Endpoint in NAK Status.<br />

Double-buffering feature for a bulk endpoint is activated by:<br />

● Writing EP_TYPE bit field at ‘00’ in its USB_EPnR register, to define the endpoint as a<br />

bulk, <strong>and</strong><br />

● Setting EP_KIND bit at ‘1’ (DBL_BUF), in the same register.<br />

The application software is responsible for DTOG <strong>and</strong> SW_BUF bits initialization according<br />

to the first buffer to be used; this has to be done considering the special toggle-only property<br />

that these two bits have. The end of the first transaction occurring after having set<br />

DBL_BUF, triggers the special flow control of double-buffered bulk endpoints, which is used<br />

for all other transactions addressed to this endpoint until DBL_BUF remain set. At the end of<br />

each transaction the CTR_RX or CTR_TX bit of the addressed endpoint USB_EPnR<br />

register is set, depending on the enabled direction. At the same time, the affected DTOG bit<br />

in the USB_EPnR register is hardware toggled making the USB peripheral buffer swapping<br />

completely software independent. Unlike common transactions, <strong>and</strong> the first one after<br />

522/995 Doc ID 13902 Rev 9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!