cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 OTA programming using ESP8266 WIFI module.

parth kothiya
Senior

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?

2 REPLIES 2

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.

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..