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

Block diagram of the USB sub-system showing USBH and OTG controllers connected to USB2PHY1 and USB2PHY2 respectively, which then interface with external pins for USB2 host HS port and USB2 host or device port.

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.

Block diagram of the USB sub-system showing USBH and OTG controllers connected to USB2PHY1 and USB2PHY2 respectively, which then interface with external pins for USB2 host HS port and USB2 host or device port.

73.2 USB2 host high-speed port

73.2.1 USB2 host high-speed port main features

The supported standards are:

73.2.2 USB2 host high-speed port implementation

Table 767. Implementation parameters

ParameterValue
EHCI descriptors/data prefetchingYes
Number of OHCI controller1
Number of USB2 physical port1
Dedicated AHB interfaces for EHCI controller and OHCI controllerYes
EHCI controller includes port power controlYes
EHCI packet buffer depth: 512 Bytes512 Bytes
Programmable packet buffer depth during runtimeYes
EHCI extended capabilities pointer0xA0
Supports EHCI asynchronous schedule park capabilityYes
Supports EHCI programmable frame list flagYes
64-bit addressing capability for EHCINo
Supports HSIC functionalityNo
Supports heterogeneous interface per portNo, only UTMI+ is supported
ULPI interfaceNo
UTMI legacy interfaceNo, UTMI+ is selected
OHCI PowerOn to PowerGood time2 ms
Is the device connected to port #1 non removableNo
Support link power management for EHCI controllerYes
Support OHCI legacyNo
Enhanced AHB master INCRX supportYes
Support power switching for OHCI-owned portYes
Global or per port power switching for OHCI-owned portPer port
Port power control mask for port #10

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

USB2 host high-speed port block diagram showing SYSCFG, USBH (with OHCI and EHCI controllers), USB2PHY1, EXTI, CPU1 GIC, CPU2 NVIC, and connections to Device interconnect and external pins.

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').

USB2 host high-speed port block diagram showing SYSCFG, USBH (with OHCI and EHCI controllers), USB2PHY1, EXTI, CPU1 GIC, CPU2 NVIC, and connections to Device interconnect and external pins.

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 nameSignal typeDescription
USBH_HS_DP3.3 V analogUSB D+ signal
USBH_HS_DM3.3 V analogUSB D- signal
USBH_HS_TXRTUNE1.8 V analogTransmitter 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_OVRCURVDD domainAlternate 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_VBUSENVDD domainAlternate 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 nameSignal typeDescription
OHCI AHB masterDigitalAHB master interface to the peripheral interconnects for memory access of OHCI engine. AHBLite protocol, 32-bit data width.
OHCI AHB slaveDigitalAHB slave interface for access to OHCI registers. AHBLite protocol, 32-bit data width.
EHCI AHB masterDigitalAHB master interface to the peripheral interconnects for memory access of EHCI engine. AHBLite protocol, 32-bit data width.
EHCI AHB slaveDigitalAHB 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

Block diagram of USB2 host high-speed port reset. The RCC block on the left outputs USBHRST which drives rst_n_usb2 along with clocks ck_icn_m_usb2ehci and ck_icn_m_usb2ohci into a chain of four Reset sync blocks. USB2PHY1RST drives rst_n_usb2phy1 through an Inverter into por and portreset0 of USB2PHY1, which outputs phyclock0 back into the Reset sync chain. The Reset sync chain drives ehci_hreset_i_n, ohci_hreset_i_n, phy_rst_i_n, and utmi_reset_i_n into USBH, and also connects to SD inside RAMs Wrapper.
Block diagram of USB2 host high-speed port reset. The RCC block on the left outputs USBHRST which drives rst_n_usb2 along with clocks ck_icn_m_usb2ehci and ck_icn_m_usb2ohci into a chain of four Reset sync blocks. USB2PHY1RST drives rst_n_usb2phy1 through an Inverter into por and portreset0 of USB2PHY1, which outputs phyclock0 back into the Reset sync chain. The Reset sync chain drives ehci_hreset_i_n, ohci_hreset_i_n, phy_rst_i_n, and utmi_reset_i_n into USBH, and also connects to SD inside RAMs Wrapper.

MSv73138V1

There are two resets for the USB2 host high-speed port:

