The project aims at enabling firmware update of STM32Fxx series MCUs Over-the-Air using ESP32.
/esp_stm_flash -> Basic flashing utility, requires path of the .bin file which has been already uploaded in SPIFFS
/file_serving_stm -> OTA demo, with HTTP File Server with embedded flash link
/references -> Python scripts for understanding the flashing protocol commands and verification
To run the OTA demo, you need an ESP32 dev board (e.g. ESP32-WROVER Kit) or ESP32 core board (e.g. ESP32-DevKitC). For the STM32, you can use the STM32 Blue Pill.
ESP-IDF v4.0 and above
You can visit the ESP-IDF Programmming Guide for the installation steps.
Arduino IDE provides with an easy way to generate the .bin files for your STM32 MCU. For setting up Arduino Core for the STM32 family, you can follow this link.
Wire your STM32 (e.g. Blue Pill) to the ESP32 as follows:
Generate a .bin file for the STM32 MCU code you want to flash.
We have assumed that the STM32 is already in boot mode before flashing the code (Step 1 & 5 in Usage section). You can use a MOSFET as a switch to automate the process, using an ESP32 GPIO as an input.
The program code uses only the path of the binary file to be flashed as a parameter. Thus, it can be easily integrated into any other projects as the file can be sent to ESP32 over any protocol (MQTT, HTTP Client, WebSockets).
Make sure the BOOT0 jumper pin on the board is set to 1 (programming mode) while uploading the code. Once the code is flashed this pin can be changed back to initial position (operating mode). This procedure with your STM32Fxx MCU varies according with your MCU version.
Refer this documentation for help.
idf.py menuconfig) go to
Example Connection Configuration->
idf.py -p PORT -b BAUD flash
idf.py -p PORT monitorand note down the IP assigned to your ESP module. The default port is 80.
http://192.168.43.82/to see an HTML web page with list of files on the server (initially empty)
For OTA updates for AVR MCUs, you can follow this project.
STM32 USART Protocol: Documentation
Python Script: stm32loader.py
STM32 Boot Mode Procedure: Documentation
Distributed under the MIT License. See
LICENSE for more information.