Guru Meditation Error: Cache disabled but cached memory region accessed

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Guru Meditation Error: Cache disabled but cached memory region accessed

Postby ESP_Angus » Mon Nov 26, 2018 6:39 am

Hi anandvilayil,

Can you post a snippet of the code you are calling to read from flash, at the time this crash occurs?


Angus

anandvilayil
Posts: 22
Joined: Mon Apr 30, 2018 12:14 pm

Re: Guru Meditation Error: Cache disabled but cached memory region accessed

Postby anandvilayil » Mon Nov 26, 2018 6:39 am

hi,
below shows the coredump file. is this helpful ?

==================== ESP32 CORE DUMP START ====================

================== CURRENT THREAD REGISTERS ===================
pc 0x40085f97 0x40085f97 <spi_flash_op_block_func+59>
lbeg 0x0 0
lend 0x0 0
lcount 0x0 0
sar 0x0 0
ps 0x60824 395300
threadptr <unavailable>
br <unavailable>
scompare1 <unavailable>
acclo <unavailable>
acchi <unavailable>
m0 <unavailable>
m1 <unavailable>
m2 <unavailable>
m3 <unavailable>
expstate <unavailable>
f64r_lo <unavailable>
f64r_hi <unavailable>
f64s <unavailable>
fcr <unavailable>
fsr <unavailable>
a0 0x40084e02 1074286082
a1 0x3ffb9dd0 1073454544
a2 0x1 1
a3 0x1 1
a4 0x3ffb79e8 1073445352
a5 0x0 0
a6 0x0 0
a7 0x60723 395043
a8 0x0 0
a9 0x1 1
a10 0x0 0
a11 0x13000044 318767172
a12 0x3ffd4b48 1073564488
a13 0x1 1
a14 0x60820 395296
a15 0x0 0

==================== CURRENT THREAD STACK =====================
#0 0x40085f97 in spi_flash_op_block_func (arg=0x1) at /home/amruthanand/Desktop/esp32/esp-idf/components/spi_flash/cache_utils.c:82
#1 0x40084e02 in ipc_task (arg=0x1) at /home/amruthanand/Desktop/esp32/esp-idf/components/esp32/ipc.c:62
#2 0x4009378c in vPortTaskWrapper (pxCode=0x40084da0 <ipc_task>, pvParameters=0x1) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/port.c:143