When configuring the USB2 host high-speed host, the reset sequence to be applied is:

  1. 1. both rst_n_usb2phy1 and rst_n_usb2 are asserted
  2. 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. 3. USB2PHY1 trimming bits are programmed (if needed)
  4. 4. clocks coming from RCC or oscillator are enabled
  5. 5. rst_n_usb2phy1 is released
  6. 6. wait for 50 μs (USB2PHY1 PLL lock time and start of generation of phyclock0)
  7. 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

PortMemory area required
OHCI AHB slave1 KByte
EHCI AHB slave1 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 nameCPU1 interruptCPU2 interrupt
OHCI_0_irq_o_nusbh_ohci_itusbh_ohci_it
ehci_interrupt_0usbh_ehci_itusbh_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 nameEXTI eventCPU1 interruptCPU2 interrupt
utmi_suspend_o_nUSBH WAKEUPexti_usbh_cpu1_wkupexti_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:

Control sequence 2:

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 bitfieldHSIF cluster pin nameIFDescription
USB2PHY1SEL[2:0]sysconf_usb2phy1_sel[2:0]dir. inSelection of USB2PHY1 reference clock frequency Control of the power down of
USB2PHY1CMNsysconf_usb2phy1_cmninUSB2PHY1 analog blocks during Suspend and Sleep
AUTORSMENB1sysconf_usb2phy1_autorsmemb_iinEnable of USB2PHY1 auto resume mode
RETENABLEN1sysconf_usb2phy1_retenablen_iinEnable of USB2PHY1 retention mode Forces USB2PHY1 in non-driving,
H_FORCEBCMODEsysconf_usb2phy1_forcebcmodeinSuspend mode (for battery charging procedure) Enable of voltage source on
H_VDMSRCEN H_VDMSRCENsysconf_usb2phy1_h_vdatsrcenb0 sysconf_usb2phy1_h_vdatsrcenb0
_i _iin in
H_CDPDETEN H_CDPDETENsysconf_usb2phy1_h_vdatdetenb0 sysconf_usb2phy1_h_vdatdetenb0
_i _iin in
H_CDPENsysconf_usb2phy1_chrgsel0_iinhost high-speed port (for battery charging procedure) voltage level on USBH_DM (also output of the comparison with
FSVMINUSsysconf_usb2phy1_fsvminus0_oout
FSVPLUSsysconf_usb2phy1_fsvplus0_oout
CHGDETsysconf_usb2phy1_chgdet0_oout
UNE[1:0] USB2PHY1TXRESTsysconf_usb2phy1_txrestune[1:0]inUSB2PHY1 source impedance adjustment
UNE[1:0] USB2PHY1TXRISETsysconf_usb2phy1_txrisetune[1:0]inUSB2PHY1 HS transmitter rise/fall time adjustment
TUNE[3:0] USB2PHY1TXVREFsysconf_usb2phy1_txvreftune[3:0]inUSB2PHY1 HS DC voltage level adjustment
TUNE[3:0] USB2PHY1TXFSLSsysconf_usb2phy1_txfslstune[3:0]inUSB2PHY1 FS/LS source impedance adjustment

Table 773. connections to SYSCFG block (continued)

SYSCFG bitfieldHSIF cluster pin nameHS IF dir.Description
USB2PHY1TXHSXVTUNE[1:0]sysconf_usb2phy1_txhsxvtune[1:0]inUSB2PHY1 transmitter HS crossover adjustment
USB2PHY1OTGTUNE[2:0]sysconf_usb2phy1_otgtune[2:0]inUSB2PHY1 VBUS valid threshold adjustment
USB2PHY1VDATREFTUNE[1:0]sysconf_usb2phy1_vdatreftune[1:0]inUSB2PHY1 data detect voltage adjustment
USB2PHY1SQRXTUNE[2:0]sysconf_usb2phy1_sqrxtune[2:0]inUSB2PHY1 squelch threshold adjustment
USB2PHY1COMPDISTUNE[2:0]sysconf_usb2phy1_compdistune[2:0]inUSB2PHY1 disconnect threshold adjustment
USB2PHY1PLLPTUNE[3:0]sysconf_usb2phy1_pllptune[3:0]inUSB2PHY1 PLL proportional path adjustment
USB2PHY1PLLITUNE[1:0]sysconf_usb2phy1_pllitune[1:0]inUSB2PHY1 PLL integral path adjustment
USB2PHY1TXPREEMPPULSETUNEsysconf_usb2phy1_txpreemppulsetuneinUSB2PHY1 HS transmitter pre-emphasis duration control
USB2PHY1TXPREEMPAMPTUNE[1:0]sysconf_usb2phy1_txpreempamptune[1:0]inUSB2PHY1 HS transmitter pre-emphasis current control
USBH_VBUSEN_POLARITYsysconf_usb2_vbusen_polarityinPolarity of USBH_HS_VBUSEN alternate function
USBH_OVRCUR_POLARITYsysconf_usb2_ovrcur_polarityinPolarity of USBH_HS_OVRCUR alternate function

73.3 USB2 OTG high-speed port

73.3.1 USB2 OTG port main features

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

USB2 OTG high-speed port block diagram showing OTG core connected to Peripheral interconnects via AHB slave and AHB master, SYSCFG, 8 KBytes RAM, USB2PHY2 with PLL and external pins OTG_HSDP, OTG_HSDM, OTG_TXRTUNE, EXTI with GPIO VBUS detection, CPU1 GIC, and CPU2 NVIC.

MSv73139V1

USB2 OTG high-speed port block diagram showing OTG core connected to Peripheral interconnects via AHB slave and AHB master, SYSCFG, 8 KBytes RAM, USB2PHY2 with PLL and external pins OTG_HSDP, OTG_HSDM, OTG_TXRTUNE, EXTI with GPIO VBUS detection, CPU1 GIC, and CPU2 NVIC.

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 nameSignal typeDescription
OTG_HSDP3.3 V analogUSB D+ signal
OTG_HSDM3.3 V analogUSB D- signal
OTG_TXRTUNE1.8 V analogTransmitter 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 nameSignal typeDescription
OTG AHB masterDigitalAHB master interface to the peripheral interconnects for memory access. AHBLite protocol, 32-bit data width.
OTG AHB slaveDigitalAHB 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

Block diagram of USB2 OTG high-speed port resets. The diagram shows the RCC block on the left and a main system block on the right. Inside the main block are RAMs Wrapper, OTG, and USB2PHY2. The RCC block has inputs OTGRST and USB2PHY2RST. OTGRST goes to a multiplexer that selects between ck_icn_m_otg and rst_n_otg. This signal goes to a Reset Sync block, which then outputs prst_n to the RAMs Wrapper and hreset_n to the OTG block. USB2PHY2RST goes to an Inverter, which outputs por and portreset0 to the USB2PHY2 block. The RAMs Wrapper contains a cloud symbol and an SD block. The OTG block is a large rectangle. The USB2PHY2 block is a rectangle with two inputs. The diagram is labeled MSv73140V1 in the bottom right corner.
Block diagram of USB2 OTG high-speed port resets. The diagram shows the RCC block on the left and a main system block on the right. Inside the main block are RAMs Wrapper, OTG, and USB2PHY2. The RCC block has inputs OTGRST and USB2PHY2RST. OTGRST goes to a multiplexer that selects between ck_icn_m_otg and rst_n_otg. This signal goes to a Reset Sync block, which then outputs prst_n to the RAMs Wrapper and hreset_n to the OTG block. USB2PHY2RST goes to an Inverter, which outputs por and portreset0 to the USB2PHY2 block. The RAMs Wrapper contains a cloud symbol and an SD block. The OTG block is a large rectangle. The USB2PHY2 block is a rectangle with two inputs. The diagram is labeled MSv73140V1 in the bottom right corner.

There are two resets for the USB2 OTG high-speed port:

When configuring the USB2 OTG high-speed port, the reset sequence to be applied is:

  1. 1. rst_n_usb2phy2 and rst_n_otg are asserted
  2. 2. clocks coming from RCC and HSE are enabled
  3. 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. 4. USB2PHY2 trimming bits are programmed (if needed)
  5. 5. rst_n_usb2phy2 is released
  6. 6. wait for 50 μs (USB2PHY2 PLL lock time and start of generation of phyclock0)
  7. 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

IPIP clock pin nameIP clock dir.Sourced fromRCC clock lineMax Freq.Description
OTGhclkinRCCck_icn_m_otg200 MHzAHB clock
OTGutmi_clkinUSB2PHY2-60 MHzProcessing clock
USB2PHY2CLKCOREinRCCusb2phy2_ker_ck24 MHzClock from RCC : one of the possible source of USB2PHY2 reference clock
USB2PHY2CLKCOREinHSE-24 MHzClock from HSE oscillator : one of the possible source of USB2PHY2 reference clock
USB2PHY2phyclockout--60 MHzUTMI 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

PortArea required in the device memory map
OTG AHB slave256 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 interruptIP pin nameCPU1 interruptCPU2 interrupt
OTG_GBL_SYNC_ITOTG/interruptOTG_GBL_SYNC_ITOTG_GBL_SYNC_IT

Table 779. USB2 OTG high-speed port wake-up event

USB OTG eventIP pin nameEXTI event
OTG_WKUPOTG/async_interruptOTG_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:

Control sequence 2:

Device case

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

73.3.6 Connections to SYSCFG block

Table 780. Connections to SYSCFG block

SYSCFG bitfieldHSIF cluster pin nameHSIF dir.Description
USB2PHY2SEL[2:0]sysconf_usb2phy2_fsel[2:0]inSelection of USB2PHY2 reference clock frequency
USB2PHY2CMNsysconf_usb2phy2_cmninControl of the power down of USB2PHY2 analog blocks during Suspend and Sleep
AUTORSMENB2sysconf_usb2phy2_autorsmemb_iinEnable of USB2PHY2 auto resume mode
RETENABLEN2sysconf_usb2phy2_retenablen_iinEnable of USB2PHY2 retention mode
USB2PHY2TXRESTUNE[1:0]sysconf_usb2phy2_txrestune[1:0]inUSB2PHY2 source impedance adjustment
USB2PHY2TXRISETUNE[1:0]sysconf_usb2phy2_txrisetune[1:0]inUSB2PHY2 HS transmitter rise/fall time adjustment
USB2PHY2TXVREFTUNE[3:0]sysconf_usb2phy2_txvreftune[3:0]inUSB2PHY2 HS DC voltage level adjustment
USB2PHY2TXFSLSTUNE[3:0]sysconf_usb2phy2_txfslstune[3:0]inUSB2PHY2 FS/LS source impedance adjustment
USB2PHY2TXHSXVTUNE[1:0]sysconf_usb2phy2_txhsxvtune[1:0]inUSB2PHY2 transmitter HS crossover adjustment
USB2PHY2OTGTUNE[2:0]sysconf_usb2phy2_otgtune[2:0]inUSB2PHY2 VBUS valid threshold adjustment
USB2PHY2VDATREFTUNE[1:0]sysconf_usb2phy2_vdatreftune[1:0]inUSB2PHY2 data detect voltage adjustment
USB2PHY2SQRXTUNE[2:0]sysconf_usb2phy2_sqrxtune[2:0]inUSB2PHY2 squelch threshold adjustment
USB2PHY2COMPDISTUNE[2:0]sysconf_usb2phy2_compdistune[2:0]inUSB2PHY2 disconnect threshold adjustment
USB2PHY2PLLPTUNE[3:0]sysconf_usb2phy2_pllptune[3:0]inUSB2PHY2 PLL proportional path adjustment
USB2PHY2PLLITUNE[1:0]sysconf_usb2phy2_pllitune[1:0]inUSB2PHY2 PLL integral path adjustment
USB2PHY2TXPREEMPPULSE TUNEsysconf_usb2phy2_txpreemp pulsetuneinUSB2PHY2 HS transmitter pre-emphasis duration control
USB2PHY2TXPREEMPAMP TUNE[1:0]sysconf_usb2phy2_txpreempamp tune[1:0]inUSB2PHY2 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].

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.

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].

Table 781. USB debug signals

USBSS_HDPUSB host portUSB OTG port
[0]suspendm0suspendm0
[1]sleepm0sleepm0
[2]linestate0[0]linestate0[0]
[3]linestate0[1]linestate0[1]
[4]hostdisconnect0hostdisconnect0
[5]0iddig0
[6]opmode0[0]opmode0[0]
[7]opmode0[1]opmode0[1]
[8]termsel0termsel0
ST logo
ST logo

Table 781. USB debug signals (continued)

[9]xcvrsel0[0]xcvrsel0[0]
[10]xcvrsel0[1]xcvrsel0[1]
[11]rxactive0rxactive0
[12]rxvalid0rxvalid0
[13]txvalid0txvalid0