Usb Hardware and PCB Guidelines Using stm32 Mcus Stmicroelectronics
Usb Hardware and PCB Guidelines Using stm32 Mcus Stmicroelectronics
Application note
Introduction
STM32 microcontrollers include a group of products embedding a USB (Universal Serial Bus) peripheral (see table below for
applicable products). Full-speed and high-speed operations are provided through embedded and/or external PHYs (physical
layers of the open system interconnection model).
This application note gives an overview of the USB peripherals implemented on STM32 MCUs, and provides hardware
guidelines for PCB design, to ensure electrical compliance with the USB standards.
For more details, refer to the USB or OTG sections in the reference manual related to the MCU used for your application.
Table 1. Applicable products
1 General information
The table below lists the main acronyms used in this document and their meanings.
Acronym Description
This document applies to STM32 microcontrollers which are based on Arm® cores.
Note: Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
Each device with USB support embeds at least one of the following interfaces:
A: USB 2.0 FS device interface
B: USB 2.0 OTG FS, that is, USB 2.0 FS device/host/OTG controller with on-chip FS PHY
C: USB 2.0 OTG HS, that is, USB 2.0 FS/HS device/host/OTG controller, integrating the transceivers for full-
speed operation, and featuring an ULPI for high-speed operation: an external PHY device connected to the
ULPI is required.
D: USB 2.0 OTG HS controller with embedded on-chip HS PHYs
The following table lists the STM32 devices supporting an USB and describes which USB peripheral is
implemented in each of them.
STM32F04x,
STM32F072,
STM32F0 Series X - - - 1 Kbyte No Yes
STM32F078,
STM32F070x6/B
STM32F102 line,
X - - - 512 bytes No -(2)
STM32F103 line
STM32F1 Series
STM32F105/107 line - X - - 1.25 Kbytes No Yes
STM32F74x,
- X - - 1.25 Kbytes Yes Yes
STM32F756,
STM32F76x,
STM32F77x,
STM32F7 Series STM32F7x2 line - - X - 4 Kbytes Yes Yes
1. X: supported.
2. To be compliant with the USB 2.0 full-speed electrical specification, the USB_DP (D+) pin must be pulled up to a voltage in
the 3.0 to 3.6 V range with a 1.5 kΩ resistor.
3. STM32F401/411/412/413/423 devices support only FS mode.
4. USB 2.0 OTG HS device/host/OTG peripheral, supporting only full-speed operations.
5. Available through VDD50USB and VDD33USB pins.
USB 2.0 FS device interface USB OTG FS USB 2.0 FS device interface
Crystal-less
- X - X -
USB
Number of
8 4(2) 8
endpoints
Host mode
- 8 -
channels
Size of
dedicated
1 Kbyte(3) 512 bytes(4) 1.25 Kbytes(5) 512 bytes(5) 1 Kbytes(3)
packet buffer
SRAM
Pull-up resistor
on USB_DP Embedded 1.5 kΩ resistor should be added
line
LPM X - X
BCD X -
ADP -
1. X: supported.
2. Bidirectional, including EP0.
3. When the CAN peripheral is used, only the first 768 bytes are available to USB, the last 256 Bytes are used by CAN.
4. The USB and CAN share a dedicated 512 bytes SRAM, and so they can be used in the same application but not at the
same time.
5. The dedicated SRAM is used exclusively by the USB endpoints (not shared with any other peripheral).
STM32F446
STM32F469
STM32F479
STM32F2x5/2x7
STM32F74x
STM32F405/415 STM32H743/7
STM32F401 STM32F412 STM32F756 STM32F7x3
STM32F407/417 53
STM32F411 STM32F413/423 STM32F76x STM32F730Z/I
Feature(1) STM32F427/437 STM32H750
STM32F77x
STM32F429/439
STM32F7x2
STM32F730R/V
STM32F750
OTG OTG OTG OTG OTG OTG OTG OTG OTG OTG OTG
OTG FS
FS HS FS HS FS HS HS FS HS FS HS
Crystal-less
- - - - - - - - - - X X
USB
Bidirectional
endpoints
4 - 4 6 6 - 6 9 6 9 9 9
(including
EP0)
Host mode
8 - 8 12 12 - 12 16 12 16 16 16
channels
Size of
4 4
dedicated 1.25 1.25 4 1.25 1.25 4 1.25 4
- - Kbyte Kbyte
packet buffer Kbytes Kbytes Kbytes Kbytes Kbytes Kbytes Kbytes Kbytes
s s
SRAM(2)
ULPI available
to primary
- - - X - - - X - - - X
I/Os via
muxing
Integrated
FS(3) - FS(3) FS(3) FS(3) - FS(3) FS(3) FS(3) HS(4) FS(3) FS(3)
PHY
LPM - - - - X - X X X X X X
BCD - - - - X - - - X - X X
ADP - - - - - - - - - - - -
1. X: supported.
2. The dedicated SRAM is used exclusively by the USB endpoints (not shared with any other peripheral).
3. Internal FS OTG PHY support.
4. Internal HS OTG PHY support.
STM32L4x5
STM32L0x2 STM32L4x2 STM32L4x6
STM32L1xx
Feature(1) STM32L0x3 STM32L4x3 STM32L4Rx
STM32L4Sx
Pull-up resistor on
X X
USB_DP line
LPM X X
BCD X X
ADP - X
1. X: supported.
2. Except for STM32L47x/L48x devices.
3. The dedicated SRAM is used exclusively by the USB endpoints (not shared with any other peripheral).
Host X X
Device X -
1. X: supported.
In Host mode, the USB OTG_HS supports high-, full- and low-speed transfers, while in Device mode, it only
supports high- and full-speed transfers.
Host X X X
Device X X -
1. X: supported.
Ipsmax
Ipa
Ips Ir Current through a shorting wire
90% Ips
10% Ips
0
tmax 40 ns
tr 50 nanoseconds
5 nanoseconds per division ta
per division
The system should also comply with the IEC 61000-4-2 standard on USB lines when they are connected to a
receptacle. This standard is fairly different from the HBM standard. Refer to the image and the table below for IEC
61000-4-2 standard test waveform and class levels.
Contact Air
Level Peak current (A)
Indicated voltage (kV)
1 2 3 7.5
2 4 4 15
3 6 8 22.5
4 8 15 30
To see the difference between the current pulses applied in the two tests, compare the two figures presented
above.
To improve the protection against high ESD surges (and then to meet the conditions requested by the standards),
dedicated components have to be placed as close as possible to the receptacle. Refer to the table below.
Protection
Interface
Low price Low area on PCB
USBLC6-2SC6 USBLC6-2P6
USB FS
(+ ESDA7P60-1U1M for VBUS) (+ ESDA7P60-1U1M for VBUS)
USB FS OTG USBLC6-4SC6 DSILC6-4P6
USB HS ECMF02-2AMX6 (+ ESDA7P60-1U1M for 5 V VBUS)
USB HS OTG ECMF02 ECMF02-2AMX6 (+ ESDA7P60-1U1M for 5 V VBUS + ESDALC6V1-1U2 for ID)
2.4 Clock
The FS USB device/OTG requires a precise 48 MHz clock. This frequency can be generated from the internal
main PLL, or by the internal 48 MHz oscillator.
In the first case the clock source must use an HSE crystal oscillator, in the second case, the synchronization for
the oscillator can be taken from:
• The USB data stream itself (SOF signalization), no external resonator/ crystal is needed (this feature is only
available for devices embedding a crystal-less USB 2.0 FS device interface), or
• The internal 48 MHz oscillator trimmed on LSE (not accurate enough for USB host).
• MSI and LSE only for STM32L47x/L48x devices.
If HS operation is required, the OTG PHY is connected to the microcontroller ULPI port through 12 signals. It can
be clocked using the 60 MHz output (provided from the HS PHY: HSE is not mandatory in this case).
As stated on the following figure, for STM32F7x3xx devices the USB HS PHY includes two embedded PLLs:
• PLL1: has as clock source the HSE clock. The supported values are: 12, 12.5, 16, 24 and 25 MHz. The
PLL1 outputs the 60 MHz used as input for the PLL2.
• PLL2: outputs the high speed (480 MHz) clock.
Note: The AHB frequency has to be higher than 14.2 MHz to guarantee a correct operation for the USB OTG FS
peripheral, and higher than 30 MHz for the USB OTG HS peripheral.
2.5 Power
For USB transceivers, the operating voltage ranges between 3.0 and 3.6 V. This voltage is obtained from either:
• VDD: standard external power supply for the STM32MCU I/Os, or
• VDDUSB: a dedicated independent power supply for USB. This power supply can be connected either to VDD
or to an external independent power supply for USB transceivers.
Consequently, the microcontroller can be powered with the minimum specified supply voltage, while an
independent power supply 3.3 V can be connected to VDDUSB.
When the VDDUSB is connected to a separated power supply, it is independent from VDD or VDDA, but it must be
the last supply to be provided and the first to be removed.
Note that:
• The USB full-speed transceiver functionality is ensured down to 2.7 V but not the USB full speed electrical
characteristics, which are degraded when VDD ranges between 2.7 and 3.0 V
• VDDUSB is not available on all STM32 devices, refer to column "Dedicated VDDUSB" in Table 3. USB
implementation in STM32 devices to check whether this feature is available on a specific MCU
• The VDDUSB pin must be connected to two external decoupling capacitors (100 nF ceramic + 1 μF tantalum
or ceramic)
• Some devices, when in high pin count packages, feature a dedicated VDDUSB pin, while, when assembled
in low pin count packages, have only the VDD pin to ensure the USB functionality.
Also note that:
• On STM32F7x3xx devices the USB HS PHY subsystem uses an additional power supply pin:
VDD12OTGHS pin is the output of the HS PHY regulator (1.2 V). An external capacitor (2.2 μF) must be
connected to the VDD12OTGHS pin.
• On STM32H7x3 devices VDD50USB can be supplied through the USB cable to generate the VDD33USB via an
USB internal regulator, making it possible to support a VDD supply different from 3.3 V. The USB regulator
can be bypassed to supply VDD33USB directly when VDD = 3.3 V.
This section describes the hardware requirements for correct operation of the USB peripheral.
Figure 4. USB FS upstream port with embedded pull-up resistor in self-powered applications
3.3 V
STM32 USB Type-B
Power connector
VBUS
R1
VBUS
R2
DM DM
DP DP
OSC_IN
OSC_OUT
Figure 5. USB FS upstream port without embedded pull-up resistor in self-powered applications
3.3 V
STM32 USB Type-B
Power connector
VBUS
R1
VBUS
R2
DM DM
DP DP
1.5 kΩ ± 1%
3.3 V
GPIO
OSC_IN
OSC_OUT
A DP pull-up should be connected only when VBUS is plugged, a GPIO from the MCU is used to drive it after the
VBUS detection.
Figure 6. USB FS upstream port with embedded pull-up resistor in bus-powered applications
3.3 V
STM32 USB Type-B
connector
5 V to VDD/VDDUSB
Power VBUS
voltage regulator
DM DM
DP DP
OSC_IN
OSC_OUT
Figure 7. USB FS upstream port without embedded pull-up resistor in bus-powered applications
3.3 V
STM32 USB Type-B
connector
5 V to VDD/VDDUSB
Power VBUS
voltage regulator
1.5 kΩ ± 1%
DM DM
DP DP
OSC_IN
GND
OSC_OUT shield
3.3 V
STM32 USB Type-A
connector
Power
EN 5 V power supply
GPIO Current limiter power switch VBUS
GPIO + IRQ
Overcurrent
DM DM
DP DP
OSC_IN
OSC_OUT
• A VBUS generation when the OTG device acts as a downstream facing port
• A VBUS current overflow, both monitoring and acting as a downstream facing port.
Regarding the figure that is presented below:
• The OTG specification requires the usage of a capacitor (maximum value 4.7 μF) on VBUS
• The ESD protection chip, if used, must be placed as close as possible to the USB connector
• A power switch (such as STMPS2151STR) is required
• When an over-current is detected, the information is sent to the STM32 software, which alerts the user about
the issue (it is recommended to route VBUS far from DP/DM)
• The STM32 must always be supplied when the platform is connected as device to a host (in case of dead
battery support, voltage on PA9 must be reduced as explained in Section 2.6 VBUS sensing detection).
3.3 V
STM32 USB
5 V to VDD
voltage regulator Micro-AB
connector
Power
EN 5 V power supply
GPIO Current limiter power switch
GPIO + IRQ Max
Overcurrent
4.7 µF
VBUS VBUS
DM DM
DP DP
ID ID
OSC_IN
OSC_OUT
Additional considerations:
• External voltage regulator is only needed when building a VBUS powered device
• The current limiter is required only if the application has to support a VBUS powered device, a basic power
switch can be used if 5 V supply is available on the application board
• The ID pin is required in dual role only
• The same application can be developed using the OTG HS in FS mode to achieve enhanced performance
thanks to the large Rx/Tx FIFO and to a dedicated DMA controller.
3.3 V
STM32
Power
Tested on
USB HS PHY
Board MCU
STM3240G-Eval STM32F407
STM3241G-Eval STM32F417
ISP1705AET
STM3221G-Eval STM32F207
STM3220G-Eval STM32F217
STM32779I-Eval STM32F777
STM32769I-Eval STM32F769
STM32756G-Eval STM32F756
STM32746G-Eval STM32F746
USB3300-EZK
STM32479I-Eval STM32F479
STM32F446E-Eval STM32F446
STM32F439I-Eval STM32F439
STM32F429I-Eval STM32F429
STM32H753I-Eval STM32H753
STM32H743I-Eval STM32H743
USB3320C-EZK
STM32F769I-Disco STM32F769
STM32F746G-Disco STM32F746
Q: The datasheet says that the USB transceiver functionality is ensured down to 2.7 V, but the full-speed
electrical characteristics are degraded in 2.7 to 3.0 V voltage range. What is the meaning of this sentence?
A: When the USB operating voltage is below 3.0 V, ST guarantees that the PLL generates correctly the 48 MHz
and that the analog transceivers are functional: the USB is correctly operating.
However, the electrical signals will not be compliant with the USB2.0 Full speed specification, and, consequently,
some tests needed to get the USB certification (such as the eye diagram test) will not pass. In other words, the
USB is operational, but the customer cannot get the USB certification.
Refer to www.usb.org for more details about the electrical requirements needed to be compliant with the USB
specification.
Q: The pull up resistor on D+ line should be always added for the STM32 acting as a full speed device?
A: A full speed device uses a pull up resistor attached to D+ to specify itself as a full speed device (and to indicate
its speed). The pull up resistor at the device end will also be used by the host or hub to detect the presence of a
device connected to its port. Without a pull up resistor, USB assumes there is nothing connected to the bus.
On some STM32 microcontrollers the pull up resistor is already embedded. Otherwise, the customer needs to add
it. Refer to Embedded pull-up resistor on USB_DP line in Table 3. USB implementation in STM32 devices to know
if this resistor is integrated on the STM32 MCU you are using.
Q: In order to manage the VBUS sensing for USB device, are there any recommendations for the resistor bridge
values?
A: Resistor bridge values should be chosen with respect to the following conditions:
• Voltage should be lower than 4 V
• Voltage should be higher than 0.7×VDD
• A 200 μA typical current consumption is tolerated.
User may refer to "Management of VBUS sensing for USB device design" shared on ST community
http://community.st.com
Q: Can the external clock source (HSE bypass mode) be used for the USB clock source?
A: Yes, this is possible. HSE ON with an external crystal or HSE in bypass mode are required, but HSI cannot be
used.
Q: Can we use two USB ports simultaneously (when they are available)?
A: Yes, this is feasible.
Q: It is possible to connect more than one device to the same USB port configured as host?
A: No, hub operation is not supported.
Q: According to the USB specification (FS driver characteristics), when the full-speed driver is / is not part of a
high-speed capable transceiver, the impedance of each of the drivers must be in the range 40.5 to 49.5 Ω / 28 to
44 Ω, respectively. Are the STM32 devices embedding those matching resistors?
A: Yes. On the internal USB PHYs, the matching output impedance is already embedded in the pad transceiver
and is in line with the USB specification. No external resistors are needed.
Q: Is it possible to use the USB peripheral when the operating voltage VDD on the MCU is below 2.7 V?
A: This is possible only if a VDDUSB pin is available to power the USB block. In this case, the microcontroller can
be powered with the minimum specified supply voltage, while an independent 3.3 V power supply can be
connected to VDDUSB.
5 References
6 Conclusion
This application note was developed in order to help STM32MCUs users to correctly design their USB
applications.
All aspects described inside this document, and specifically requirements described in Section 3 Hardware
guidelines for USB implementation , are mandatory for correct operation of the USB peripheral on STM32 MCUs,
and for ensuring its electrical compliance with the USB standard.
Revision history
Contents
1 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 USB on STM32 products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1 USB implementation on STM32 products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Supported USB speeds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Protection against ESD and EMI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Clock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5 Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.6 VBUS sensing detection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
List of tables
Table 1. Applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Table 2. List of abbreviations and acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Table 3. USB implementation in STM32 devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Table 4. USB implementation on STM32 mainstream products. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Table 5. USB implementation on STM32 high-performance products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Table 6. USB implementation on STM32 ultra-low-power products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Table 7. Supported OTG_FS speeds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Table 8. Supported OTG_FS speeds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Table 9. JESD22-A114D standard class levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Table 10. IEC 61000-4-2 standard class levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Table 11. ESD protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Table 12. Compatible USB HS PHY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Table 13. Certified USB peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table 14. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
List of figures
Figure 1. JESD22-A114D standard test waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 2. IEC 61000-4-2 standard waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 3. HS PHY PLLs on STM32F7x3 devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 4. USB FS upstream port with embedded pull-up resistor in self-powered applications . . . . . . . . . . . . . . . . . . . 11
Figure 5. USB FS upstream port without embedded pull-up resistor in self-powered applications . . . . . . . . . . . . . . . . . 12
Figure 6. USB FS upstream port with embedded pull-up resistor in bus-powered applications . . . . . . . . . . . . . . . . . . . 12
Figure 7. USB FS upstream port without embedded pull-up resistor in bus-powered applications . . . . . . . . . . . . . . . . . 13
Figure 8. USB FS downstream implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 9. OTG schematic implementation (dual-mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 10. USB HS via ULPI interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15