USB on-the-go high-speed (OTG_HS)
1.
Program the following fields in the Global AHB configuration (OTG_HS_GAHBCFG)
register:
–
–
–
–
–
2.
Program the following fields in OTG_HS_GUSBCFG register:
–
–
–
–
3.
The software must unmask the following bits in the GINTMSK register:
OTG interrupt mask
Mode mismatch interrupt mask
4.
The software can read the CMOD bit in OTG_HS_GINTSTS to determine whether the
OTG_HS controller is operating in host or peripheral mode.
35.13.2
Host initialization
To initialize the core as host, the application must perform the following steps:
1.
Program the HPRTINT in GINTMSK to unmask
2.
Program the OTG_HS_HCFG register to select full-speed host
3.
Program the PPWR bit in OTG_HS_HPRT to 1. This drives V
4.
Wait for the PCDET interrupt in OTG_HS_HPRT0. This indicates that a device is
connecting to the port.
5.
Program the PRST bit in OTG_HS_HPRT to 1. This starts the reset process.
6.
Wait at least 10 ms for the reset process to complete.
7.
Program the PRST bit in OTG_HS_HPRT to 0.
8.
Wait for the PENCHNG interrupt in OTG_HS_HPRT.
9.
Read the PSPD bit in OTG_HS_HPRT to get the enumerated speed.
10. Program the HFIR register with a value corresponding to the selected PHY clock 1.
11. Program the FSLSPCS field in OTG_FS_HCFG register according to the speed of the
detected device read in step 9. If FSLSPCS has been changed, reset the port.
12. Program the OTG_HS_GRXFSIZ register to select the size of the receive FIFO.
13. Program the OTG_HS_GNPTXFSIZ register to select the size and the start address of
the nonperiodic transmit FIFO for nonperiodic transactions.
14. Program the OTG_HS_HPTXFSIZ register to select the size and start address of the
periodic transmit FIFO for periodic transactions.
To communicate with devices, the system software must initialize and enable at least one
channel.
1474/1731
DMA mode bit
AHB burst length field
Global interrupt mask bit GINT = 1
RxFIFO nonempty (RXFLVL bit in OTG_HS_GINTSTS)
Periodic TxFIFO empty level
HNP capable bit
SRP capable bit
FS timeout calibration field
USB turnaround time field
DocID018909 Rev 11
RM0090
on the USB.
BUS
Need help?
Do you have a question about the STM32F405 and is the answer not in the manual?
Questions and answers