Program your AVR MCU Over-the-Air using ESP32
View Code
·
Report Bug
·
Request Feature
·
Create a Pull Request
The project aims at enabling firmware update of AVR-powered boards Over-the-Air using ESP32.
Testing was done with ESP32-DevKitC v4 board and Arduino UNO, Leonardo and MEGA. You can try with any other AVR-powered board and let me know how it worked out.
/esp_avr_flash
-> Basic flashing utility, requires path of the .bin file which has been already uploaded in SPIFFS
/file_serving_avr
-> 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 AVR MCU, you can use an Arduino UNO, Leonardo or MEGA.
ESP-IDF v4.0 and above
You can visit the ESP-IDF Programmming Guide for the installation steps.
Arduino IDE
Not a mandatory requirement, although it is an easy way to generate the .hex files for your AVR MCU code.
Wire your AVR MCU (e.g. Arduino UNO, Leonardo, Mega, etc.) to the ESP32. All the following connections should be made through a Bi-Directional Logic Level Converter (LLC -> 5V - 3.3V).
ESP32 | LLC (L) | LLC (H) | AVR |
---|---|---|---|
3.3V | 3.3V | - | - |
- | - | 5V | 5V |
GND | GND | GND | GND |
GPIO4 (TX) | L1 | H1 | RX |
GPIO5 (RX) | L2 | H2 | TX |
GPIO19 | L3 | H3 | RESET |
Generate a .hex file for the AVR MCU code you want to flash. You can follow this link for instructions.
Open the project configuration menu (idf.py menuconfig
) go to Example Connection Configuration
->
In order to test the OTA demo -> /file_serving_avr
:
idf.py -p PORT -b BAUD flash
idf.py -p PORT monitor
and 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)
After clicking the flash link, you should get the following results -
Voila! Your AVR MCU is now running the code you uploaded Over-the-Air!
For OTA updates for STM32Fxx MCUs, you can follow this project.
GitHub Project: esp_avr_programmer by rene-win
STK500 Protocol: Documentation
Arduino StackExchange answer by Peter
Distributed under the MIT License. See LICENSE
for more information.