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.

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

RM0008<br />

1. Program the characteristics of the required endpoint into the following fields of the<br />

OTG_FS_DIEPCTLx register (for IN or bidirectional endpoints) or the<br />

OTG_FS_DOEPCTLx register (for OUT or bidirectional endpoints).<br />

– Maximum packet size<br />

– USB active endpoint = 1<br />

– Endpoint start data toggle (for interrupt <strong>and</strong> bulk endpoints)<br />

– Endpoint type<br />

– TxFIFO number<br />

2. Once the endpoint is activated, the core starts decoding the tokens addressed to that<br />

endpoint <strong>and</strong> sends out a valid h<strong>and</strong>shake for each valid token received for the<br />

endpoint.<br />

Endpoint deactivation<br />

This section describes the steps required to deactivate an existing endpoint.<br />

1. In the endpoint to be deactivated, clear the USB active endpoint bit in the<br />

OTG_FS_DIEPCTLx register (for IN or bidirectional endpoints) or the<br />

OTG_FS_DOEPCTLx register (for OUT or bidirectional endpoints).<br />

2. Once the endpoint is deactivated, the core ignores tokens addressed to that endpoint,<br />

which results in a timeout on the USB.<br />

Note: 1 The application must meet the following conditions to set up the device core to h<strong>and</strong>le traffic:<br />

NPTXFEM <strong>and</strong> RXFLVLM in GINTMSK must be cleared.<br />

26.15.6 Operational model<br />

SETUP <strong>and</strong> OUT data transfers<br />

This section describes the internal data flow <strong>and</strong> application-level operations during data<br />

OUT transfers <strong>and</strong> SETUP transactions.<br />

● Packet read<br />

This section describes how to read packets (OUT data <strong>and</strong> SETUP packets) from the<br />

receive FIFO in Slave mode.<br />

1. On catching an RXFLVL interrupt (OTG_FS_GINTSTS register), the application must<br />

read the Receive status pop register (OTG_FS_GRXSTSP).<br />

2. The application can mask the RXFLVL interrupt (in OTG_FS_GINTSTS) by writing to<br />

RXFLVL = 0 (in GINTMSK), until it has read the packet from the receive FIFO.<br />

3. If the received packet’s byte count is not 0, the byte count amount of data is popped<br />

from the receive Data FIFO <strong>and</strong> stored in memory. If the received packet byte count is<br />

0, no data is popped from the receive data FIFO.<br />

4. The receive FIFO’s packet status readout indicates one of the following:<br />

a) Global OUT NAK pattern:<br />

PKTSTS = Global OUT NAK, BCNT = 0x000, EPNUM = Don’t Care (0x0),<br />

DPID = Don’t Care (0b00).<br />

These data indicate that the global OUT NAK bit has taken effect.<br />

b) SETUP packet pattern:<br />

PKTSTS = SETUP, BCNT = 0x008, EPNUM = Control EP Num, DPID = D0.<br />

These data indicate that a SETUP packet for the specified endpoint is now<br />

available for reading from the receive FIFO.<br />

812/995 Doc ID 13902 Rev 9

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

Saved successfully!

Ooh no, something went wrong!