Tutorial: First Flash on M5Stack Core2
In this tutorial you will flash PylotOS onto an M5Stack Core2 over USB-C and verify the C HAL, PSRAM, and Dual-OTA partitions live in the MicroPython REPL.
Step 1: Identify Your Core2 Hardware Revision
M5Stack Core2 exists in two hardware revisions that use different Power Management ICs (PMICs):
| Visual Check | Revision | PMIC at I2C 0x34 | Notes |
|---|---|---|---|
| Green power LED | Core2 v1.0 | AXP192 | Original release |
| Blue power LED | Core2 v1.1 | AXP2101 + INA3221 (0x40) | Includes dedicated RTC backup cell |
PylotOS uses a single unified m5stack_core2 firmware designed to auto-detect both revisions at runtime.
Step 2: Obtain the Full Flash Image (*-full.bin)
- Download the
pylotos-m5stack_core2-firmwareartifact from the latest green CI run under Actions (or from a GitHub Release once published). - Extract
pylotos-m5stack_core2-<version>-full.bin.
Important: Always use
*-full.binfor initial USB flashing. Never flash*-ota.binto address0x1000—*-ota.bincontains only the application partition image for wireless OTA updates.
Step 3: Flash Over USB-C with esptool
Install esptool and mpremote (in your Python environment):
pip install esptool mpremote
Erase the previous flash layout (recommended when switching from UIFlow/Arduino to PylotOS's 16 MiB Dual-OTA partition table) and flash PylotOS at offset 0x1000:
# Replace COM3 with your serial port (e.g., /dev/ttyUSB0 or /dev/cu.usbserial-* on Linux/macOS)
esptool --chip esp32 --port COM3 erase_flash
esptool --chip esp32 --port COM3 --baud 921600 write_flash 0x1000 pylotos-m5stack_core2-0.1.0-ci-full.bin
Step 4: Verify in the MicroPython REPL
Connect to the serial console using mpremote:
mpremote connect COM3 repl
Press Enter to see the >>> prompt, then run:
import json
import pylot
import hal
import sys_ota
# Inspect board identity, live PSRAM, and Dual-OTA partition state
print(json.dumps(pylot.describe()))
# Check hardware capability flags
print("Has display:", hal.has_cap("display"))
print("Has PSRAM: ", hal.has_cap("psram"))
# Inspect active and next OTA slots
print("OTA status: ", sys_ota.status())
Expected Output Highlights
board_id:"m5stack_core2"memory.psram_bytes:8388608(8 MiB PSRAM active!)ota.running_slot:"ota_0"andnext_slot:"ota_1"(Dual-OTA partition table active!)