Description
Executing basic LVGL code (v8.3.6 from SquareLine) generate a StoreProhibited exception in function
static bool lv_timer_exec(lv_timer_t * timer) (file lv_timer.c) at line :
if(timer->timer_cb && original_repeat_count != 0) timer->timer_cb(timer);
Guru Meditation Error: Core 1 panic’ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4011fc08 PS : 0x00060430 A0 : 0x800df4c2 A1 : 0x3ffb1c60
A2 : 0x00000000 A3 : 0x00000010 A4 : 0x00000320 A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x4acf4acf A9 : 0x00004acf
A10 : 0x00000000 A11 : 0x0000031f A12 : 0x3ffc4224 A13 : 0x00000013
A14 : 0x00000004 A15 : 0x3ffc32a8 SAR : 0x00000012 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x4008788e LEND : 0x40087899 LCOUNT : 0x00000000
What MCU/Processor/Board and compiler are you using?
I’m using ESP32 with RA8875 and Arduino IDE 2.2.1
What do you want to achieve?
LVGL not crashing with basic code
What have you tried so far?
In lv_conf.h I tried #define LV_TICK_CUSTOM with values 0 or 1 (and removing or adding lv_tick_inc() function in my code). Same result.
In lv_conf.h I tried to change #define LV_MEM_SIZE (48U * 1024U) with value 32U * 1024U. Same result.
It’s like if the lv_timer_t pointer was not initialized. Perhaps I have to add something in the code ?
I already spend a few days reading LVGL documentation and trying to understand why it is crashing.
Thank you very much for your help !
Code to reproduce
#include <lvgl.h>
#include <ui.h>
#include <stdint.h>
#include <SPI.h>
#include <Wire.h>
#include "Adafruit_GFX.h"
#include "Adafruit_RA8875.h"
//EP32 PINS
#define RA8875_INT 2
#define RA8875_CS 5
#define RA8875_RESET 4
#define RA8875_SCLK 18
#define RA8875_DO 19
#define RA8875_DI 23
#define GSL1680_WAKE 32
#define GSL1680_INT 33
hw_timer_t * timerTick = NULL; // Timer for LVGL Tick
//Screen size
static const uint16_t screenWidth = 800;
static const uint16_t screenHeight = 480;
Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS, RA8875_RESET);
static lv_disp_draw_buf_t draw_buf;
static lv_color_t *buf1 = (lv_color_t*) heap_caps_malloc(screenWidth * screenHeight / 10, MALLOC_CAP_SPIRAM );
#if LV_USE_LOG != 0
/* Serial debugging */
void my_print(const char * buf)
{
Serial.printf(buf);
Serial.flush();
}
#endif
void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p)
{
//Function I wrote for RA8875
lv_disp_flush_ready(disp); /* Indicate you are ready with the flushing*/
}
void my_touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
//Function I wrote for GSLX680 Touch pad
}
//Function for lv_tick_inc
static void lv_tick_handler()
{
lv_tick_inc(5);
}
void setup()
{
Serial.begin(115200);
SPI.begin(RA8875_SCLK, RA8875_DO, RA8875_DI, -1);
Wire.begin(); // join i2c bus (address optional for master)
while (!tft.begin(RA8875_800x480))
{
Serial.println("RA8875 Not Found!");
delay(100);
}
Serial.println("Found RA8875");
tft.displayOn(true);
tft.GPIOX(true); // Enable TFT - display enable tied to GPIOX
tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight
tft.PWM1out(255);
tft.fillScreen(RA8875_WHITE);
tft.graphicsMode();
timerTick = timerBegin(0, 80, true);
timerAttachInterrupt(timerTick, &lv_tick_handler, true);
timerAlarmWrite(timerTick, 5000, true); //5ms
timerAlarmEnable(timerTick);
lv_init();
#if LV_USE_LOG != 0
lv_log_register_print_cb( my_print ); /* register print function for debugging */
#endif
lv_disp_draw_buf_init(&draw_buf, buf1, NULL, screenWidth * screenHeight / 10); //Initialize the display buffer.
/*Initialize the display*/
static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register( &disp_drv );
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init( &indev_drv );
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register( &indev_drv );
ui_init();
}
void loop()
{
lv_timer_handler(); // let the GUI do its work
delay(5);
}