In my project I'm using SPIFFS and some FreeRTOS tasks. One of this tasks (its LCD library) uses callback for ticks:
https://github.com/espressif/esp-idf/bl ... ooks.h#L90
Problem: each tasks works fine separatly. But when I'm trying use both I got crash:
Code: Select all
Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region
accessed)
Core 0 register dump:
PC : 0x400d632c PS : 0x00060034 A0 : 0x8008dcd5 A1 : 0x3f
fc05a0
0x400d632c: callback_tick_task at C:/Projects/ESP32/Projects/LCD_project/main/lvgl_tf
t.c:599
A2 : 0x00000001 A3 : 0x00000000 A4 : 0x00060920 A5 : 0x00
000001
A6 : 0x00060923 A7 : 0x00060023 A8 : 0x80081cc4 A9 : 0x3f
fc4728
A10 : 0x00000003 A11 : 0x00060923 A12 : 0x00060920 A13 : 0x00
000001
A14 : 0x00060920 A15 : 0x3ffbcac1 SAR : 0x00000017 EXCCAUSE: 0x00
000007
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00
000000
Core 0 was running in ISR context:
EPC1 : 0x400838e9 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x40
0d632c
0x400838e9: spi_flash_op_block_func at C:/Projects/ESP32/TOOLS/esp-idf/component
s/spi_flash/cache_utils.c:82 (discriminator 1)
0x400d632c: callback_tick_task at C:/Projects/ESP32/Projects/LCD_project/main/lvgl_tf
t.c:599
Backtrace: 0x400d632c:0x3ffc05a0 0x4008dcd2:0x3ffc05c0 0x4008e56f:0x3ffc05e0 0x4
008f0e5:0x3ffc0600 0x400825f2:0x3ffc0610 0x400838e6:0x00000000
0x400d632c: callback_tick_task at C:/Projects/ESP32/Projects/LCD_project/main/lvgl_tf
t.c:599
0x4008dcd2: xTaskIncrementTick at C:/Projects/ESP32/TOOLS/esp-idf/components/fre
ertos/tasks.c:3564
0x4008e56f: xPortSysTickHandler at C:/Projects/ESP32/TOOLS/esp-idf/components/fr
eertos/port.c:374
0x4008f0e5: _frxt_timer_int at C:/Projects/ESP32/TOOLS/esp-idf/components/freert
os/portasm.S:303
0x400825f2: _xt_lowint1 at C:/Projects/ESP32/TOOLS/esp-idf/components/freertos/x
tensa_vectors.S:1105
0x400838e6: spi_flash_op_block_func at C:/Projects/ESP32/TOOLS/esp-idf/component
s/spi_flash/cache_utils.c:81
Rebooting...
Code: Select all
static void callback_tick_task(void)
{
custom_tick_inc(portTICK_RATE_MS);
}
Code: Select all
void my_1_task(void* arg)
{
. . .
esp_register_freertos_tick_hook(callback_tick_task);
while(1)
{
vTaskDelay(1);
task_1_handler();
}
}
Code: Select all
void my_2_task (void *arg)
{
uint32_t cnt = 0;
while(1)
{
cnt++;
if(cnt > 2) // each 2 seconds switch file
{
load_file_from_spiffs(my_files[file_id]);
file_id++;
cnt = 0;
//just a loop for loading files
if(file_id >= 4) file_id = 0;
}
vTaskDelay(1000);
}
}
Also I have read this article:
https://docs.espressif.com/projects/esp ... n-accessed
Looks like reason of crash is because task_2 (reading file) disables others tasks until flash operations are in progress.
But I'm not sure where and how apply recommended attribute ESP_INTR_FLAG_IRAM (I suppose I have apply it to callback_tick_task function?).