73. USB subsystem (USBSS)
73.1 Overview
The USB sub-system includes one USB2 host high-speed port and one USB2.0 host/device high-speed port.
The USB2 host high-speed port also supports full speed and low speed modes.
The USB2.0 host/device high-speed port can be configured statically as host or device. It is called OTG for legacy reason. In addition to high-speed mode, it also supports full speed and low speed modes when acting as host, and full speed mode when acting as device.
A high level block diagram is shown below.
Figure 917. USB sub-system overview

The diagram illustrates the USB sub-system architecture. It is divided into two main functional blocks: USBH (USB Host) and OTG (On-The-Go). The USBH block contains a 1x OHCI controller and a 1x EHCI controller. The OTG block contains a 1x OTG controller. Both controllers interface with their respective PHY layers via a UTMI+ bus. The USBH controller connects to USB2PHY1, which in turn connects to three external pins: USBH_HS_DP, USBH_HS_DM, and USBH_HS_TXRTUNE, collectively labeled as the 'USB2 host HS port'. Similarly, the OTG controller connects to USB2PHY2, which connects to three external pins: OTG_HSDP, OTG_HSDM, and OTG_TXRTUNE, collectively labeled as the 'USB2 host or device port'. The reference ID 'MSv72202V1' is located in the bottom right corner of the diagram area.
73.2 USB2 host high-speed port
73.2.1 USB2 host high-speed port main features
- • Supports OHCI model for full speed and low speed operation
- • Supports EHCI model for high-speed operation
- • Supports LPM (link power management)
- • USB2PHY1 supports high-speed, full speed and low speed modes
- • DMA engine with local 512 Bytes packet buffer
- • Supports battery charging v1.2, with the exception of the accessory charger adapter mode
- • Support suspend, sleep, resume, and remote wakeup operations
- • Provides electrical parameter override bits for optimal interoperability
The supported standards are:
- • Universal serial bus specification, revision 2.0, USB implementers forum, Inc., April 27, 2000
- • Enhanced host controller interface specification for universal serial bus, revision 1.0, March 12, 2002
- • EHCI 1.1 addendum, version 0.6, October 2007
- • Open host controller interface specification for USB, release 1.0a, September 14, 1999
- • Engineering change notice: USB2.0 link power management addendum, July 16, 2007
- • UTMI+ specification, revision 1.0, Philips semiconductor, February 25, 2004
- • Battery charging specification, revision 1.2, December 7, 2010
73.2.2 USB2 host high-speed port implementation
Table 767. Implementation parameters
| Parameter | Value |
|---|---|
| EHCI descriptors/data prefetching | Yes |
| Number of OHCI controller | 1 |
| Number of USB2 physical port | 1 |
| Dedicated AHB interfaces for EHCI controller and OHCI controller | Yes |
| EHCI controller includes port power control | Yes |
| EHCI packet buffer depth: 512 Bytes | 512 Bytes |
| Programmable packet buffer depth during runtime | Yes |
| EHCI extended capabilities pointer | 0xA0 |
| Supports EHCI asynchronous schedule park capability | Yes |
| Supports EHCI programmable frame list flag | Yes |
| 64-bit addressing capability for EHCI | No |
| Supports HSIC functionality | No |
| Supports heterogeneous interface per port | No, only UTMI+ is supported |
| ULPI interface | No |
| UTMI legacy interface | No, UTMI+ is selected |
| OHCI PowerOn to PowerGood time | 2 ms |
| Is the device connected to port #1 non removable | No |
| Support link power management for EHCI controller | Yes |
| Support OHCI legacy | No |
| Enhanced AHB master INCRX support | Yes |
| Support power switching for OHCI-owned port | Yes |
| Global or per port power switching for OHCI-owned port | Per port |
| Port power control mask for port #1 | 0 |
73.2.3 USB2 host high-speed port functional description
USB2 host high-speed port block diagram
Figure 918. USB2 host high-speed port block diagram

