An admin web page for M5StickC Plus2 with MicroPython.
Use this as a base for your projects.
- Flash your device with MicroPython. See more about below.
- Create local Python environment:
pip3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt- Use VS Code tasks or copy the files directly:
rshell --port /dev/ttyACM0 --baud 115200 cp -r cplus2_admin/* /pyboard- Boot your device if VS Code task was not used:
rshell --port /dev/ttyACM0 --baud 115200 repl '~ import machine ~ machine.reset()'clear: delete all files on the flashcopy: copy all the files to the flashlist: list files on flash (non recursive)repl: connect to MicroPython REPLrun: runcopytask and restart deviceshell: startsrshellshell
Change port and baud rate if needed:
"env": {
"PORT": "/dev/ttyACM0",
"BAUDRATE": "115200"
}-
Clone idf repository and make it shell-accessible:
$ git clone -b v5.0.4 --recursive https://github.com/espressif/esp-idf.git $ cd esp-idf $ git checkout v5.0.4 $ git submodule update --init --recursive $ ./install.sh # (or install.bat on Windows) $ source export.sh # (or export.bat on Windows)
You will need to run
source export.shfor every new session. -
Clone MicroPython repository and checkout to the supported version:
$ git clone https://github.com/micropython/micropython $ cd ./micropython $ git checkout v1.23.0 -
Compile cross compiler:
$ make -C mpy-cross
-
Enter esp32 port folder:
$ cd ./ports/esp32 -
MicroPython builds for 4MB flashes by default. To use all the 8MB from ESP32-PICO-V3-02 flash, change the lines
95-97of fileboards/sdkconfig.basefromCONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MiB.csv"to
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MiB.csv" -
Compile for board
ESP32_GENERIC-SPIRAM:$ make submodules $ make BOARD=ESP32_GENERIC BOARD_VARIANT=SPIRAM
Note: MicroPython with SPIRAM variant uses the PSRAM as available RAM. This increases the RAM to 2MB, however it is slower than the 520KB SRAM. If you need more speed, remove
BOARD_VARIANT=SPIRAMfrom all commands, but some functions will not work due the buffer size needed. -
Flash device (change port if needed):
$ make PORT=/dev/ttyACM0 erase $ make BOARD=ESP32_GENERIC BOARD_VARIANT=SPIRAM PORT=/dev/ttyACM0 deploy
The following modules are derived from third-party sources:
colors: from https://github.com/gandro/micropython-m5stickc-pluslogging: from https://github.com/micropython/micropython-libmpu6886: from https://github.com/tuupola/micropython-mpu6886pcf8563: from https://github.com/gandro/micropython-m5stickc-plusst7789: from https://github.com/gandro/micropython-m5stickc-plustime: from https://github.com/micropython/micropython-libtinyweb: from https://github.com/belyalov/tinyweb
