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.

USB on-the-go high-speed (OTG_HS) <strong>RM0090</strong><br />

Examples<br />

This section describes and depicts some fundamental transfer types and scenarios.<br />

● Slave mode bulk OUT transaction<br />

Figure 396 depicts the reception of a single Bulk OUT Data packet from the USB to the AHB<br />

and describes the events involved in the process.<br />

Figure 396. Slave mode bulk OUT transaction<br />

Host USB Device<br />

2<br />

OUT<br />

512 bytes<br />

ACK<br />

OUT<br />

NAK<br />

5<br />

RXFLVL iintr<br />

After a SetConfiguration/SetInterface command, the application initializes all OUT endpoints<br />

by setting CNAK = 1 and EPENA = 1 (in OTG_HS_DOEPCTLx), and setting a suitable<br />

XFRSIZ and PKTCNT in the OTG_HS_DOEPTSIZx register.<br />

1. Host attempts to send data (OUT token) to an endpoint.<br />

2. When the core receives the OUT token on the USB, it stores the packet in the RxFIFO<br />

because space is available there.<br />

3. After writing the complete packet in the RxFIFO, the core then asserts the RXFLVL<br />

interrupt (in OTG_HS_GINTSTS).<br />

4. On receiving the PKTCNT number of USB packets, the core internally sets the NAK bit<br />

for this endpoint to prevent it from receiving any more packets.<br />

5. The application processes the interrupt and reads the data from the RxFIFO.<br />

6. When the application has read all the data (equivalent to XFRSIZ), the core generates<br />

an XFRC interrupt (in OTG_HS_DOEPINTx).<br />

7. The application processes the interrupt and uses the setting of the XFRC interrupt bit<br />

(in OTG_HS_DOEPINTx) to determine that the intended transfer is complete.<br />

1297/1416 Doc ID 018909 Rev 3<br />

3<br />

xact_1<br />

DOEPCTLx.NAK=1<br />

PKTCNT 0<br />

7<br />

1<br />

4<br />

XFRSIZ = 0<br />

r<br />

XFRC<br />

intr<br />

8<br />

Application<br />

init_out_ep<br />

wr_reg(DOEPTSIZx)<br />

6<br />

wr_reg(DOEPCTLx)<br />

idle until intr<br />

rcv_out _pkt()<br />

idle until intr<br />

XFRSIZ = 512 bytes<br />

PKTCNT = 1<br />

EPENA = 1<br />

CNAK = 1<br />

On new xfer<br />

or RxFIFO<br />

not empty<br />

ai15679

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

Saved successfully!

Ooh no, something went wrong!