adafruit / Adafruit_LvGL_Glue

“Glue” library between LittlevGL and Adafruit GFX (SPITFT)
Other
35 stars 14 forks source link

ESP32 crashes during initialisation #23

Open CoretechR opened 1 year ago

CoretechR commented 1 year ago

With the latest version 2.1.6 of the Glue library, the ESP32 crashes while initialising LVGL (after calling glue.begin). I am using a Sparkfun ESP32 Thing which uses a ESP32-D0WDQ6.

I tested it with this modified example:

#include <Adafruit_LvGL_Glue.h> // Glue library header INCLUDE THIS FIRST!
#include <lvgl.h>               // LittlevGL header
#include <Adafruit_ILI9341.h>

#define TFT_CS 5
#define TFT_DC 17
#define TFT_MOSI 23
#define TFT_SCK 18

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCK);
Adafruit_LvGL_Glue glue;

void setup() {

  tft.begin(); // Initialize display
  glue.begin(&tft); // Initialize glue, passing in address of display

  // Create simple label centered on screen
  lv_obj_t *label = lv_label_create(lv_scr_act());
  lv_label_set_text(label, "Hello World!");
  lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
}

void loop() {
  lv_task_handler(); // Call LittleVGL task handler periodically
  delay(5);
}

And I get this error:

Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400ecc53  PS      : 0x00060830  A0      : 0x800ecc7d  A1      : 0x3ffc5930  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x00000000  
A6      : 0x3ffbd7e4  A7      : 0x00000000  A8      : 0x00000000  A9      : 0x00000000  
A10     : 0x00000480  A11     : 0x00000000  A12     : 0x00000000  A13     : 0x00000001  
A14     : 0x00060c20  A15     : 0x00000001  SAR     : 0x0000001b  EXCCAUSE: 0x0000001d  

Using version 2.1.4 the same code runs just fine. So I am assuming this has to do with the changes for the latest ESP32-x platforms.

brentru commented 12 months ago

@CoretechR Which version of LVGL are you using?

CoretechR commented 12 months ago

@brentru Both the recommended version 8.2.0 as well as the latest version 8.3.9 show the same behavior.

cheops commented 8 months ago

you should not call lv_task_handler() in loop and all other calls to lv_... functions should be guarded as described here https://github.com/adafruit/Adafruit_LvGL_Glue?tab=readme-ov-file#notes-for-esp32