https://docs.micropython.org/en/latest/esp32/quickref.html https://www.digikey.ca/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce
(--no-root do not install the source code, but only the dependencies)
poetry install --no-root
Using pyenv-virtualenv micropython: pyenv virtualenv activate micropython
pip install -r requirements.txtIn libs directory, clone the following repos:
- [email protected]:miguelgrinberg/microdot.git
- [email protected]:adafruit/Adafruit_CircuitPython_MIDI.git
They will be added to the frozen part of the custom firmware.
Erase and flash on ESP32 (option to erase at the same time is not working) WARNING: Using more recent firmware (or custom) is not working yet
esptool.py --port /dev/tty.usbserial-0001 erase_flash
esptool.py --port /dev/tty.usbserial-0001 --chip esp32 --baud 460800 write_flash -z 0x1000 firmware/esp32-20210902-v1.20.0.binFlash only the micropython firmware (keep boot and data)
Example using OTA firmware in ota_0 partition
esptool.py --port /dev/tty.usbserial-0001 --chip esp32 --baud 460800 write_flash -z 0x10000 build/GENERIC_OTA/micropython.binBuilding in docker image:
docker build -f firmware/Dockerfile -t midigoat .
docker run --rm -ti --volume $PWD/firmware:/root/export midigoat /bin/bash -c "cp /micropython/ports/esp32/build-GENERIC/firmware.bin /root/export/esp32-generic-midigoat.bin"Copy build directory locally
docker run --rm -ti --volume $PWD/build:/root/export midigoat /bin/bash -c "cp -R /micropython/ports/esp32/build-GENERIC_OTA /root/export/GENERIC_OTA"Firmware is located in the image at /micropython/ports/esp32/build-GENERIC/firmware.bin
ampy --port /dev/tty.usbserial-0001 run src/main.pyDon't forget to remove pyc files!
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rfampy --port /dev/tty.usbserial-0001 put src/wifi.py /wifi.py
ampy --port /dev/tty.usbserial-0001 put src/midicontroller /midicontroller
ampy --port /dev/tty.usbserial-0001 put banks_dir /banks_dir
ampy --port /dev/tty.usbserial-0001 put src/main.py /main.pyor from the rshell
rsync data/presets /pyboard/presets
mkdir /pyboard/banks
rsync data/banks_existenza/00.Generic /pyboard/banks/generic
rsync data/banks_existenza/00.Generic /pyboard/banks/generic
rsync data/banks_existenza /pyboard/banks
rsync src/midicontroller /pyboard/midicontroller
cp src/wifi.py /pyboard/
cp src/main.py /pyboard/
screen /dev/tty.usbserial-0001 115200exit with Ctrl-A; Ctrl-\
rshell -p /dev/tty.usbserial-0001exit with Ctrl-D
from rshell
replexit with Ctrl-X
mpremote connect /dev/tty.usbserial-0001
Then start aiorepl prompt (Long press button 4)
From REPL
import uos
fs_stat = uos.statvfs('/')
fs_size = fs_stat[0] * fs_stat[2]
fs_free = fs_stat[0] * fs_stat[3]
print("File System Size {:,} - Free Space {:,}".format(fs_size, fs_free))R-Tx = 10 Ohm
R-V3.3 = 47 Ohm
Note: Connect 74HC165 to Pin D3 (GPIO0) make the board fail to boot.
https://github.com/adafruit/Adafruit_CircuitPython_MIDI
- added
__str__toMIDIMessage,ProgramChangeandControlChangeclasses
https://github.com/dhylands/python_lcd
Long press open a setup menu:
- Connect Home Wifi
- Create own Wifi
- Start/Stop Web Server
- Start/Stop Bluetooth
- Start REPL (AsyncIO)
- Quit setup menu
- Create manifest files for frozen code: https://docs.micropython.org/en/latest/reference/manifest.html#high-level-functions
- Implement OTA firmware update:
- Freeze static files: