09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>RM0090</strong> USB on-the-go full-speed (OTG_FS)<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: The application must meet the following conditions to set up the device core to handle traffic:<br />

NPTXFEM and RXFLVLM in the OTG_FS_GINTMSK register must be cleared.<br />

30.17.6 Operational model<br />

SETUP and OUT data transfers<br />

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

OUT transfers and SETUP transactions.<br />

● Packet read<br />

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

receive FIFO.<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 OTG_FS_GINTMSK), until it has read the packet from the receive<br />

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 and 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 />

c) Setup stage done pattern:<br />

PKTSTS = Setup Stage Done, BCNT = 0x0, EPNUM = Control EP Num,<br />

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

These data indicate that the Setup stage for the specified endpoint has completed<br />

and the Data stage has started. After this entry is popped from the receive FIFO,<br />

the core asserts a Setup interrupt on the specified control OUT endpoint.<br />

d) Data OUT packet pattern:<br />

PKTSTS = DataOUT, BCNT = size of the received data OUT packet (0 ≤ BCNT<br />

≤ 1 024), EPNUM = EPNUM on which the packet was received, DPID = Actual<br />

Data PID.<br />

e) Data transfer completed pattern:<br />

PKTSTS = Data OUT Transfer Done, BCNT = 0x0, EPNUM = OUT EP Num<br />

on which the data transfer is complete, DPID = Don’t Care (0b00).<br />

These data indicate that an OUT data transfer for the specified OUT endpoint has<br />

Doc ID 018909 Rev 3 1130/1416

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

Saved successfully!

Ooh no, something went wrong!