Tools – The Device Firmware Update (DFU) Utility

Nearly every product requires a software update at some point or another. Whether it’s our cellphones, TV’s or even our refrigerators (yea I went there). Microcontroller based systems typically aren’t running a high-level operating system that allows files to be replaced. Instead, developers need a bootloader. Microcontroller vendors have been including firmware update capabilities inside their silicon for quite some time. In this post, I’m going to talk about the DFU Utility which can be used to update STM32 microcontrollers (along with a select few other microcontrollers). I have found this utility to be very useful when modifying and deploying updates to the Micro Python kernel.

STM32 microcontrollers include a firmware update application built into the ROM. Developers can gain access to the utility by pulling BOOT0 high during the boot process. At that point, the microcontroller will be ready to accept new application code.

After building their application code in GCC or any number of STM32 compilers, developers will discover that in addition to a .hex file, a .dfu file is also generated. The .dfu file contains the application code along with checksums and information required to properly load the application into flash.

Developers who are running Linux, will need to install dfu-util. Developers who are running Windows can download dfu-util from the ST Microelectronics website at (http://www.st.com/en/development-tools/stsw-stm32080.html) or developers can download the open source version as well. Once the utility has been downloaded, running the application will result in the following screen being displayed:

The utility will automatically detect when a device in the bootloader mode has been connected to the PC via USB. If multiple devices have been selected, the dropdown can be used to select the desired device. On the upper right, information about the microcontroller is displayed.

Developers can update firmware using the Update or Verify Action section. Select choose, then use the pop-up to select the new application dfu file. Finally, press the upgrade button and the firmware update will begin. The transfer data size section will display how far along the firmware update is. Once it completes, the firmware update process is complete! Simply select the “Leave DFU mode” button (after removing power from BOOT0).

Easy and mostly painless firmware update over USB!

Share >

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.