Figure 918 is a block diagram showing the internal architecture and port connections of the USB2 host high-speed port. On the left is the 'Device interconnect' connected via AHB master/slave channels ('OHCI AHB master', 'OHCI AHB slave', 'EHCI AHB master', 'EHCI AHB slave') to the 'USBH' block. Inside the 'USBH' block are '1x OHCI ctlr' and '1x EHCI ctlr', with connections to external 'Data RAM' and 'Descr. RAM'. USBH connects to 'SYSCFG' (via 'app_prt_ovrcur_i' and 'ehci_prt_pwr_o'), 'USB2PHY1' (with 'Control and trimming', 'UTMI+', and internal 'PLL'), and 'EXTI' (via 'utmi_suspend_o_n'). Polarity control and Alternate Function Selection handle 'USBH_HS_OVRCUR' and 'USBH_HS_VBUSEN' GPIO lines. USB2PHY1 connects externally to 'USBH_HS_DP', 'USBH_HS_DM', and 'USBH_HS_TXRTUNE'. The 'EXTI' block routes 'usbh_wkup' into 'CPU1 GIC' ('exti_usbh_cpu1_wkup') and 'CPU2 NVIC' ('exti_usbh_cpu2_wkup'). Interrupt lines 'ohci_0_irq_o_n' and 'ehci_interrupt_o' from USBH route into 'CPU1 GIC' ('usbh_ohci_it', 'usbh_ehci_it') and 'CPU2 NVIC' ('usbh_ohci_it', 'usbh_ehci_it').
MSv73137V1
The AHB slave ports of USBH are protected by two RISUP instances and the traffic from the AHB master ports of USBH is filtered by two RIMU instances. Both RISUP and RIMU instances are located at device top level.
USB2 host high-speed port pins and internal signals
Table 768. USB2 host high-speed port pins
| Signal name | Signal type | Description |
|---|---|---|
| USBH_HS_DP | 3.3 V analog | USB D+ signal |
| USBH_HS_DM | 3.3 V analog | USB D- signal |
| USBH_HS_TXRTUNE | 1.8 V analog | Transmitter resistor tune pin This analog signal connects to the ground through an external 200 Ω±1% resistor that adjusts the high-speed source impedance of USB2PHY1. |
| USBH_HS_OVRCUR | VDD domain | Alternate input function of a GPIO The application can use this input to inform the USB2 host controller of an over-current situation. When asserted, the USB2 host high-speed port enters disable state. The polarity of this input is defined by the USBH_OVRCUR_POLARITY bit in SYSCFG_USBHCR register. |
| USBH_HS_VBUSEN | VDD domain | Alternate output function of a GPIO The application can use this output to switch on or off the VBUS source of the USB2 host high-speed port. The polarity of this output is defined by the USBH_VBUSEN_POLARITY bit in SYSCFG_USBHCR register. |
Table 769. USB2 host high-speed port internal signals
| Signal name | Signal type | Description |
|---|---|---|
| OHCI AHB master | Digital | AHB master interface to the peripheral interconnects for memory access of OHCI engine. AHBLite protocol, 32-bit data width. |
| OHCI AHB slave | Digital | AHB slave interface for access to OHCI registers. AHBLite protocol, 32-bit data width. |
| EHCI AHB master | Digital | AHB master interface to the peripheral interconnects for memory access of EHCI engine. AHBLite protocol, 32-bit data width. |
| EHCI AHB slave | Digital | AHB slave interface for access to EHCI registers. AHBLite protocol, 32-bit data width. |
USB2 host high-speed port resets
Figure 919. USB2 host high-speed port reset

