Coder Social home page Coder Social logo

asterics / esp32_addon_bootloader Goto Github PK

View Code? Open in Web Editor NEW
1.0 8.0 1.0 55 KB

Bootloader code for updating the esp32_mouse_keyboard firmware via FABI/FLipMouse

License: GNU General Public License v3.0

CMake 4.40% Makefile 0.97% C 70.46% Python 9.13% C++ 13.67% Shell 1.38%

esp32_addon_bootloader's Introduction

esp32_addon_bootloader

Bootloader code for updating the esp32_mouse_keyboard firmware via FABI/FLipMouse

Because we have to frequently change the Bluetooth code from the esp32_mouse_keyboard repository AND there is not enough space to keep 2 versions of this code, we need a small bootloader (this repo) for flashing a new image.

Notes on esp32miniBT & Arduino Nano RP2040 Connect

Because this firmware is used for updating the ESP32 code on our own esp32miniBT board (addon to FLipMouse, FLipPad and FABI) as well as on the Arduino Nano RP2040 Connect, there are some differences in the setup:

  • The partitions.csv is different, because a WROOM32 has 4MB flash, the uBlox Nina module on the Arduino only 2MB. If you need more space for your program, you can adjust the partitions.csv file to have a bigger ota partition.
  • Pinning: we use GPIO27 for the red LED on the Arduino board, on the esp32miniBT it is GPIO5 in reversed polarity.
  • Arduino: please load the esp32_addon_bootloader.ino file on the Arduino and connect D2 with GND to reset the ESP32 into download mode. Then proceed with the Setup.
  • ESP32-logging: sdkconfig.default disables all the esp-idf logging by default. If necessary, change in menuconfig.

Please select in idf.py menuconfig which board is used!

Setup

This firmware is flashed as usual, with a serial-to-usb converter and the idf.py command: idf.py -b 115200 -p /dev/ttyUSB0 build flash

(Baudrate can be higher, but the Arduino sketch for serial passthrough is setup to 115k2)

Afterwards, the esp32 addon should be mounted on a FLipMouse/FABI device. This device should support the AT UG command.

Procedure

  1. Open the FLipMouse / FABI serial port
  2. If necessary, check if the communication works with AT (should return OK)
  3. Send the AT UG command. This command sends the $UG command to the esp32_mouse_keyboard firmware, which marks this factory partition for boot and restarts.
  4. The device switches to transparent UART mode (all data from the USB port is sent to the esp32 addon and vice versa) and changes the baud rate to 500kBaud/s
  5. If there was already a flashed esp32_mouse_keyboard image, you should see OTA:starting; if not, OTA:write-error is received (this bootloader does not handle the $UG command)
  6. Wait until OTA:ready is received, otherwise the update won't work.
  7. Send the binary image to the USB serial port (it is possible to use the update.py script)
  8. The firmware will be transmitted.
  9. If successful, you should see the esp32_mouse_keyboard running and a status message OTA:$FINISHED (still with 500kBaud)
  10. FLipMouse/FABI switches back automatically to 9600Baud/s and returns to normal functional state.

update.py

Python 3 script for simply sending the binary image to a UART interface. Please install pyserial library. Usage: python3 update.py <COM port> <path to binary image>

Acknowledgements

Thanks to Espressif for the native_ota example which was used for this project. Testing and adopting was done by Junaid Akhter Khan and Benjamin Aigner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.