MeshCore v1.15.0 BLE companion radio firmware for the M5Stack Cardputer Advanced paired with the M5Stack Cap LoRa-1262 (SX1262, EU868).
The Cardputer-specific hardware support and keyboard UI were originally created by @Stachugit. This repo contributes it to the MeshCore v1.15.0 codebase and fixes a crash caused by excessive static DRAM usage.
| Component | Details |
|---|---|
| MCU | ESP32-S3, dual-core 240 MHz |
| Flash / PSRAM | 8 MB Flash, 8 MB PSRAM |
| LoRa | SX1262 via Cap LoRa-1262 (EU868, DIO2 RF switch, 3.3V TCXO) |
| Display | 240×135 LCD (LovyanGFX via M5Cardputer library) |
| Input | Built-in keyboard |
| GPS | ATGM336H-6N on Serial1 (G15/G13) |
| BLE | Companion pairing |
All changes are in patches/. Apply them on top of the upstream meshcore-dev/MeshCore source.
M5CardputerBoard.h— SX1262 + Cap LoRa-1262 board driver (IO expander, RF switch, TCXO)target.cpp/target.h— PlatformIO target wiringplatformio.ini— build environments for Cap LoRa-1262
M5CardputerDisplay.h/.cpp—DisplayDriverimplementation using LovyanGFX (via M5Cardputer library)
UITask.cpp/.h— keyboard-driven companion UIsettings_impl.cpp— settings screen
MyMesh.h/.cpp—saveContacts(),saveChannels(),factoryReset()moved to public;queueOutgoingMessageForBLE()addedNodePrefs.h—screen_timeout_secondsfield addedUITask.h— dispatcher:HEADLESS_UI=1→ keyboard UI, else →ui-new
The original config had 163 KB of static DRAM used (49.9% of 320 KB), leaving insufficient room for the BLE stack and runtime heap. Fixed by:
MAX_CONTACTS: 200 → 100OFFLINE_QUEUE_SIZE: 256 → 64- Removed unused
lvgllib_dep (display uses LovyanGFX, not LVGL) - Removed
CONFIG_BT_*build flags that are IDF sdkconfig options and have no effect in Arduino mode - Disabled
MESH_DEBUGin production
Result: static RAM 163 KB → 111 KB (34%), freeing 52 KB headroom.
Requires PlatformIO.
git clone https://github.com/meshcore-dev/MeshCore.git
cd MeshCore
# Clone patches alongside
git clone https://github.com/hdcasey/meshcore-cardputer-adv.git patches_repo
# Apply patches
cp patches_repo/patches/boards/m5stack_cardputer.json boards/
cp patches_repo/patches/variants/m5stack_cardputer/platformio.ini variants/m5stack_cardputer/
cp patches_repo/patches/variants/m5stack_cardputer/M5CardputerBoard.h variants/m5stack_cardputer/
cp patches_repo/patches/variants/m5stack_cardputer/target.cpp variants/m5stack_cardputer/
cp patches_repo/patches/variants/m5stack_cardputer/target.h variants/m5stack_cardputer/
cp patches_repo/patches/variants/m5stack_cardputer/test_main.cpp variants/m5stack_cardputer/
cp patches_repo/patches/src/helpers/ui/M5CardputerDisplay.cpp src/helpers/ui/
cp patches_repo/patches/src/helpers/ui/M5CardputerDisplay.h src/helpers/ui/
cp patches_repo/patches/examples/companion_radio/MyMesh.cpp examples/companion_radio/
cp patches_repo/patches/examples/companion_radio/MyMesh.h examples/companion_radio/
cp patches_repo/patches/examples/companion_radio/NodePrefs.h examples/companion_radio/
cp patches_repo/patches/examples/companion_radio/UITask.h examples/companion_radio/
mkdir -p examples/companion_radio/ui-keyboard
cp patches_repo/patches/examples/companion_radio/ui-keyboard/UITask.cpp examples/companion_radio/ui-keyboard/
cp patches_repo/patches/examples/companion_radio/ui-keyboard/UITask.h examples/companion_radio/ui-keyboard/
cp patches_repo/patches/examples/companion_radio/ui-keyboard/settings_impl.cpp examples/companion_radio/ui-keyboard/
# Build
pio run -e M5stack_cardputer_cap_lora1262_companionesptool.py --chip esp32s3 --port /dev/ttyACM0 --baud 460800 \
write_flash --flash_mode keep --flash_size 8MB \
0x0 M5stack_cardputer_cap_lora1262_companion-v1.15.0-merged.binmacOS:
/dev/cu.usbmodem*
To enter bootloader mode: hold G0 (bottom-left keyboard key) and press Reset, then release.
esptool.py --chip esp32s3 --port /dev/ttyACM0 --baud 460800 \
write_flash --flash_mode keep --flash_size 8MB \
0x0 bootloader.bin \
0x8000 partitions.bin \
0x10000 firmware.binSet node name, region (EU_868), and BLE PIN (default 123456) via the MeshCore companion app on Android/iOS.
- MeshCore by meshcore-dev
- MeshCore-Cardputer-ADV by Stachugit — original hardware support and keyboard UI
- RadioLib
- M5Cardputer by M5Stack
- QRcodeDisplay by yoprogramo