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.

RM0008<br />

USB on-the-go full-speed (OTG_FS)<br />

Endpoint initialization on enumeration completion<br />

1. On the Enumeration Done interrupt (ENUMDNE in OTG_FS_GINTSTS), read the<br />

OTG_FS_DSTS register to determine the enumeration speed.<br />

2. Program the MPSIZ field in OTG_FS_DIEPCTL0 to set the maximum packet size. This<br />

step configures control endpoint 0. The maximum packet size for a control endpoint<br />

depends on the enumeration speed.<br />

At this point, the device is ready to receive SOF packets <strong>and</strong> is configured to perform control<br />

transfers on control endpoint 0.<br />

Endpoint initialization on SetAddress comm<strong>and</strong><br />

This section describes what the application must do when it receives a SetAddress<br />

comm<strong>and</strong> in a SETUP packet.<br />

1. Program the OTG_FS_DCFG register with the device address received in the<br />

SetAddress comm<strong>and</strong><br />

1. Program the core to send out a status IN packet<br />

Endpoint initialization on SetConfiguration/SetInterface comm<strong>and</strong><br />

This section describes what the application must do when it receives a SetConfiguration or<br />

SetInterface comm<strong>and</strong> in a SETUP packet.<br />

1. When a SetConfiguration comm<strong>and</strong> is received, the application must program the<br />

endpoint registers to configure them with the characteristics of the valid endpoints in<br />

the new configuration.<br />

2. When a SetInterface comm<strong>and</strong> is received, the application must program the endpoint<br />

registers of the endpoints affected by this comm<strong>and</strong>.<br />

3. Some endpoints that were active in the prior configuration or alternate setting are not<br />

valid in the new configuration or alternate setting. These invalid endpoints must be<br />

deactivated.<br />

4. Unmask the interrupt for each active endpoint <strong>and</strong> mask the interrupts for all inactive<br />

endpoints in the OTG_FS_DAINTMSK register.<br />

5. Set up the Data FIFO RAM for each FIFO.<br />

6. After all required endpoints are configured; the application must program the core to<br />

send a status IN packet.<br />

At this point, the device core is configured to receive <strong>and</strong> transmit any type of data packet.<br />

Endpoint activation<br />

This section describes the steps required to activate a device endpoint or to configure an<br />

existing device endpoint to a new type.<br />

Doc ID 13902 Rev 9 811/995

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

Saved successfully!

Ooh no, something went wrong!