Skip to content

umarmaajid/OTA_update_AVR_using_ESP32

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stargazers Forks Issues License


Logo

OTA for AVR MCU using ESP32

Program your AVR MCU 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 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.

Code

/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

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 AVR MCU, you can use an Arduino UNO, Leonardo or MEGA.

Prerequisites

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

Setting Up

  1. 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
  2. Generate a .hex file for the AVR MCU code you want to flash. You can follow this link for instructions.

Usage

  • 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

  • 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):
      1. Open path http://192.168.43.82/ to see an HTML web page with list of files on the server (initially empty)
      2. Use the file upload form on the webpage to select and upload a .hex file to the server
      3. Click a file link to download / open the file on browser (if supported)
      4. Click the delete link visible next to each file entry to delete them
      5. Click on the flash link to flash the .hex code file uploaded to the connected AVR MCU.

  • 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!

Troubleshooting

  • Check your wiring. Make sure that the ESP32 and AVR MCU are powered separately. Don't power one MCU using the other.
  • Do not connect ESP32 pins directly to the AVR-MCU pins, as ESP32 pins are not 5V tolerant. Use a logic level convertor.
  • 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 your AVR MCU code, which generated the .hex file, for any 'logical' errors.
  • For any other bugs or errors, you can always raise issues.

Contributors

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

Acknowledgements

License

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

About

Program AVR MCUs Over-the-Air using ESP32

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 88.3%
  • HTML 5.5%
  • CMake 2.7%
  • Python 2.1%
  • Makefile 1.4%