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

1. Program the OTG_HS_DOEPTSIZx register.<br />

– STUPCNT = 3<br />

2. Wait for the RXFLVL interrupt (OTG_HS_GINTSTS) and empty the data packets from<br />

the receive FIFO.<br />

3. Assertion of the STUP interrupt (OTG_HS_DOEPINTx) marks a successful completion<br />

of the SETUP Data Transfer.<br />

– On this interrupt, the application must read the OTG_HS_DOEPTSIZx register to<br />

determine the number of SETUP packets received and process the last received<br />

SETUP packet.<br />

Figure 395. Processing a SETUP packet<br />

setup_np_in_pkt<br />

Data IN phase<br />

Wait for STUP in OTG_FS_DOEPINTx<br />

rem_supcnt =<br />

rd_reg(DOEPTSIZx)<br />

setup_cmd[31:0] = mem[4 – 2 * rem_supcnt]<br />

setup_cmd[63:32] = mem[5 – 2 * rem_supcnt]<br />

Read<br />

Find setup cmd type<br />

ctrl-rd/wr/2 stage<br />

2-stage<br />

setup_np_in_pkt<br />

Status IN phase<br />

● Handling more than three back-to-back SETUP packets<br />

Per the USB 2.0 specification, normally, during a SETUP packet error, a host does not send<br />

more than three back-to-back SETUP packets to the same endpoint. However, the USB 2.0<br />

specification does not limit the number of back-to-back SETUP packets a host can send to<br />

the same endpoint. When this condition occurs, the OTG_HS controller generates an<br />

interrupt (B2BSTUP in OTG_HS_DOEPINTx).<br />

● Setting the global OUT NAK<br />

Internal data flow:<br />

1. When the application sets the Global OUT NAK (SGONAK bit in OTG_HS_DCTL), the<br />

core stops writing data, except SETUP packets, to the receive FIFO. Irrespective of the<br />

space availability in the receive FIFO, nonisochronous OUT tokens receive a NAK<br />

handshake response, and the core ignores isochronous OUT data packets<br />

2. The core writes the Global OUT NAK pattern to the receive FIFO. The application must<br />

reserve enough receive FIFO space to write this data pattern.<br />

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

Write<br />

rcv_out_pkt<br />

Data OUT phase<br />

ai15678

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

Saved successfully!

Ooh no, something went wrong!