Saturday, September 14, 2013

STM32 Firmware Loader

For some of my hobby projects I'm using STM32 MCU. To make my life easier when loading different firmwares I created this simple STM32 Firmware Loader.

Using a software USB boot-loader has some disadvantages:

  • It has to occupy some part of the user Flash, which leads to less available Flash memory (usually a whole page)

  • it is difficult (or impossible) to protect it from accidental erase or data corruption.

  • the user firmware has to be build with the boot-loader in mind

  • it has to have own USB PID/VID. Having a VID is a little bit expensive, especially for small hobby projects.


The solution I have is to use the STM32 internal loader. This allows me to use the whole Flash memory for my user code. On top of that I have some more flexibility with this solution - I have a control over the hardware reset pin from the software.

However, all it comes at a price - an external components are needed. The schematic is very simple. A popular FTDI FT232 USB-to-UART converter is used.

Two GPIO from FT232 are used to control STM32_RESET and STM32_BMODE pins, and two pins for UART communication.

1zowJGjuo2TXOMcYcWa3VIGP6CFQd0uE

Operation is simple - when a firmware has to be loaded, the boot mode pin is set to enable the internal boot-loader and a hardware reset is issued. The STM32 goes to boot-loader mode. Via UART the new firmware is loaded, the boot pin is set to a state to enable user code execution and the STM32 is reset again. At this point the new firmware gets executed.

The source code can be found on https://code.google.com/p/stm32-loader/. The GUI is based on Qt.

Subscribe for our NewsLetter!

No comments:

Post a Comment