Skip to main content
Visitor II
December 7, 2021
Question

STM32 OTA programming using ESP8266 WIFI module.

  • December 7, 2021
  • 2 replies
  • 3653 views

I want to programming my STM32 MCU using OTA programming MCU is connected to SWD or UART with WIFI module for communicate but i don't know how can i do it?

    This topic has been closed for replies.

    2 replies

    Visitor II
    December 7, 2021

    First option is to toggle boot / reset pins using EPS8266 and then use STM's system bootloader.

    Second option is to make your own bootloader. Most reliable approach would be

    1. Placing custom bootloader in sector 0, enabling write protection for sector 0
    2. After power up bootloader waits for special command for a short time period <1sec, if command is not received and sector 1 is not erased, automatically run user application from sector 1
    3. ESP8266 provides wireless access to STM's UART

    For custom bootloader, flash utility needs to send commands over UART to

    1. Reset from user application
    2. Stop bootloader from loading user application
    3. Write bytes through UART, performing check sum calculation, error correction, etc.
    4. Reboot command after reset

    Hypothetical example:

    sending reset command 0x55 0x00

    Sleep(100) - bootloader starts

    preventing bootloader from loading user app 0x55 0x01

    writing block of data 0x55 [addr] [length] [data bytes] [crc32]

    if crc32 is not equal to calculated checksum on stm32 side, then re-send block of data

    sending reset command 0x55 0x00

    bootloader waits <1sec, nothing received, sector 1 have valid data, jumping to user app at sector 1.

    Graduate II
    December 7, 2021

    STM32 BOOT method used on an Arduino board vis a Murata LoRa module with an L072/82 part.

    https://github.com/arduino-libraries/MKRWAN/tree/master/examples/MKRWANFWUpdate_standalone