Skip to content

ESP-IDF v 5.x and M5Unified not working #199

@KondratevAD

Description

@KondratevAD

Hi. I'm trying to flash the m5basic with this example using the display.
I use VS Code + ESP-IDF.
I added arduino as a component, and M5Unified, M5GFX from component registry. When I flash the device, everything is fine, but it keeps restarting and the monitor displays an error and the device doesn't work.

Are there any examples of usage for ESP-IDF, sdkconfig and source code?

ESP-IDF v5.3.1
Arduino-ESP32 v3.3.2
M5Unified v0.2.7
M5GFX v0.2.9

main.cpp

#include "Arduino.h"

#include "M5Unified.h"
#include "M5GFX.h"

void setup()
{
    auto cfg = M5.config();
    M5.begin(cfg);
    delay(500);
    M5.Display.fillScreen(TFT_BLACK);
    M5.Display.setCursor(10, 10);
    M5.Display.setTextColor(WHITE);
    M5.Display.setTextSize(1);
    M5.Display.print("Initializing...");
}

void loop()
{
    M5.update();
    delay(1000);
} 
Monitor Error ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:6216
load:0x40078000,len:16004
load:0x40080400,len:4
--- 0x40080400: _init at ??:?

load:0x40080404,len:3620
entry 0x400805bc
W (29) boot: Unicore bootloader
I (163) cpu_start: Unicore app
I (163) cpu_start: Single core mode
I (171) cpu_start: Pro cpu start user code
I (171) cpu_start: cpu freq: 240000000 Hz
I (171) app_init: Application information:
I (176) app_init: Project name: project-name1
I (181) app_init: App version: 1
I (186) app_init: Compile time: Nov 6 2025 12:10:32
I (192) app_init: ELF file SHA256: 907198111...
I (197) app_init: ESP-IDF: v5.3.1-dirty
I (202) efuse_init: Min chip rev: v0.0
I (207) efuse_init: Max chip rev: v3.99
I (212) efuse_init: Chip rev: v1.0
I (217) heap_init: Initializing. RAM available for dynamic allocation:
I (224) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (230) heap_init: At 3FFB3448 len 0002CBB8 (178 KiB): DRAM
I (236) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (243) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (249) heap_init: At 4008F6D0 len 00010930 (66 KiB): IRAM
I (255) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (262) spi_flash: detected chip: generic
I (266) spi_flash: flash io: qio
I (271) main_task: Started on CPU0
I (274) main_task: Calling app_main()
tart ========task: Returned =========== Bfrom app_mefore Setup Sain()

Chip Info:

Model : ESP32
Package : D0WD-Q6
Revision : 1.00
Cores : 2
CPU Frequency : 240 MHz
XTAL Frequency : 40 MHz
Features Bitfield : 0x00000032
Embedded Flash : No
Embedded PSRAM : No
2.4GHz WiFi : Yes
Classic BT : Yes
BT Low Energy : Yes
IEEE 802.15.4 : No

INTERNAL Memory Info:

Total Size : 428488 B ( 418.4 KB)
Free Bytes : 400904 B ( 391.5 KB)
Allocated Bytes : 23176 B ( 22.6 KB)
Minimum Free Bytes: 400872 B ( 391.5 KB)
Largest Free Block: 163840 B ( 160.0 KB)

Flash Info:

Chip Size : 4194304 B (4 MB)
Block Size : 65536 B ( 64.0 KB)
Sector Size : 4096 B ( 4.0 KB)
Page Size : 256 B ( 0.2 KB)
Bus Speed : 80 MHz
Flash Frequency : 80 MHz (source: 80 MHz, divider: 1)
Bus Mode : QIO

Partitions Info:

            nvs : addr: 0x00009000, size:    24.0 KB, type: DATA, subtype: NVS
       phy_init : addr: 0x0000F000, size:     4.0 KB, type: DATA, subtype: PHY
        factory : addr: 0x00010000, size:  1024.0 KB, type:  APP, subtype: FACTORY

Software Info:

Compile Date/Time : Nov 6 2025 12:33:38
ESP-IDF Version : v5.3.1-dirty
Arduino Version : 3.3.2

Board Info:

Arduino Board : M5STACK_CORE_DEV
Arduino Variant : m5stack_core
Arduino Runs Core : 0
Arduino Events on : 0
CDC On Boot : 0
============ Before Setup End ============
�Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

Core 0 register dump:
PC : 0x400d9405 PS : 0x00060f30 A0 : 0x800dc0fd A1 : 0x3ffb78f0
--- 0x400d9405: unsigned long lgfx::v1::color_conv_t::convert<int, decltype(nullptr)>(int) at E:/<->/project-name1/managed_components/m5stack__m5gfx/src/lgfx/v1/misc/colortype.hpp:859
(inlined by) void lgfx::v1::LGFXBase::setColor(int) at E:/<->/project-name1/managed_components/m5stack__m5gfx/src/lgfx/v1/LGFXBase.hpp:123
(inlined by) void lgfx::v1::LGFXBase::fillScreen(int const&) at E:/<->/project-name1/managed_components/m5stack__m5gfx/src/lgfx/v1/LGFXBase.hpp:299
(inlined by) setup() at E:/<->/project-name1/main/main.cpp:329

A2 : 0x00000001 A3 : 0x00000003 A4 : 0x00000001 A5 : 0xffffffff
A6 : 0x00000000 A7 : 0x3ffb2794 A8 : 0x800d9402 A9 : 0x3ffb78d0
A10 : 0x000003e8 A11 : 0x3ffb792c A12 : 0x0000001c A13 : 0x3ffb790c
A14 : 0x00000000 A15 : 0x00000080 SAR : 0x0000001f EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000040 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
--- 0x4000c2e0: memcpy in ROM
0x4000c2f6: memcpy in ROM

Backtrace: 0x400d9402:0x3ffb78f0 0x400dc0fa:0x3ffb7950 0x400889b2:0x3ffb7970
--- 0x400d9402: setup() at E:/<->/project-name1/main/main.cpp:329
0x400dc0fa: loopTask(void*) at E:/<->/project-name1/components/arduino/cores/esp32/main.cpp:67
0x400889b2: vPortTaskWrapper at E:/Espressif/frameworks/esp-idf-v5.3.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134

ELF file SHA256: 907198111

Rebooting...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions