Updating Firmware of STM32 CPU via USB Cable Using USB DFU Protocol
Application for Updating Firmware of STM32 CPU via USB Cable Using USB DFU Protocol
The implementation of this application is guided by the following documents from STMicroelectronics:
- AN2606: STM32 Microcontroller System Memory Boot Mode
- AN3156: USB DFU Protocol Used in the STM32 Bootloader
How to Use the Application
Prerequisite
Your mobile device must support USB-OTG.
Preparation
- Connect the STM32 board to your mobile device using a USB-OTG cable.
- Activate the bootloader mode for the STM32. Refer to AN2606 for detailed instructions. Generally, you should set the pins BOOT0 and BOOT1 in the correct combination according to your CPU model.
Programming
Select the firmware file you wish to upload. The firmware file should be in one of the following formats:
- Intel Hex
- Motorola S-Record
- DfuSe (STMicroelectronics DFU format)
- Raw Binary
Configure the writing options as needed. You can choose from the following options:
- Erase only necessary pages
- Unset readout protection if required
- Automatically start the CPU after programming
Press the "Load File to Flash" button and wait for the operation to complete.
Additional Operations
The application also supports the following functions, accessible via the appropriate menu options:
- Erasing
- Checking flash for blank status
- Comparing flash content with the file
Tested Microcontroller Models
The application has been verified to work with the following STM32 models:
- STM32F072
- STM32F205
- STM32F302
- STM32F401
- STM32F746
- STM32G474
- STM32L432
Usage Restrictions
You can perform up to 25 firmware uploads completely free of charge. Once you reach this limit, you can choose from the following service options:
- An additional 100 uploads
- Unlimited use of the application