Firmware for M5Stack Cardputer ADV (ESP32-S3)
NEW: This firmware can now be loaded as a sideloadable application through Bruce Firmware!
- Run Ultimatum firmware without replacing your base firmware
- Easy installation via SD card
- Switch between firmwares on the fly
📖 Quick Start: 3-Step Installation Guide
📖 Full Guide: Complete Sideload Documentation
Use the copilot/optimize-flashing-to-sd-card branch for the latest stable version with SD card support and optimized memory usage.
This branch includes:
- ✅ Optimized partition scheme for 16MB flash
- ✅ SD card support for external data storage
- ✅ Reduced flash memory usage
- ✅ OTA update capability
- Device: M5Stack Cardputer ADV
- MCU: ESP32-S3-WROOM-1-N16R8
- Flash: 16MB
- PSRAM: 8MB
- Display: 1.14" LCD (240x135)
- Keyboard: Full QWERTY matrix
- SD Card: microSD card slot (optional but recommended)
This firmware uses an optimized partition scheme that allocates:
- App partitions: 2 × 3.75MB (for OTA updates)
- SPIFFS: ~8.5MB (for file storage)
- NVS: 20KB (for settings)
- Total: Efficient use of 16MB flash
To avoid running out of flash memory:
- Insert a microSD card into your Cardputer's SD slot
- The firmware will automatically detect and mount it
- Store large files, assets, and data on the SD card
- Flash memory is reserved for firmware only
Benefits of using SD card:
- Prevents "out of memory" errors during flashing
- Store unlimited data externally
- Easy to swap and backup data
- Faster development iterations
📖 For detailed SD card setup instructions, see docs/SD_CARD_SETUP.md
Option 1: Sideload via Bruce Firmware (Recommended for Testing)
- No need to replace your existing firmware
- Easy to switch between firmwares
- Keep Bruce Firmware as your base system
- 📖 Complete Sideload Guide
Option 2: Direct Flash (Standalone)
- Replace existing firmware completely
- Full control over the device
- Use instructions below
# Install PlatformIO
pip install platformio
# Build firmware
pio run
# Flash to device (connect via USB-C)
pio run --target upload
# Monitor serial output
pio device monitor- Install PlatformIO IDE extension
- Open project folder
- Click "Build" (✓) in toolbar
- Click "Upload" (→) to flash
- Click "Serial Monitor" (🔌) to view output
- Main code:
src/main.cpp - Drivers:
drivers/cardputer_adv_driver.cpp - Utilities:
lib/utilities.cpp
The firmware automatically initializes the SD card on boot. You can use it to:
- Store configuration files
- Save logs and debug data
- Store images, fonts, and other assets
- Cache downloaded data
Example code to write to SD card:
#include <SD.h>
// Write to SD card
File file = SD.open("/data/myfile.txt", FILE_WRITE);
if (file) {
file.println("Hello from Cardputer!");
file.close();
}
// Read from SD card
file = SD.open("/data/myfile.txt");
if (file) {
while (file.available()) {
Serial.write(file.read());
}
file.close();
}- Full M5Unified library integration
- USB CDC serial debugging
- Keyboard input handling
- LCD display control
- 16MB Flash + 8MB PSRAM support
- SD card support for external storage
- Optimized partition scheme for memory efficiency
If you encounter memory errors during flashing:
- Make sure you're using the
copilot/optimize-flashing-to-sd-cardbranch - The custom partition scheme (
default_16MB.csv) is now optimized for your device - Insert an SD card to store data externally instead of in flash
- Clean and rebuild:
pio run --target clean && pio run
If the SD card isn't mounting:
- Ensure the SD card is properly inserted
- Try formatting the card as FAT32
- Check the serial monitor for initialization messages
- Some SD cards may need lower SPI speeds (already set to 25MHz)
The firmware uses a custom 16MB partition scheme:
- Located in:
default_16MB.csv - Configured in:
platformio.ini - Provides optimal space allocation for OTA updates and storage
See LICENSE file for details.