Skip to content

STM32F4 Firmware Over-The-Air (FOTA) Update | ESP | Node-RED | Firebase

Notifications You must be signed in to change notification settings

EhabMagdyy/FOTA-STM32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

STM32 Firmware Over-The-Air (FOTA) Update

This project implements a Firmware Over-The-Air (FOTA) update mechanism for STM32 microcontrollers using a custom bootloader. The STM32 communicates with a host (Node-RED) via ESP32 to receive commands from a Node-RED Dashboard. The firmware update file is stored in Firebase and delivered to the STM32 for seamless updates.


9


Workflow Overview

  1. User selects a command from the Node-RED Dashboard.
  2. The ESP receives the command from Node-RED.
  3. The ESP appends other details to the command, calculates the CRC of the packet, and then sends it to the STM32 bootloader.
  4. The bootloader receives the packet, calculates its CRC to verify that the packet was received successfully.
  5. Bootloader performs the operations needed by the command (return data/status to the ESP to be shown in Node-RED)

System Architecture

                   Firebase [Update File]
                              |
                              v
[Node-RED Dashboard] <---> [ESP32] <---> [STM32 Custom Bootloader]
  1. Firebase hosts the latest firmware update files.
  2. Node-RED Dashboard provides a user interface to send commands.
  3. ESP32 acts as a communication bridge between Node-RED and the STM32, and responsible for downloading the update file from firebase storage and transfer it to the STM.
  4. STM32 runs a custom bootloader to manage FOTA updates and execute commands.

Features

  • Upload Application: Upload new firmware from Firebase to the STM32.
  • Erase Flash: Erase the STM32 flash memory.
  • Jump to Application: Jump from the current application to the newer application.
  • Get Chip ID: Retrieve the STM32's chip ID.
  • Read Protection Level: Check the current read protection level.

Components

  • STM32F4 Microcontroller (e.g., STM32F401)
  • ESP32 Module
  • Node-RED
  • Firebase

Hardware Connections

For communication between the STM32F4 and ESP32, use the following connections:

STM32F4 ESP32
Tx1 (A9) Rx2
Rx1 (A10) Tx2
GND GND

Ensure all devices share a common ground to avoid communication issues.


Setup

  1. Clone the Repository:

    git clone https://github.com/yourusername/stm32-fota-esp32
  2. Setup Node-RED:

  3. Flash ESP32:

    • Flash the esp32-fota firmware using PlatformIO or Arduino IDE.
  4. STM32 Bootloader:

    • Flash the custom bootloader to the STM32 using STM32CubeProgrammer.
  5. STM32 Update file:

  6. Firebase Setup:


Node-RED Commands & Components

The following commands can be sent from the Node-RED Dashboard to the STM32 via ESP32:

  1. Upload Application
  2. Erase Flash
  3. Jump to Application
  4. Get Chip ID
  5. Read Protection Level
  • Text Field to shown the received data/status from STM32.

Releases

No releases published

Packages

No packages published

Languages