======================== THREADS INFO =========================
Id Target Id Frame
23 process 22 0x400935d9 in xQueueGenericReceive (xQueue=0x3ffbd1d8, pvBuffer=0x3ffdbce0, xTicksToWait=4294967295, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
22 process 21 0x400935d9 in xQueueGenericReceive (xQueue=0x3ffb4ed8, pvBuffer=0x3ffb5e80, xTicksToWait=4294967295, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
21 process 20 0x400935d9 in xQueueGenericReceive (xQueue=0x3ffc4638 <s_timer_semaphore_memory>, pvBuffer=0x0, xTicksToWait=4294967295, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
20 process 19 0x400935d9 in xQueueGenericReceive (xQueue=0x3ffde9b4, pvBuffer=0x3ffdfdf0, xTicksToWait=4294967295, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
19 process 18 0x400935d9 in xQueueGenericReceive (xQueue=0x3fff67f4, pvBuffer=0x3ffd74c0, xTicksToWait=4294967295, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
18 process 17 0x400935d9 in xQueueGenericReceive (xQueue=0x3fff6684, pvBuffer=0x3ffd6160, xTicksToWait=4294967295, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
17 process 16 0x400935d9 in xQueueGenericReceive (xQueue=0x3fff6354, pvBuffer=0x3ffd55f0, xTicksToWait=4294967295, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
16 process 15 0x400935d9 in xQueueGenericReceive (xQueue=0x3ffe3c38, pvBuffer=0x3ffcc290, xTicksToWait=4294967295, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
15 process 14 xEventGroupWaitBits (xEventGroup=0x3ffbd1b0, uxBitsToWaitFor=239, xClearOnExit=0, xWaitForAllBits=0, xTicksToWait=4294967295) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/event_groups.c:445
14 process 13 0x40081c52 in esp_crosscore_int_send_yield (core_id=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/esp32/crosscore_int.c:112
13 process 12 xEventGroupWaitBits (xEventGroup=0x3ffbd160, uxBitsToWaitFor=128, xClearOnExit=1, xWaitForAllBits=0, xTicksToWait=4294967295) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/event_groups.c:445
12 process 11 xEventGroupWaitBits (xEventGroup=0x3ffbd160, uxBitsToWaitFor=1336, xClearOnExit=1, xWaitForAllBits=0, xTicksToWait=4294967295) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/event_groups.c:445
11 process 10 xEventGroupWaitBits (xEventGroup=0x3ffbd188, uxBitsToWaitFor=127, xClearOnExit=0, xWaitForAllBits=0, xTicksToWait=4294967295) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/event_groups.c:445
10 process 9 0x400935d9 in xQueueGenericReceive (xQueue=0x3fff2a6c, pvBuffer=0x3ffcdbe0, xTicksToWait=4294967295, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
9 process 8 0x400935d9 in xQueueGenericReceive (xQueue=0x3f805e34, pvBuffer=0x3ffde8d0, xTicksToWait=4294967295, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
8 process 7 0x40095a6a in prvProcessTimerOrBlockTask (xNextExpireTime=<optimized out>, xListWasEmpty=<optimized out>) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/timers.c:588
7 process 6 0x400935d9 in xQueueGenericReceive (xQueue=0x3ffba38c, pvBuffer=0x3ffddef0, xTicksToWait=7, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
6 process 5 0x40094a7e in vTaskDelay (xTicksToDelay=<optimized out>) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/tasks.c:1490
5 process 4 0x400935d9 in xQueueGenericReceive (xQueue=0x3fff2d50, pvBuffer=0x0, xTicksToWait=1000, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
4 process 3 0x400935d9 in xQueueGenericReceive (xQueue=0x3ffe3d28, pvBuffer=0x0, xTicksToWait=100, xJustPeeking=0) at /home/amruthanand/Desktop/esp32/esp-idf/components/freertos/queue.c:1591
3 process 2 0x400d3acc in idle_hook_cb () at /home/amruthanand/Desktop/esp32/esp-idf/components/esp32/task_wdt.c:82
2 process 1 0x401b59e2 in esp_pm_impl_waiti () at /home/amruthanand/Desktop/esp32/esp-idf/components/esp32/pm_esp32.c:474
* 1 <main task> 0x40085f97 in spi_flash_op_block_func (arg=0x1) at /home/amruthanand/Desktop/esp32/esp-idf/components/spi_flash/cache_utils.c:82

======================= ALL MEMORY REGIONS ========================
Name Address Size Attrs
.rtc.text 0x400c0000 0x0 RW
.rtc.dummy 0x3ff80000 0x0 RW
.rtc.force_fast 0x3ff80000 0x0 RW
.rtc_noinit 0x50000000 0x0 RW
.rtc.force_slow 0x50000000 0x0 RW
.iram0.vectors 0x40080000 0x400 R XA
.iram0.text 0x40080400 0x1e4a0 RWXA
.dram0.data 0x3ffbdb60 0x6198 RW A
.noinit 0x3ffc3cf8 0x0 RW
.flash.rodata 0x3f400020 0x409cc RW A
.flash.text 0x400d0018 0xe8884 R XA
.coredump.tasks.data 0x3ffb9e98 0x164 RW
.coredump.tasks.data 0x3ffb9d10 0x180 RW
.coredump.tasks.data 0x3ffbbe24 0x164 RW
.coredump.tasks.data 0x3ffbbc70 0x1ac RW
.coredump.tasks.data 0x3ffbb8b8 0x164 RW
.coredump.tasks.data 0x3ffbb710 0x1a0 RW
.coredump.tasks.data 0x3ffd27d4 0x164 RW
.coredump.tasks.data 0x3ffd2440 0x38c RW
.coredump.tasks.data 0x3ffcd4b8 0x164 RW
.coredump.tasks.data 0x3ffcd220 0x290 RW
.coredump.tasks.data 0x3ffd0e68 0x164 RW
.coredump.tasks.data 0x3ffd0ce0 0x180 RW
.coredump.tasks.data 0x3ffbd6c4 0x164 RW
.coredump.tasks.data 0x3ffddda0 0x208 RW
.coredump.tasks.data 0x3ffbc888 0x164 RW
.coredump.tasks.data 0x3ffbc6e0 0x1a0 RW
.coredump.tasks.data 0x3ffbd8dc 0x164 RW
.coredump.tasks.data 0x3ffde7d0 0x1dc RW
.coredump.tasks.data 0x3ffcde24 0x164 RW
.coredump.tasks.data 0x3ffcdab0 0x36c RW
.coredump.tasks.data 0x3ffbd39c 0x164 RW
.coredump.tasks.data 0x3ffdc410 0x190 RW
.coredump.tasks.data 0x3ffcef90 0x164 RW
.coredump.tasks.data 0x3ffcedf0 0x198 RW
.coredump.tasks.data 0x3ffd04fc 0x164 RW
.coredump.tasks.data 0x3ffd0360 0x194 RW
.coredump.tasks.data 0x3ffb7e50 0x164 RW
.coredump.tasks.data 0x3ffb7c80 0x1c8 RW
.coredump.tasks.data 0x3ffbd504 0x164 RW
.coredump.tasks.data 0x3ffdd010 0x194 RW
.coredump.tasks.data 0x3ffcc34c 0x164 RW
.coredump.tasks.data 0x3ffcc190 0x1b4 RW
.coredump.tasks.data 0x3ffd56ac 0x164 RW
.coredump.tasks.data 0x3ffd54f0 0x1b4 RW
.coredump.tasks.data 0x3ffd6218 0x164 RW
.coredump.tasks.data 0x3ffd6060 0x1b0 RW
.coredump.tasks.data 0x3ffd7584 0x164 RW
.coredump.tasks.data 0x3ffd73c0 0x1bc RW
.coredump.tasks.data 0x3ffcb1b8 0x164 RW
.coredump.tasks.data 0x3ffdfcc0 0x1e0 RW
.coredump.tasks.data 0x3ffb772c 0x164 RW
.coredump.tasks.data 0x3ffb7580 0x1a4 RW
.coredump.tasks.data 0x3ffb5f40 0x164 RW
.coredump.tasks.data 0x3ffb5d60 0x1d8 RW
.coredump.tasks.data 0x3ffbd234 0x164 RW
.coredump.tasks.data 0x3ffdbbe0 0x1bc RW

===================== ESP32 CORE DUMP END =====================

anandvilayil
Posts: 22
Joined: Mon Apr 30, 2018 12:14 pm

Re: Guru Meditation Error: Cache disabled but cached memory region accessed

Postby anandvilayil » Mon Nov 26, 2018 6:50 am

hi angus,

its happening at the time of writing into flash.
below show the portion of code.

note : at the time of function call i providing the key, data to write, and length is giving

Code: Select all

int nvswrite_byte_array(const char *key_prfx, uint8_t *array, int len)
{
    int r, j;
    nvs_handle hdl;
    esp_err_t err;
    char key[32];

    if (!key_prfx || !array || len <= 0) {
        ESP_LOGE(TAG, "%s: invalid inputs", __func__);
        return -1;
    }

    err = nvs_flash_init();
    if (err == ESP_ERR_NVS_NO_FREE_PAGES) {
        ESP_LOGE(TAG, "storage nvs wr: nvs_no_free_pages error");
        return -1;
    }
    r = -1;
    err = nvs_open("storage", NVS_READWRITE, &hdl);
    if (err != ESP_OK) {
        ESP_LOGE(TAG, "error (%d) opening NVS handle", err);
        return -1;
    }
    for (j = 0; j < len; j++) {
        snprintf(key, sizeof(key), "%s%d", key_prfx, j);
        ESP_LOGI(TAG, "writing [%s = %x] to storage nvs", key, array[j]);
        err = nvs_set_u8(hdl, key, array[j]);
        if (err != ESP_OK) {
            ESP_LOGI(TAG, "failed to update key");
            r = -1;
            break;
        } else {
            r = 0;
        }
    }

    if (r == 0) {
        err = nvs_commit(hdl);
        if (err != ESP_OK) {
            ESP_LOGI(TAG, "failed to commit nvs");
            r = -1;
        }
    }

    if (hdl) {
        nvs_close(hdl);
    }

    return r;
}

the problem is only once in a while its happening, not every time its happens,

ningappa BS
Posts: 51
Joined: Sat Mar 17, 2018 4:49 am

Re: Guru Meditation Error: Cache disabled but cached memory region accessed

Postby ningappa BS » Tue Oct 01, 2019 7:27 am

chromebin wrote:
Wed Oct 17, 2018 2:05 pm
ESP_Sprite, your diagnosis is scaringly spot on. I use SPI to stream data into a shift register, then latch that data in an SPI callback :oops:

Now with regard to the remedy.

In sdkconfig I found:

Code: Select all

#
# SPI master configuration
#
CONFIG_SPI_MASTER_IN_IRAM=
CONFIG_SPI_MASTER_ISR_IN_IRAM=y
I suppose the CONFIG_SPI_MASTER_ISR_IN_IRAM is the culprit. But I can't seem to find the menuconfig entry that modifies this setting. I find myself scanning options a lot.

I implemented the preferred remedy:

Code: Select all

//from #include "soc.h"
#define DR_REG_GPIO_BASE            0x3ff44000
//from #include "gpio_reg.h"
#define GPIO_OUT_W1TS_REG           (DR_REG_GPIO_BASE + 0x0008)
#define GPIO_OUT_W1TC_REG          (DR_REG_GPIO_BASE + 0x000c)

...

    // latch the data
    REG_WRITE(GPIO_OUT_W1TS_REG, BIT(GPIO_NUM_16));     // set
    delay_us(2);
    REG_WRITE(GPIO_OUT_W1TC_REG, BIT(GPIO_NUM_16));     // clear
I extracted the #defines from the mentioned #includes, because I have manually configured include paths (I have yet to encounter someone who has seen a properly configured Eclipse workspace). So as usual things didn't work (or maybe it was just the Eclipse side of this mess), even after adding 3 search paths (${IDF_PATH}/components/soc/include/soc, ${IDF_PATH}/components/soc/include, ${IDF_PATH}/components/soc/esp32/include/soc). Madness.

So now the above code runs, I'll report back when the errors reappear. Excellent work ESP_Sprite!
hi,
I'm unable to find

Code: Select all

# SPI master configuration
#
CONFIG_SPI_MASTER_IN_IRAM=
CONFIG_SPI_MASTER_ISR_IN_IRAM=y
in my sdk. my IDF version is 5.2

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: Guru Meditation Error: Cache disabled but cached memory region accessed

Postby rudi ;-) » Tue Oct 01, 2019 6:15 pm

ningappa BS wrote:
Tue Oct 01, 2019 7:27 am
hi,
I'm unable to find

Code: Select all

# SPI master configuration
#
CONFIG_SPI_MASTER_IN_IRAM=
CONFIG_SPI_MASTER_ISR_IN_IRAM=y
in my sdk. my IDF version is 5.2

which idf version you use? 5.2. is the toolchain version
you find the used IDF Version if you run example the hello_world with your IDF Version,
on the bootloader start comes the used IDF version as LOGI.

The version is also compiled into the firmware and can be accessed (as a string) via the macro IDF_VER.
The default ESP-IDF bootloader will print the version on boot (these versions in code will not always update, it only changes if
that particular source file is recompiled)


also:
The local ESP-IDF version can be checked using git:

Code: Select all

cd $IDF_PATH
git describe --tags --dirty
for more info you find things about "ESP-IDF Versions" in the IDF Document here example in the latest under point

Checking IDF Version

ningappa BS wrote:
Tue Oct 01, 2019 7:27 am
hi,
I'm unable to find

Code: Select all

# SPI master configuration
the CONFIG_ code is done by the Menuconfig automatically which you run at first to config the project by settings
like serial flasher , components and so on, also for specific custom things like the SPI Driver ect.
the header file is then save in the build folder under include, do not change this by hand - it is an automatically doing by Menuconfig.

you should find the SPI master configuration in menuconfig or not?
call menuconfig in your project,
go to
- Component Config
then
-Driver Configuration
then
- SPI Configuration
_spi_config_.jpg
_spi_config_.jpg (84.2 KiB) Viewed 8928 times
hope this helps now.

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

ningappa BS
Posts: 51
Joined: Sat Mar 17, 2018 4:49 am

Re: Guru Meditation Error: Cache disabled but cached memory region accessed

Postby ningappa BS » Wed Oct 02, 2019 10:19 am

hi,
sorry that was a toolchain version.
my menuconfig is different, those options are not showing. please check menuconfig screenshot.
Attachments
menuconfig.png
menuconfig.png (80.34 KiB) Viewed 8906 times

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: Guru Meditation Error: Cache disabled but cached memory region accessed

Postby rudi ;-) » Wed Oct 02, 2019 1:54 pm

ningappa BS wrote:
Wed Oct 02, 2019 10:19 am
hi,
sorry that was a toolchain version.

hi
no problem,
but what is your IDF Version :)
ningappa BS wrote:
Wed Oct 02, 2019 10:19 am
my menuconfig is different, those options are not showing. please check menuconfig screenshot.
i see your screenshoot, but i think you must say , which IDF version you use :)
that you can get help on your problem
txs
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

ningappa BS
Posts: 51
Joined: Sat Mar 17, 2018 4:49 am

Re: Guru Meditation Error: Cache disabled but cached memory region accessed

Postby ningappa BS » Fri Oct 11, 2019 4:52 am

my esp-idf version is "v3.1-dev-1334-g7cc7c8a-dirty"
could you help me on this.

Who is online

Users browsing this forum: SvanteKaiser and 116 guests