SwagBadge2022 Firmware

From Open Hardware Miniconf
Jump to: navigation, search

The preferred software environment for the SwagBadge is MicroPython. The badges have MicroPython installed as part of the testing process, but you may need to (re)install it to make sure you have a consistent environment.

The following sequence will fetch all the resources required including Aiko Engine, flash the badge with the correct version of MicroPython, and install the firmware.

 mkdir SwagBadge2022                                   # Create a directory to keep everything in
 cd SwagBadge2022                                      # Change into it
 git clone git@github.com:geekscape/aiko_engine_mp.git # Get Aiko Engine
 git clone git@github.com:geekscape/aiko_services.git  # Get Aiko Services, which has fun examples
 python3 -m venv aiko_env                              # Create a virtual Python environment for Aiko use
 . aiko_env/bin/activate                               # Activate the venv just created
 pip install esptool mpfshell                          # Install tools we need
 python3.9 -m pip install --upgrade pip                # To prevent it complaining every time!
 cd aiko_engine_mp                                     #
 mkdir firmware                                        # Create a directory to hold firmware

Download version v1.17 of the MicroPython binary for ESP32 from here: micropython.org/download/esp32/

The SwagBadge 2022 currently requires microPython version 1.17.

Move the downloaded binary into the "firmware" directory that you created above.

Plug in your ESP32 device and make sure you can see it, e.g ls -l /dev/tty.* will show a serial device file like /dev/ttyUSB0 or /dev/tty.wchserial1410.

Export the serial port to an environment variable, so mpfshell can use it, e.g:

 export AMPY_PORT=/dev/tty.wchserial11410

where the device is the one shown by the ls -l command above.

 ./scripts/flash_micropython.sh                        # Flash MicroPython onto the badge