09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

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.

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

d) The OTG_HS host generates the CHH interrupt after successfully transmitting the<br />

start split IN token.<br />

e) In response to the CHH interrupt, set the COMPLSPLT bit in HCSPLT2 to send the<br />

complete split.<br />

f) As soon as the packet is received successfully, the OTG_HS host starts writing the<br />

data to the system memory.<br />

g) The OTG_HS host generates the CHH interrupt after transferring the received<br />

data to the system memory. In response to the CHH interrupt, de-allocate the<br />

channel or reinitialize the channel for the next start split.<br />

31.13.6 Device programming model<br />

Endpoint initialization on USB reset<br />

1. Set the NAK bit for all OUT endpoints<br />

– SNAK = 1 in OTG_HS_DOEPCTLx (for all OUT endpoints)<br />

2. Unmask the following interrupt bits<br />

– INEP0 = 1 in OTG_HS_DAINTMSK (control 0 IN endpoint)<br />

– OUTEP0 = 1 in OTG_HS_DAINTMSK (control 0 OUT endpoint)<br />

– STUP = 1 in DOEPMSK<br />

– XFRC = 1 in DOEPMSK<br />

– XFRC = 1 in DIEPMSK<br />

– TOC = 1 in DIEPMSK<br />

3. Set up the Data FIFO RAM for each of the FIFOs<br />

– Program the OTG_HS_GRXFSIZ register, to be able to receive control OUT data<br />

and setup data. If thresholding is not enabled, at a minimum, this must be equal to<br />

1 max packet size of control endpoint 0 + 2 DWORDs (for the status of the control<br />

OUT data packet) + 10 DWORDs (for setup packets).<br />

– Program the OTG_HS_TX0FSIZ register (depending on the FIFO number chosen)<br />

to be able to transmit control IN data. At a minimum, this must be equal to 1 max<br />

packet size of control endpoint 0.<br />

4. Program the following fields in the endpoint-specific registers for control OUT endpoint<br />

0 to receive a SETUP packet<br />

– STUPCNT = 3 in OTG_HS_DOEPTSIZ0 (to receive up to 3 back-to-back SETUP<br />

packets)<br />

5. In DMA mode, the DOEPDMA0 register should have a valid memory address to store<br />

any SETUP packets received.<br />

At this point, all initialization required to receive SETUP packets is done.<br />

Doc ID 018909 Rev 3 1286/1416

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

Saved successfully!

Ooh no, something went wrong!