M5Stack Core 2 guru meditation during sprite create

Hi,

I’m using a M5Stack Core 2 board and the Arduino framework and need to use sprites for display but my code (simple demo code from M5Stack) always crashes with Guru Meditation Error. The crash occurs in the line:

 img.createSprite(320, 240);    //Create a 320x240 canvas

I don’t understand what I’m doing wrong?

platformio.ini

[env:m5stack-core2]
platform = espressif32
board = m5stack-core2
framework = arduino
lib_deps = m5stack/M5Core2
monitor_speed = 115200

main.cpp

#include <M5Core2.h>
#include <Arduino.h>

TFT_eSprite img = TFT_eSprite(&M5.Lcd);

void setup() {
    // Init Serial
  Serial.begin(115200);
  Serial.println("Starting...");
  
  // Sprite Test
  M5.begin();  //Initialize M5Core2
  img.createSprite(320, 240);    //Create a 320x240 canvas
  img.fillSprite(RED);    //Fill the canvas with red
  img.fillCircle(100,100,20,GREEN);
  img.pushSprite(0, 0, GREEN);    //Push the canvas to Screen(0,0) and set white as the penetration color
}

void loop() {
  // put your main code here, to run repeatedly:
}

Monitor output
rst:0x1 (POWERON_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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8
S�M5Core2 initializing…axp: vbus limit off
axp: gpio1 init
axp: gpio2 init
axp: rtc battery charging enabled
axp: esp32 power voltage was set to 3.35v
axp: lcd backlight voltage was set to 2.80v
axp: lcd logic and sdcard voltage preset to 3.3v
axp: vibrator voltage preset to 2v
touch: FT6336 ready (fw id 0x10 rel 1, lib 0x300E)
OK
Guru Meditation Error: Core 1 panic’ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC : 0x4008c6e9 PS : 0x00060134 A0 : 0x8008e722 A1 : 0x3ffb1e70
A2 : 0x37735134 A3 : 0x0000abab A4 : 0xb33fffff A5 : 0x00000001
A6 : 0x00060f20 A7 : 0x0000cdcd A8 : 0x400d9ccc A9 : 0x3ffb1f60
A10 : 0x3f41567c A11 : 0x00000069 A12 : 0x3f4159b0 A13 : 0x3f415708
A14 : 0x3ffc0a00 A15 : 0x00000000 SAR : 0x0000001c EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x40088f78 LEND : 0x40088f94 LCOUNT : 0x00000000

ELF file SHA256: 0000000000000000

Backtrace: 0x4008c6e9:0x3ffb1e70 0x4008e71f:0x3ffb1ea0 0x4008ed49:0x3ffb1ec0 0x400819a5:0x3ffb1ee0 0x40081b7c:0x3ffb1f00 0x400815af:0x3ffb1f20 0x400d5a3a:0x3ffb1f40 0x400d5ab6:0x3ffb1f60 0x400d13fb:0x3ffb1f80 0x400d81d6:0x3ffb1fb0 0x4008b6b6:0x3ffb1fd0

Core 0 register dump:
PC : 0x400fba1a PS : 0x00060b34 A0 : 0x800e7b56 A1 : 0x3ffbc1b0
A2 : 0x00000000 A3 : 0x00000001 A4 : 0x00000000 A5 : 0x00000001
A6 : 0x00060d20 A7 : 0x00000000 A8 : 0x800e784a A9 : 0x3ffbc180
A10 : 0x00000000 A11 : 0x40085ba8 A12 : 0x00060d20 A13 : 0x3ffbb910
A14 : 0x3ffc0ccc A15 : 0x3ffc0cd0 SAR : 0x00000000 EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000

ELF file SHA256: 0000000000000000

Backtrace: 0x400fba1a:0x3ffbc1b0 0x400e7b53:0x3ffbc1d0 0x4008ce71:0x3ffbc1f0 0x4008b6b6:0x3ffbc210

Rebooting…

Please activate the backtrace decoder and debug mode so that we know where it crashes.

monitor_filters = esp32_exception_decoder
build_type = debug

Reupload + monitor again

Here is the output with activated backtrace decoder & debug mode:

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8
SM5Core2 initializing...axp: vbus limit off
axp: gpio1 init
axp: gpio2 init
axp: rtc battery charging enabled
axp: esp32 power voltage was set to 3.35v
axp: lcd backlight voltage was set to 2.80v
axp: lcd logic and sdcard voltage preset to 3.3v
axp: vibrator voltage preset to 2v
touch: FT6336 ready (fw id 0x10 rel 1, lib 0x300E)
OK
Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC      : 0x4008c6e9  PS      : 0x00060134  A0      : 0x8008e722  A1      : 0x3ffb1e70  
A2      : 0x37735134  A3      : 0x0000abab  A4      : 0xb33fffff  A5      : 0x00000001  
A6      : 0x00060f20  A7      : 0x0000cdcd  A8      : 0x400dabc0  A9      : 0x3ffb1f60  
A10     : 0x3f415dc4  A11     : 0x00000069  A12     : 0x3f4160f8  A13     : 0x3f415e50  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x0000001c  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x40088f78  LEND    : 0x40088f94  LCOUNT  : 0x00000000  

ELF file SHA256: 0000000000000000

Backtrace: 0x4008c6e9:0x3ffb1e70 0x4008e71f:0x3ffb1ea0 0x4008ed49:0x3ffb1ec0 0x400819a5:0x3ffb1ee0 0x40081b7c:0x3ffb1f00 0x400815af:0x3ffb1f20 0x400d6742:0x3ffb1f40 0x400d6861:0x3ffb1f60 0x400d1499:0x3ffb1f80 0x400d90ca:0x3ffb1fb0 0x4008b6b6:0x3ffb1fd0
  #0  0x4008c6e9:0x3ffb1e70 in vPortCPUAcquireMutexIntsDisabledInternal at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:3507
      (inlined by) vPortCPUAcquireMutexIntsDisabled at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/portmux_impl.h:98
      (inlined by) vTaskEnterCritical at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:4201
  #1  0x4008e71f:0x3ffb1ea0 in multi_heap_internal_lock at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/multi_heap.c:402
  #2  0x4008ed49:0x3ffb1ec0 in multi_heap_malloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/multi_heap_poisoning.c:305
  #3  0x400819a5:0x3ffb1ee0 in heap_caps_malloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c:215
  #4  0x40081b7c:0x3ffb1f00 in heap_caps_calloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c:325
  #5  0x400815af:0x3ffb1f20 in ps_calloc at C:\Users\grobot\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-psram.c:66
  #6  0x400d6742:0x3ffb1f40 in TFT_eSprite::callocSprite(short, short, unsigned char) at .pio\libdeps\m5stack-core2\M5Core2\src\utility/Sprite.cpp:850 (discriminator 1)
  #7  0x400d6861:0x3ffb1f60 in TFT_eSprite::createSprite(short, short, unsigned char) at .pio\libdeps\m5stack-core2\M5Core2\src\utility/Sprite.cpp:850 (discriminator 1)
  #8  0x400d1499:0x3ffb1f80 in setup() at src/main.cpp:13
  #9  0x400d90ca:0x3ffb1fb0 in loopTask(void*) at C:\Users\grobot\.platformio\packages\framework-arduinoespressif32\cores\esp32/main.cpp:18
  #10 0x4008b6b6:0x3ffb1fd0 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)      

Core 0 register dump:
PC      : 0x400fd676  PS      : 0x00060b34  A0      : 0x800e8a4a  A1      : 0x3ffbc1b0  
A2      : 0x00000000  A3      : 0x00000001  A4      : 0x00000000  A5      : 0x00000001
A6      : 0x00060d20  A7      : 0x00000000  A8      : 0x800e873e  A9      : 0x3ffbc180
A10     : 0x00000000  A11     : 0x40085ba8  A12     : 0x00060d20  A13     : 0x3ffbb910
A14     : 0x3ffc0ccc  A15     : 0x3ffc0cd0  SAR     : 0x00000000  EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000

ELF file SHA256: 0000000000000000

Backtrace: 0x400fd676:0x3ffbc1b0 0x400e8a47:0x3ffbc1d0 0x4008ce71:0x3ffbc1f0 0x4008b6b6:0x3ffbc210
  #0  0x400fd676:0x3ffbc1b0 in esp_pm_impl_waiti at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/pm_esp32.c:492
  #1  0x400e8a47:0x3ffbc1d0 in esp_vApplicationIdleHook at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/freertos_hooks.c:86
  #2  0x4008ce71:0x3ffbc1f0 in prvIdleTask at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:3507
  #3  0x4008b6b6:0x3ffbc210 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)      

Rebooting...

Hm, calling ps_calloc crashed.

Are you using the new Arduino-ESP32 2.0.1 core with PlatformIO? Did a CLIpio platform update espressif32?

Uh, I’m very sorry!
After updating the Espressif Platform from 3.5.0 to 4.2.0 everything works fine!

Thanks @maxgerhardt

1 Like