InstructionFetchError When using WiFi and writing to SD card

40Below
Posts: 3
Joined: Thu Mar 16, 2023 10:16 pm

InstructionFetchError When using WiFi and writing to SD card

Postby 40Below » Tue Sep 26, 2023 5:05 pm

I have a data logging device that is writing JSON data to an SD card at a regular interval. When I don't enable WiFi the device has logged data to the SD card for multiple days without any issues. If I connect the device to WiFi I get the following core dump after an inconsistent amount of time but it's typically 1-3 hours:

Code: Select all

Guru Meditation Error: Core  0 panic'ed (InstructionFetchError). Exception was unhandled.

Core  0 register dump:
PC      : 0x3ffd8838  PS      : 0x00060830  A0      : 0x8019e664  A1      : 0x3ffd37b0  
A2      : 0xffffffff  A3      : 0x3f8470dc  A4      : 0x00000009  A5      : 0x00000004  
A6      : 0x40148600  A7      : 0x00000008  A8      : 0x801a316c  A9      : 0x3ffd8838  
0x40148600: queue_send_wrapper at C:/idf/esp-idf-v4.4.4/components/esp_wifi/esp32/esp_adapter.c:413
A10     : 0x3f8470c4  A11     : 0x3f8470dc  A12     : 0x00000009  A13     : 0x00000004  
A14     : 0x000000f2  A15     : 0x000000a4  SAR     : 0x00000010  EXCCAUSE: 0x00000002  
EXCVADDR: 0x3ffd8838  LBEG    : 0x4008c9d6  LEND    : 0x4008c9e1  LCOUNT  : 0x00000000  
0x4008c9d6: memset at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/memset.S:150
0x4008c9e1: memset at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/memset.S:160


Backtrace: 0x3ffd8835:0x3ffd37b0 |<-CORRUPTED
Disabling CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP seemed to make the crash take longer to occur so I suspect that PSRAM might have something to do with the issue but I'm not sure how.

40Below
Posts: 3
Joined: Thu Mar 16, 2023 10:16 pm

Re: InstructionFetchError When using WiFi and writing to SD card

Postby 40Below » Thu Sep 28, 2023 2:07 pm

Incase anyone comes across this in the future with the same issue, I believe I discovered my problem. I setup cJSON hooks to use heap_caps_malloc into SPIRAM and after adding IRAM_ATTR to my hooks I haven't seen the crash again yet.

Who is online

Users browsing this forum: No registered users and 16 guests