I'm trying to access the SD Card to display images in LVGL on my CYD and getting 'Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.'
My code is this:
#include <lvgl.h>
#include <TFT_eSPI.h>
#include <XPT2046_Touchscreen.h>
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
WiFiMulti WiFiMulti;
#include <tr064.h>
#include <JSON_Decoder.h>
#include <WiFiUdp.h>
#include <OpenWeather.h>
#include <NTPClient.h>
#define XPT2046_MOSI 32
#define XPT2046_MISO 39
#define XPT2046_CLK 25
#define XPT2046_CS 33
void setup() {
Serial.begin(115200); /* prepare for possible serial debug */
FATFS fatfs;
FIL fil; // File handle
Serial.print(F("Step1 "));
FRESULT r = f_mount(&fatfs, "0:", 1); // 0: mounts to the Flash
Serial.print(F("Step2 "));
if (r != FR_OK)
{
Serial.print(F("Error, f_mount failed with error code: "));
Serial.println(r, DEC);
while (1)
yield();
}
else
Serial.println(F("f_mount successful"));
// Check the image file is there
r = f_open(&fil, "favicon.bin", FA_READ);
if (r != FR_OK) {
Serial.printf("f_open error (%i)\r\n");
} else
Serial.printf("I was able to open 'favicon.bin' for reading!\r\n");
f_close(&fil);
/** Initialise LVGL FatFs Handler **/
lv_fs_fatfs_init();
}
void loop() {
}
It crashes after step 1:
EXCVADDR: 0x00000000 LBEG : 0x4008ad61 LEND : 0x4008ad71 LCOUNT : 0xfffffffe
Backtrace: 0x40138591:0x3ffb0140 0x4013650d:0x3ffb0160 0x401379f4:0x3ffb01a0 0x400d370a:0x3ffb01e0 0x40109d76:0x3ffb2290
ELF file SHA256: 3fbd51baa6baa155
Rebooting...
From ESP Exception decoder I get:
- 0x40138591: ff_disk_initialize at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/fatfs/diskio/diskio.c:62
- 0x4013650d: find_volume at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/fatfs/src/ff.c:3258
- 0x401379f4: f_mount at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/fatfs/src/ff.c:3536
...