2025-05-06 5:30 AM - edited 2025-12-22 1:06 AM
This article gives you the key information you need to dive into USB development on STM32. It mentions various resources, including training (MOOCs), articles, and application notes, that can help understand USB theory and hardware implementation.
If you’re new to the world of USB on STM32 products, we really recommend watching our USB MOOC and consult the course materials. This will help you dive deep into USB theory and understand the fundamentals like:
You can also read the ST Wiki: USB protocol basics from section 1.0 to 1.15.
For more technical information related to USB, see the USB specification and USB class specifications that can be downloaded from https://www.usb.org/developers
USB hardware implementation is and will always be one of the most delicate and always asked about topics. The AN4879 covers most of what you need to know in an advanced way like:
Check the relevant datasheet for your product. For more information, check section 2.4 "Clock" in AN4879.
For this point, you can check this article about ULPI compatibility or from section 3.3 to section 3.5 of AN4879.
Check this article for more specific overview or check section 2.6 “VBUS sensing detection point” and section 2.3 "Protection against ESD and EMI" in AN4879.
To see STM32 products USB specifications, you can refer to the section 2, “USB on STM32 products” in AN4879.
You can also refer to specific application notes and datasheets for detailed hardware implementation guidance like the application notes for H5, F7, H7R/S, and H72x/H73x.
These application notes are titled under the name: “Getting started with STM32Xx MCU hardware development”.
You can also always refer to each product’s datasheets, reference manual, application note, and schematics to see some ST hardware implementation (noted as MBxxxx example: MB997 for F407G-Disco, MB1364 for STM32H757-EVAL.)
ST uses majorly 2 middlewares through their range of product, which is ST USB middleware and Azure USBX middleware.
ST USB middleware provides libraries and tools to facilitate USB device and host functionality on STM32 microcontrollers. It’s composed mainly of the device library and host library.
For a general understanding of device mode, watch the STM32 USB device library training, read the fifth section in the wiki, and view the STM32 USB device library PDF.
For more in-depth review, check UM1734, sixth point USB device library of UM1021 or UM0424 for USB-FS demos.
If you’re still searching for helpful resources on the subject, here are some extra links that might help:
You can watch the STM32 USB host library training, read the “USB host library overview” in the ST wiki, and explore the STM32 USB host library PDF.
For a deep explanation, check the section 7. "USB host library" in UM1021.
As a general start you can check our USBX overview MOOC
You can review the second section of this WIKI and check the "USBX device stack user guide” and “USBX device stack supplemental” of USBX GitHub documentation
You can review this Link and check the “USBX host stack user guide” and “USBX host stack supplemental” sections of USBX GitHub documentation
ST provides some USB applications examples in almost every product in their range
You can refer to them buy following your product firmware buy this path
C:\Users\xxxxxx\STM32Cube\Repository\STM32Cube_FW_xx_Vx.xx.x\Projects\xxxxxxxxx\Applications\
This is the default path, but it may change if you chose another location for installing the firmware.
Or in our GitHub: STMicroelectronics/STM32CubeXX
For example: STM32CubeH7/Projects at master · STMicroelectronics/STM32CubeH7
or visit stm32-usbx-examples.
Here are some USB application examples for some of our products (be aware that you can find the same application in other products just check our GitHub or your products firmware as we explained
|
Class |
Mode |
Details |
|
HID |
Device |
|
|
CUSTOM HID standalone application or visit this project tutorial and check USB HID articles part 1 and part 2 |
||
|
Host |
HID mouse and keyboard application or visit this tutorial. |
|
|
CDC |
Device |
CDC transmit application, or follow this tutorial |
|
Host |
||
|
DFU |
Device |
DFU mode application or follow the device mode tutorial |
|
How to modify DFU firmware examples check this article |
||
|
How to jump to system bootloader check this article |
||
|
Open bootloaders check this article |
||
|
Dual bank demos check this GitHub example |
||
|
Host |
Check STM32H743-EVAL firmware or follow the host mode tutorial |
|
|
MSC |
Device |
Mass storage class application or follow the device mode tutorial |
|
Bootloader USB mass storages check this GitHub example |
||
|
Host |
Check your firmware or follow the device mode tutorial |
|
|
AUDIO |
Device |
STM32H747-EVAL firmware example |
|
DUAL CORE |
Device |
|
|
Host |
||
|
Dual Role |
Device/Host |
|
|
Composite |
device |
|
|
(DFU + HID) article |
Here are some USB application examples for some of our products (be aware that you can find the same application in other products just check our GitHub or your products firmware as we explained
|
Class |
Mode |
Details |
|
HID
|
Device
|
|
|
Host
|
||
|
CDC |
Device
|
How to implement the USB device CDC class using the Azure article |
|
|
||
|
|
Dual CDC project with USBX stack GitHub link |
|
|
Host |
CDC host project or check this article |
|
|
DFU
|
Device |
Enable DFU mode project |
|
MSC |
Device |
|
|
|
||
|
Host |
||
|
AUDIO |
Device |
|
|
HOST |
||
|
Video |
Device |
STM32N6 firmware example |
|
CCID |
Device |
|
|
PIMA |
Device |
|
|
Printer |
Device |
|
|
RNDIS |
Device |
|
|
|
Host |
|
|
Dual Class |
Host |
|
|
Composite |
DEVICE |
|
|
|
|
How to implement the USB device composite class using the Azure article and associated project |
|
|
HOST |
|
|
Standalone |
HID |
|
Be also aware that some of our products are native STM32 classic middleware but also can use the USBX Azure package like H7, H7RS, L5, WB, G4, G0, F7, F4, WL, and L4 like we did in this article
And some of them are USBX stack natively but can also use the classic middleware accordingly. With them like STM32WBA, STM32U3, STM32U0, STM32N6, STM32C0, STM32U5, STM32H5.
However, you can implement STMicroelectronics classic USB device middleware with these families. Like we did in this article.
How to configure USB FIFO over USB OTG controller over STM32
How to configure the packet memory area in STM32 USB controller
Practical use cases on how to configure packet memory area
Practical use cases to manage FIFO in USB OTG controller
Overall, the article provides a thorough guide for USB development on STM32. It includes various resources such as MOOCs, articles, and application notes.
All useful links are directly accessible.
Thank you so much for sharing this comprehensive guide to USB development resources on STM32! This is an invaluable resource for both beginners and experienced developers working with STM32 microcontrollers. The detailed breakdown of available documentation, example projects, and tools will definitely save many hours of searching across different sources. I particularly appreciate how well-organized the information is, making it easy to find exactly what's needed for specific USB implementations. This guide will be a great reference for my future STM32 projects.