MSv73138V1
There are two resets for the USB2 host high-speed port:
- • rst_n_usb2phy1 which is controlled by the USB2PHY1RST bit in RCC_USB2PHY1CFGR register.
- • rst_n_usb2 which is controlled by the USBHRST bit in RCC_USBHCFGR register.
When configuring the USB2 host high-speed host, the reset sequence to be applied is:
- 1. both rst_n_usb2phy1 and rst_n_usb2 are asserted
- 2. the frequency of USB2PHY1 reference clock is selected in SYSCFG_USB2PHY1CR register (it is assumed that the SYSCFG block has been taken out of reset previously)
- 3. USB2PHY1 trimming bits are programmed (if needed)
- 4. clocks coming from RCC or oscillator are enabled
- 5. rst_n_usb2phy1 is released
- 6. wait for 50 μs (USB2PHY1 PLL lock time and start of generation of phyclock0)
- 7. release rst_n_usb2
USB2 host high-speed port clocking
Refer to the USB clocking schematic in the RCC user specifications.
USB2 host high-speed host memory requirements
Table 770. USB2 host high-speed host memory requirements
| Port | Memory area required |
|---|---|
| OHCI AHB slave | 1 KByte |
| EHCI AHB slave | 1 KByte |
Description of the USB2 host controller (USBH)
Refer to Section 75: USB2 EHCI/OHCI high/full/low-speed host controller (USBH).
Description of the USB2PHY1
Refer to Section 23.2: SYSCFG registers.
73.2.4 USB2 host high-speed host interrupts
The USB2 host high-speed host generates two interrupts.
Table 771. USB2 host high-speed host interrupts
| USBH pin name | CPU1 interrupt | CPU2 interrupt |
|---|---|---|
| OHCI_0_irq_o_n | usbh_ohci_it | usbh_ohci_it |
| ehci_interrupt_0 | usbh_ehci_it | usbh_ehci_it |
The USB2 host high-speed host generates one wake-up event which is turned into an interrupt by the EXTI block. This wake-up event can be used to wake-up the system from Stop mode.
Table 772. USB2 host high-speed host wake-up event
| USBH pin name | EXTI event | CPU1 interrupt | CPU2 interrupt |
|---|---|---|---|
| utmi_suspend_o_n | USBH WAKEUP | exti_usbh_cpu1_wkup | exti_usbh_cpu2_wkup |
When the USB2 host high-speed host is inactive, utmi_suspend_o_n is asserted and places USB2PHY1 in a minimal power mode and shuts down all blocks not necessary for resume operation. The system can then move to Stop mode if desired. When a remote wake-up event is received, utmi_suspend_o_n is de-asserted asynchronously which triggers the usbh_wkup event and the system wakes up from Stop mode. Exti_usbh_cpu1_wkup (resp. exti_usbh_cpu2_wkup) interrupt is generated by the EXTI block which allows the USB driver to resume operation.
73.2.5 USB2PHY1 integration
In addition to the polarity control of USBH_HS_OVRCUR and USBH_HS_VBUSEN alternate functions, and the selection of USB2PHY1 reference clock frequency, some SYSCFG bits are used to control the battery charging procedure and the trimming of electrical parameters in USB2PHY1.
Battery charging
USB2PHY1 integrates the voltage and current sources, as well as the voltage comparators required to support battery charging v1.2. The relevant control bits are in SYSCFG_USB2PHY1BCCR and SYSCFG_USB2PHY1BCSR registers.
The default value in SYSCFG_USB2PHY1BCCR register are such that the USB2 host high-speed port behaves as a standard downstream port (SDP).
If the application wants the USB2 host high-speed port to behave as a charging downstream port (CDP), one of the following two control sequences shall be implemented:
Control sequence 1:
- • Set the H_CDPEN bit to 1.
- • Decode the disconnect information transmitted by the USB2PHY1 to the USBH controller (HOSTDISCONNECT0 output of USB2PHY1).
- – If disconnect = 1, set the H_VDMSRCEN bit to 1.
- – Else set the H_VDMSRCEN bit to 0.
Control sequence 2:
- • Set the H_CDPEN bit to 1 and the H_CDPDETEN bit to 1.
- • Monitor CHGDET and FSVPLUS status bits:
- – If CHGDET = 1 and FSVPLUS = 0, set the H_VDMSRCEN bit to 1
- – Else, set the H_VDMSRCEN bit to 0
Trimming of USB2PHY1 electrical parameters
Some parameters inside the USB2PHY1 PHY can be adjusted by control bits in SYSCFG_USB2PHY1TRIM1CR and SYSCFG_USB2PHY1TRIM2CR registers. Those adjustments must be programmed while the USB2PHY1 is under reset.
Adjustments apply to: the internal PLL, the disconnect threshold, the squelch threshold, the data detection threshold, the transmitter high-speed crossover point, the FS/LS source impedance, the HS DC voltage level, the HS transmitter rise/fall times, the driver source impedance, the HS transmitter pre-emphasis current, the HS transmitter pre-emphasis duration.
The default values in SYSCFG_USB2PHY1TRIM1CR and SYSCFG_USB2PHY1TRIM2CR registers correspond to the recommended values.
73.2.6 Connections to SYSCFG block
Table 773. connections to SYSCFG block
| SYSCFG bitfield | HSIF cluster pin name | IF | Description |
|---|---|---|---|
| USB2PHY1SEL[2:0] | sysconf_usb2phy1_sel[2:0] | dir. in | Selection of USB2PHY1 reference clock frequency Control of the power down of |
| USB2PHY1CMN | sysconf_usb2phy1_cmn | in | USB2PHY1 analog blocks during Suspend and Sleep |
| AUTORSMENB1 | sysconf_usb2phy1_autorsmemb_i | in | Enable of USB2PHY1 auto resume mode |
| RETENABLEN1 | sysconf_usb2phy1_retenablen_i | in | Enable of USB2PHY1 retention mode Forces USB2PHY1 in non-driving, |
| H_FORCEBCMODE | sysconf_usb2phy1_forcebcmode | in | Suspend mode (for battery charging procedure) Enable of voltage source on |
| H_VDMSRCEN H_VDMSRCEN | sysconf_usb2phy1_h_vdatsrcenb0 sysconf_usb2phy1_h_vdatsrcenb0 | ||
| _i _i | in in | ||
| H_CDPDETEN H_CDPDETEN | sysconf_usb2phy1_h_vdatdetenb0 sysconf_usb2phy1_h_vdatdetenb0 | ||
| _i _i | in in | ||
| H_CDPEN | sysconf_usb2phy1_chrgsel0_i | in | host high-speed port (for battery charging procedure) voltage level on USBH_DM (also output of the comparison with |
| FSVMINUS | sysconf_usb2phy1_fsvminus0_o | out | |
| FSVPLUS | sysconf_usb2phy1_fsvplus0_o | out | |
| CHGDET | sysconf_usb2phy1_chgdet0_o | out | |
| UNE[1:0] USB2PHY1TXREST | sysconf_usb2phy1_txrestune[1:0] | in | USB2PHY1 source impedance adjustment |
| UNE[1:0] USB2PHY1TXRISET | sysconf_usb2phy1_txrisetune[1:0] | in | USB2PHY1 HS transmitter rise/fall time adjustment |
| TUNE[3:0] USB2PHY1TXVREF | sysconf_usb2phy1_txvreftune[3:0] | in | USB2PHY1 HS DC voltage level adjustment |
| TUNE[3:0] USB2PHY1TXFSLS | sysconf_usb2phy1_txfslstune[3:0] | in | USB2PHY1 FS/LS source impedance adjustment |
Table 773. connections to SYSCFG block (continued)
| SYSCFG bitfield | HSIF cluster pin name | HS IF dir. | Description |
|---|---|---|---|
| USB2PHY1TXHSXVTUNE[1:0] | sysconf_usb2phy1_txhsxvtune[1:0] | in | USB2PHY1 transmitter HS crossover adjustment |
| USB2PHY1OTGTUNE[2:0] | sysconf_usb2phy1_otgtune[2:0] | in | USB2PHY1 VBUS valid threshold adjustment |
| USB2PHY1VDATREFTUNE[1:0] | sysconf_usb2phy1_vdatreftune[1:0] | in | USB2PHY1 data detect voltage adjustment |
| USB2PHY1SQRXTUNE[2:0] | sysconf_usb2phy1_sqrxtune[2:0] | in | USB2PHY1 squelch threshold adjustment |
| USB2PHY1COMPDISTUNE[2:0] | sysconf_usb2phy1_compdistune[2:0] | in | USB2PHY1 disconnect threshold adjustment |
| USB2PHY1PLLPTUNE[3:0] | sysconf_usb2phy1_pllptune[3:0] | in | USB2PHY1 PLL proportional path adjustment |
| USB2PHY1PLLITUNE[1:0] | sysconf_usb2phy1_pllitune[1:0] | in | USB2PHY1 PLL integral path adjustment |
| USB2PHY1TXPREEMPPULSETUNE | sysconf_usb2phy1_txpreemppulsetune | in | USB2PHY1 HS transmitter pre-emphasis duration control |
| USB2PHY1TXPREEMPAMPTUNE[1:0] | sysconf_usb2phy1_txpreempamptune[1:0] | in | USB2PHY1 HS transmitter pre-emphasis current control |
| USBH_VBUSEN_POLARITY | sysconf_usb2_vbusen_polarity | in | Polarity of USBH_HS_VBUSEN alternate function |
| USBH_OVRCUR_POLARITY | sysconf_usb2_ovrcur_polarity | in | Polarity of USBH_HS_OVRCUR alternate function |
73.3 USB2 OTG high-speed port
73.3.1 USB2 OTG port main features
- • Can be configured statically as a host or a device (dual role)
- • Dynamic switching between the 2 roles is not supported: host negotiation protocol (HNP) and session request protocol (SRP) are not supported.
- • Embedded PHY which supports high-speed (HS), full speed (FS) and low speed (LS) modes (note: LS mode is not supported when configured as a device).
- • Supports LPM (link power management)
- • DMA engine with local 8 KBytes buffer
- • Supports battery charging v1.2, with the exception of the accessory charger adapter mode
- • Supports suspend, sleep, resume, and remote wakeup operations
- • Provides electrical parameter override bits for optimal interoperability
- • No dedicated VBUS ball connected to the USB2 PHY
- • No dedicated ID ball connected to the USB2 PHY
- • The supported standards are:
- – Universal serial bus specification, revision 2.0, USB implementers forum, Inc., April 27, 2000
- – Engineering change notice: USB2.0 link power management addendum, July 16, 2007
- – UTMI+ specification, revision 1.0, Philips semiconductor, February 25, 2004
- – Battery charging specification, revision 1.2, December 7, 2010
- – AMBA specification (revision 2.0, May 13, 1999)
USB2 OTG high-speed port implementation
The OTG controller is based on Synopsys USB2 high-speed OTG designware core.
73.3.2 USB2 OTG high-speed port functional description
USB2 OTG high-speed port block diagram
Figure 920. USB2 OTG high-speed port block diagram

MSv73139V1
The AHB slave port of OTG is protected by a RISUP instance, and the traffic from the AHB master port is filtered by a RIMU instance. Both RISUP and RIMU instances are instantiated at device top level.
USB2 OTG high-speed port pins and internal signals
Table 774. USB2 OTG high-speed port pins
| Signal name | Signal type | Description |
|---|---|---|
| OTG_HSDP | 3.3 V analog | USB D+ signal |
| OTG_HSDM | 3.3 V analog | USB D- signal |
| OTG_TXRTUNE | 1.8 V analog | Transmitter resistor tune pin This analog signal connects to the ground through an external 200 Ω ±1% resistor that adjusts the high-speed source impedance of USB2PHY2. |
There are no dedicated alternate functions to enable an external \(V_{BUS}\) source or detect an overcurrent condition (relevant only when OTG is configured as a host). GPIOs must be used for this purpose.
Table 775. USB2 OTG high-speed port internal signals
| Signal name | Signal type | Description |
|---|---|---|
| OTG AHB master | Digital | AHB master interface to the peripheral interconnects for memory access. AHBLite protocol, 32-bit data width. |
| OTG AHB slave | Digital | AHB slave interface for access to OTG registers. AHBLite protocol, 32-bit data width. |
USB2 OTG high-speed port resets
Figure 921. USB2 OTG high-speed port resets

There are two resets for the USB2 OTG high-speed port:
- •
rst_n_otgwhich is controlled by theOTGRSTbit inRCC_OTGCFGRregister. - •
rst_n_usb2phy2which is controlled by theUSB2PHY2RSTbit inRCC_USB2PHY2CFGRregister.
When configuring the USB2 OTG high-speed port, the reset sequence to be applied is:
- 1. rst_n_usb2phy2 and rst_n_otg are asserted
- 2. clocks coming from RCC and HSE are enabled
- 3. the frequency of USB2PHY2 reference clock is selected in SYSCFG_USB2PHY2CR register (it is assumed that the SYSCFG block has been taken out of reset previously)
- 4. USB2PHY2 trimming bits are programmed (if needed)
- 5. rst_n_usb2phy2 is released
- 6. wait for 50 μs (USB2PHY2 PLL lock time and start of generation of phyclock0)
- 7. rst_n_otg is released
USB2 OTG high-speed port clocking
Refer to Figure 118: USBH and OTG ports clocking in the RCC.
The OTG controller receives an AHB clock from the RCC and a processing clock from USB2PHY2. USB2PHY2 can receive its reference clock from either the RCC or directly from the HSE oscillator.
Table 776. OTG high-speed port clocks
| IP | IP clock pin name | IP clock dir. | Sourced from | RCC clock line | Max Freq. | Description |
|---|---|---|---|---|---|---|
| OTG | hclk | in | RCC | ck_icn_m_otg | 200 MHz | AHB clock |
| OTG | utmi_clk | in | USB2PHY2 | - | 60 MHz | Processing clock |
| USB2PHY2 | CLKCORE | in | RCC | usb2phy2_ker_ck | 24 MHz | Clock from RCC : one of the possible source of USB2PHY2 reference clock |
| USB2PHY2 | CLKCORE | in | HSE | - | 24 MHz | Clock from HSE oscillator : one of the possible source of USB2PHY2 reference clock |
| USB2PHY2 | phyclock | out | - | - | 60 MHz | UTMI 60 MHz clock |
Details of the USB2 OTG high-speed port clocking
The USB2PHY2 receives its reference clock from the RCC or directly from the HSE oscillator. This is controlled by the bit USB2PHY2CKREFSEL in RCC_USB2PHY2CFGR register. If the USB2PHY2 reference clock is received from the RCC, it can be sourced from the HSE or re-generated by one of the PLLs and dividers located in the RCC.
The frequency of the USB2PHY2 reference clock can be selected among 19.2, 20 or 24 MHz (50 MHz is reserved for test purpose). This selection is controlled by the USB2PHY2SEL[2:0] bitfield in SYSCFG_USB2PHY2CR register. These bits must be set to the desired value before USB2PHY2 reset is released.
The 60 MHz processing clock provided by USB2PHY2 to OTG is obtained by division of the 480 MHz clock which is generated by a PLL inside the PHY (this is a fixed frequency PLL which cannot be programmed).
The USB2PHY2 PLL can be powered down during USB Suspend and Sleep modes. This is controlled by the USB2PHY2CMN bit in SYSCFG_USB2PHY2CR register.
The clocks provided by the RCC are controlled by enable bits in RCC_OTGCFGR and RCC_USB2PHY2CFGR registers.
USB2 OTG high-speed port memory requirements
Table 777. USB2 OTG high-speed port memory requirements
| Port | Area required in the device memory map |
|---|---|
| OTG AHB slave | 256 KBytes |
Description of the USB2 OTG high-speed controller (OTG).
Refer to Section 74: USB on-the-go high-speed (OTG).
Description of the USB2PHY2
Refer to Section 23.2: SYSCFG registers.
73.3.3 USB2 OTG high-speed port interrupts
The USB2 OTG high-speed port generates one interrupt and one wakeup event which can be used to take the system out of Stop mode.
Table 778. USB2 OTG high-speed port interrupt
| USB OTG interrupt | IP pin name | CPU1 interrupt | CPU2 interrupt |
|---|---|---|---|
| OTG_GBL_SYNC_IT | OTG/interrupt | OTG_GBL_SYNC_IT | OTG_GBL_SYNC_IT |
Table 779. USB2 OTG high-speed port wake-up event
| USB OTG event | IP pin name | EXTI event |
|---|---|---|
| OTG_WKUP | OTG/async_interrupt | OTG_WKUP |
In a 5 V device platform, a GPIO with an external resistor divider can be connected to VBUS and be used to detect its presence. This GPIO must be connected to EXTI and act as a wakeup event to take the system out of Stop Mode. Another option is to wakeup periodically the system from Stop mode and detect the presence of VBUS with an ADC channel.
73.3.4 USB2PHY2 integration
In addition to the selection of the USB2PHY2 reference clock frequency, some SYSCFG register bits are used to control the trimming of the electrical parameters of the USB2PHY2.
The battery charging protocol relies on command and status bits implemented in the OTG_GCCFG register of the Synopsys USB2 high-speed OTG designware core.
Battery charging
The USB2PHY2 integrates the voltage and current sources, as well as the voltage comparators required to support battery charging v1.2. The relevant control bits are implemented in OTG general core configuration register (OTG_GCCFG).
The control sequence to be applied depends on whether the USB OTG HS port is host or device.
Host case
If the application wants the host port to behave as a standard downstream port (SDP), the default values of H_CDPEN, H_CDPDETEN, H_VDMSRCEN bits in GGPIO register must be kept.
If the application wants the host port to behave as a charging downstream host (CDP), one of the following two control sequences must be implemented:
Control sequence 1:
- • Set the H_CDPEN bit to 1
- • Decode the disconnect information transmitted by the USB2PHY2 to the OTG controller (HOSTDISCONNECT0 output of USB2PHY2)
- – If disconnect = 1, set the H_VDMSRCEN bit to 1
- – Else set the H_VDMSRCEN bit to 0
Control sequence 2:
- • Set the H_CDPEN bit to 1 and the H_CDPDETEN bit to 1
- • Monitor CHGDET and FSVPLUS status bits:
- – If CHGDET = 1 and FSVPLUS = 0, set the H_VDMSRCEN bit to 1
- – Else, set the H_VDMSRCEN bit to 0
Device case
- • Data contact detection
- – Set the PD_DCDET bit to 1. This enables a current source on OTG_HSDP and pulls OTG_HSDM low.
- – If FSVPLUS is at 0 for more than tDCD_DBNC (as defined in battery charging v1.2), data contact has happened. PD_DCDET must be reset.
- • Primary detection
- – Set the PD_PDET bit to 1. This enables a voltage source on OTG_HSDP and a voltage comparator on OTG_HSDM.
- – If CHGDET = 0, the device is connected to a standard downstream port (SDP).
- – Else if CHGDET = 1, the device is connected to a charging downstream port (CDP) or a dedicated charging port (DCP).
- – Reset PD_PDET.
- • Secondary detection
- – Set the PD_SDET bit to 1. This enables a voltage source on OTG_HSDM and a voltage comparator on OTG_HSDP.
- – If CHGDET = 0, the device is connected to a charging downstream port (CDP).
- – Else if CHGDET = 1, the device is connected to a dedicated charging port (DCP).
- – Reset PD_SDET.
Trimming of USB2PHY2 electrical parameters
Some parameters inside USB2PHY2 can be adjusted by control bits in SYSCFG_USB2PHY2TRIM1CR and SYSCFG_USB2PHY2TRIM2CR registers. These adjustments must be programmed while the USB2PHY2 is under reset.
Adjustments apply to: the internal PLL, the disconnect threshold, the squelch threshold, the data detection threshold, the transmitter high-speed crossover point, the FS/LS source impedance, the HS DC voltage level, the HS transmitter rise/fall times, the driver source impedance, the HS transmitter pre-emphasis current, the HS transmitter pre-emphasis duration.
The default values in SYSCFG_USB2PHY2TRIM1CR and SYSCFG_USB2PHY2TRIM2CR registers correspond to the recommended values.
ID management
There is no dedicated ID ball. For platforms with a micro-AB connector, a GPIO can be used to capture the ID information and depending on this information the software configures the controller in either host or device mode.
VBUS detection
There is no dedicated VBUS ball. The VBUS level comparators inside USB2PHY2 can therefore not be used for VBUS detection. USB2PHY2 is configured in VBUS external comparator mode by forcing VBUSVLDEXTSEL0 input of the PHY to 1. In VBUS external comparator mode, VBUS presence must be inferred from an external voltage comparator or by using a GPIO. This GPIO must be connected to the device event controller to be able to wake-up the system from Stop mode upon VBUS detection.
It is also feasible to wake-up the system from Standby if VBUS detection is managed externally and is connected to a wakeup pin of the device.
VBUS enabling and over-current detection
There is no dedicated alternate function to enable an external VBUS source in a SRC or DRP platform. Any GPIO configured as an output can be used to perform this function.
Also, there is no dedicated alternate function to capture an overcurrent information provided by an external VBUS source. Any GPIO configured as an input can be used to perform this function.
73.3.5 SYSCFG registers
- • SYSCFG USB2PHY2 control register (SYSCFG_USB2PHY2CR)
- • SYSCFG USB2PHY2 trimming 1 control register (SYSCFG_USB2PHY2TRIM1CR)
- • SYSCFG USB2PHY2 trimming 2 control register (SYSCFG_USB2PHY2TRIM2CR)
73.3.6 Connections to SYSCFG block
Table 780. Connections to SYSCFG block
| SYSCFG bitfield | HSIF cluster pin name | HSIF dir. | Description |
|---|---|---|---|
| USB2PHY2SEL[2:0] | sysconf_usb2phy2_fsel[2:0] | in | Selection of USB2PHY2 reference clock frequency |
| USB2PHY2CMN | sysconf_usb2phy2_cmn | in | Control of the power down of USB2PHY2 analog blocks during Suspend and Sleep |
| AUTORSMENB2 | sysconf_usb2phy2_autorsmemb_i | in | Enable of USB2PHY2 auto resume mode |
| RETENABLEN2 | sysconf_usb2phy2_retenablen_i | in | Enable of USB2PHY2 retention mode |
| USB2PHY2TXRESTUNE[1:0] | sysconf_usb2phy2_txrestune[1:0] | in | USB2PHY2 source impedance adjustment |
| USB2PHY2TXRISETUNE[1:0] | sysconf_usb2phy2_txrisetune[1:0] | in | USB2PHY2 HS transmitter rise/fall time adjustment |
| USB2PHY2TXVREFTUNE[3:0] | sysconf_usb2phy2_txvreftune[3:0] | in | USB2PHY2 HS DC voltage level adjustment |
| USB2PHY2TXFSLSTUNE[3:0] | sysconf_usb2phy2_txfslstune[3:0] | in | USB2PHY2 FS/LS source impedance adjustment |
| USB2PHY2TXHSXVTUNE[1:0] | sysconf_usb2phy2_txhsxvtune[1:0] | in | USB2PHY2 transmitter HS crossover adjustment |
| USB2PHY2OTGTUNE[2:0] | sysconf_usb2phy2_otgtune[2:0] | in | USB2PHY2 VBUS valid threshold adjustment |
| USB2PHY2VDATREFTUNE[1:0] | sysconf_usb2phy2_vdatreftune[1:0] | in | USB2PHY2 data detect voltage adjustment |
| USB2PHY2SQRXTUNE[2:0] | sysconf_usb2phy2_sqrxtune[2:0] | in | USB2PHY2 squelch threshold adjustment |
| USB2PHY2COMPDISTUNE[2:0] | sysconf_usb2phy2_compdistune[2:0] | in | USB2PHY2 disconnect threshold adjustment |
| USB2PHY2PLLPTUNE[3:0] | sysconf_usb2phy2_pllptune[3:0] | in | USB2PHY2 PLL proportional path adjustment |
| USB2PHY2PLLITUNE[1:0] | sysconf_usb2phy2_pllitune[1:0] | in | USB2PHY2 PLL integral path adjustment |
| USB2PHY2TXPREEMPPULSE TUNE | sysconf_usb2phy2_txpreemp pulsetune | in | USB2PHY2 HS transmitter pre-emphasis duration control |
| USB2PHY2TXPREEMPAMP TUNE[1:0] | sysconf_usb2phy2_txpreempamp tune[1:0] | in | USB2PHY2 HS transmitter pre-emphasis current control |
73.4 Debug signals
Signals of the USB host high-speed host and the USB OTG high-speed ports are multiplexed and routed to the device hardware debug host (HDP). The SELUSBDBG bit of the SYSCFG peripheral controls the multiplexer, see SYSCFG HDP USB debug control register (SYSCFG_HDPUSBDBGCR).
These debug signals are tapped on the UTMI+ interface between the controllers (USBH, OTG) and the PHYs (USB2PHY1, USB2PHY2). The list of debug signals is described in the table below.
Figure 922. Multiplexing of debug signals in the USB Sub-system
![Block diagram showing the multiplexing of debug signals in the USB Sub-system. It illustrates the flow of debug signals from USBH and OTG controllers through USB2PHY1 and USB2PHY2 PHYs, respectively, to a multiplexer. The multiplexer is controlled by the SELUSBDBG bit in the SYSCFG peripheral and outputs USBSS_HDP[13:0].](/RM0506-STM32MP21/f3bba0f52fc5881f50a9d0cc31862df5_img.jpg)
The diagram illustrates the multiplexing of debug signals in the USB Sub-system. It shows two parallel paths for USB Host (USBH) and USB OTG. In each path, a controller (USBH or OTG) is connected to a PHY (USB2PHY1 or USB2PHY2) via a bidirectional UTMI+ interface. Debug signals [13:0] are tapped from the UTMI+ interface of both paths and fed into a 2-to-1 multiplexer. The multiplexer's selection is controlled by the SELUSBDBG bit from the SYSCFG peripheral. The output of the multiplexer is the USBSS_HDP[13:0] signal. The diagram is labeled MSv73142V1 in the bottom right corner.
Table 781. USB debug signals
| USBSS_HDP | USB host port | USB OTG port |
|---|---|---|
| [0] | suspendm0 | suspendm0 |
| [1] | sleepm0 | sleepm0 |
| [2] | linestate0[0] | linestate0[0] |
| [3] | linestate0[1] | linestate0[1] |
| [4] | hostdisconnect0 | hostdisconnect0 |
| [5] | 0 | iddig0 |
| [6] | opmode0[0] | opmode0[0] |
| [7] | opmode0[1] | opmode0[1] |
| [8] | termsel0 | termsel0 |

Table 781. USB debug signals (continued)
| [9] | xcvrsel0[0] | xcvrsel0[0] |
| [10] | xcvrsel0[1] | xcvrsel0[1] |
| [11] | rxactive0 | rxactive0 |
| [12] | rxvalid0 | rxvalid0 |
| [13] | txvalid0 | txvalid0 |