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 high-speed (OTG_HS)<br />

31.13.3 Device initialization<br />

The application must perform the following steps to initialize the core as a device on powerup<br />

or after a mode change from host to device.<br />

1. Program the following fields in the OTG_HS_DCFG register:<br />

– Device speed<br />

– Nonzero-length status OUT handshake<br />

2. Program the OTG_HS_GINTMSK register to unmask the following interrupts:<br />

– USB reset<br />

– Enumeration done<br />

– Early suspend<br />

– USB suspend<br />

– SOF<br />

3. Program the VBUSBSEN bit in the OTG_HS_GCCFG register to enable VBUS sensing<br />

in “B” peripheral mode and supply the 5 volts across the pull-up resistor on the DP line.<br />

4. Wait for the USBRST interrupt in OTG_HS_GINTSTS. It indicates that a reset has been<br />

detected on the USB that lasts for about 10 ms on receiving this interrupt.<br />

Wait for the ENUMDNE interrupt in OTG_HS_GINTSTS. This interrupt indicates the end of<br />

reset on the USB. On receiving this interrupt, the application must read the OTG_HS_DSTS<br />

register to determine the enumeration speed and perform the steps listed in Endpoint<br />

initialization on enumeration completion on page 1287.<br />

At this point, the device is ready to accept SOF packets and perform control transfers on<br />

control endpoint 0.<br />

31.13.4 DMA mode<br />

The OTG host uses the AHB master interface to fetch the transmit packet data (AHB to<br />

USB) and receive the data update (USB to AHB). The AHB master uses the programmed<br />

DMA address (HCDMAx register in host mode and DIEPDMAx/DOEPDMAx register in<br />

peripheral mode) to access the data buffers.<br />

31.13.5 Host programming model<br />

Channel initialization<br />

The application must initialize one or more channels before it can communicate with<br />

connected devices. To initialize and enable a channel, the application must perform the<br />

following steps:<br />

Doc ID 018909 Rev 3 1258/1416

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

Saved successfully!

Ooh no, something went wrong!