Updating STM32 Over-The-Air using ESP32

栏目: IT技术 · 发布时间: 4年前

内容简介:Program your STM32Fxx Over-the-Air using ESP32

Updating STM32 Over-The-Air using ESP32

OTA for STM32Fxx MCU using ESP32

Program your STM32Fxx Over-the-Air using ESP32

View Code · Report Bug · Request Feature · Create a Pull Request

Table of Contents

About the Project

The project aims at enabling firmware update of STM32Fxx series MCUs Over-the-Air using ESP32.

Testing was done with ESP32-DevKitC v4 board and STM32F103C8T6 ( Blue Pill ) and STM32F072C8T6 . You can try with any other STM32Fxx MCUs and let us know how it worked out.

Code

/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

Getting Started

Hardware Required

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.

Prerequisites

  • ESP-IDF v4.0 and above

    You can visit the ESP-IDF Programmming Guide for the installation steps.

  • Arduino IDE

    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 .

    You can also use CubeIDE or Keil for generation of .bin files.

Setting Up

  1. Wire your STM32 (e.g. Blue Pill) to the ESP32 as follows:

    ESP32 STM32
    GPIO4(TX) PA10(RX)
    GPIO5(RX) PA9(TX)
    GPIO19 RESET
    GND GND
  2. Generate a .bin file for the STM32 MCU code you want to flash.

Disclaimer

We have assumed that the STM32 is already in boot mode before flashing the code ( Step 1 & 5 insection). You can use a MOSFET as a switch to automate the process, using an ESP32 GPIO as an input.

Usage (For STM32 Blue Pill)

  1. 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.

Updating STM32 Over-The-Air using ESP32

  1. Open the project configuration menu ( idf.py menuconfig ) go to Example Connection Configuration ->
    1. WiFi SSID: WiFi network to which your PC is also connected to.
    2. WiFi Password: WiFi password

Updating STM32 Over-The-Air using ESP32

  1. In order to test the OTA demo -> /file_serving_avr :
    1. Compile and burn the firmware idf.py -p PORT -b BAUD flash
    2. Run idf.py -p PORT monitor and note down the IP assigned to your ESP module. The default port is 80.
    3. Test the example interactively on a web browser (assuming IP is 192.168.43.82):
      http://192.168.43.82/
      

Updating STM32 Over-The-Air using ESP32

  1. After clicking the flash link, you should get the following results -

Updating STM32 Over-The-Air using ESP32

  1. Revert the BOOT0 pin to its initial position and press the RESET Button on the STM32.
  2. Voila! your STM32 is now running the code you uploaded Over-the-Air!

Troubleshooting

  • Check your wiring. Make sure that the ESP32 and STM32 are powered separately. Don't power one MCU using the other.
  • Verify your WiFi SSID and password. It is a known bug that ESP32 does not connect to WiFi stations with 'space' character in the SSID or password.
  • Check if your STM32 is locked using this official tool by STMicroelectronics and unlock it by erasing the memory of your chip.
  • Check your STM32 code, which generated the .bin file, for any 'logical' errors.
  • For any other bugs or errors, you can always raise issues .

Contributors

For OTA updates for AVR MCUs, you can follow this project .

Acknowledgements

License

Distributed under the MIT License. See LICENSE for more information.


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

计算复杂性

计算复杂性

阿罗拉 巴拉克 / 骆吉洲 / 机械工业出版社 / 2016-1-1 / 129元

《计算复杂性的现代方法》是一部将所有有关复杂度知识理论集于一体的教程。将最新进展和经典结果结合起来,是一部很难得的研究生入门级教程。既是相关科研人员的一部很好的参考书,也是自学人员很难得的一本很好自学教程。本书一开始引入该领域的最基本知识,然后逐步深入,介绍更多深层次的结果,每章末都附有练习。对复杂度感兴趣的人士,物理学家,数学家以及科研人员这本书都是相当受益。一起来看看 《计算复杂性》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具