NVS initialization fails

jwachsmuth
Posts: 1
Joined: Fri Jul 05, 2024 9:20 am

NVS initialization fails

Postby jwachsmuth » Fri Jul 05, 2024 9:51 am

Hi, I have the following problem:

Code: Select all

Guru Meditation Error: Core  0 panic'ed (Cache disabled but cached memory region accessed). 

Core  0 register dump:
PC      : 0x40187fa8  PS      : 0x00060e34  A0      : 0x800833c2  A1      : 0x3ffbb250  
A2      : 0x3ffb0188  A3      : 0xffffffff  A4      : 0x00000000  A5      : 0x00060e23  
A6      : 0x00000001  A7      : 0x0000cdcd  A8      : 0x8008ee4a  A9      : 0xb33fffff  
A10     : 0x3ffb0188  A11     : 0xb33fffff  A12     : 0x0000cdcd  A13     : 0x3ffbb170  
A14     : 0x00000003  A15     : 0x00060023  SAR     : 0x00000010  EXCCAUSE: 0x00000007  
EXCVADDR: 0x00000000  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000  


Backtrace: 0x40187fa5:0x3ffbb250 0x400833bf:0x3ffbb280 0x400891d3:0x3ffbb2a0 0x4008a7a6:0x3ffbb2c0 0x40088f0b:0x3ffbb2e0 0x4008911d:0x3ffbb300 0x4016d1f5:0x3ffbb330 0x4010106f:0x3ffbb390 0x4016d441:0x3ffbb3d0 0x4016d5d7:0x3ffbb480 0x4016d6d3:0x3ffbb4a0 0x4016d733:0x3ffbb4c0 0x4010091c:0x3ffbb4e0 0x400ff264:0x3ffbb500 0x400fd58b:0x3ffbb530 0x400fd5b6:0x3ffbb560 0x400d6504:0x3ffbb580 0x4018f03f:0x3ffbb6b0 0x4008ec1a:0x3ffbb6e0
  #0  0x40187fa5 in esp_cpu_set_breakpoint at build/pio/packages/framework-espidf/components/esp_hw_support/cpu.c:359
  #1  0x400833bf in xPortEnterCriticalTimeoutSafe at build/pio/packages/framework-espidf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:585
      (inlined by) vPortEnterCriticalSafe at build/pio/packages/framework-espidf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:592
      (inlined by) esp_ipc_isr_stall_other_cpu at build/pio/packages/framework-espidf/components/esp_system/port/esp_ipc_isr.c:113
  #2  0x400891d3 in Cache_Flush at build/pio/packages/framework-espidf/components/esp_rom/include/esp32/rom/cache.h:140
  #3  0x4008a7a6 in cache_sync at build/pio/packages/framework-espidf/components/esp_mm/cache_esp32.c:29
  #4  0x40088f0b in s_do_cache_invalidate at build/pio/packages/framework-espidf/components/esp_mm/esp_mmu_map.c:378
  #5  0x4008911d in s_do_mapping at build/pio/packages/framework-espidf/components/esp_mm/esp_mmu_map.c:432
  #6  0x4016d1f5 in esp_mmu_map at build/pio/packages/framework-espidf/components/esp_mm/esp_mmu_map.c:571
  #7  0x4010106f in spi_flash_mmap at build/pio/packages/framework-espidf/components/spi_flash/flash_mmap.c:85
  #8  0x4016d441 in load_partitions at build/pio/packages/framework-espidf/components/esp_partition/partition.c:103
  #9  0x4016d5d7 in ensure_partitions_loaded at build/pio/packages/framework-espidf/components/esp_partition/partition.c:259
  #10 0x4016d6d3 in esp_partition_find at build/pio/packages/framework-espidf/components/esp_partition/partition.c:288
  #11 0x4016d733 in esp_partition_find_first at build/pio/packages/framework-espidf/components/esp_partition/partition.c:344
  #12 0x4010091c in nvs::partition_lookup::lookup_nvs_partition(char const*, nvs::NVSPartition**) at build/pio/packages/framework-espidf/components/nvs_flash/src/nvs_partition_lookup.cpp:14
  #13 0x400ff264 in nvs::NVSPartitionManager::init_partition(char const*) at build/pio/packages/framework-espidf/components/nvs_flash/src/nvs_partition_manager.cpp:46
  #14 0x400fd58b in nvs_flash_init_partition at build/pio/packages/framework-espidf/components/nvs_flash/src/nvs_api.cpp:135 (discriminator 1)
  #15 0x400fd5b6 in nvs_flash_init at build/pio/packages/framework-espidf/components/nvs_flash/src/nvs_api.cpp:163
  #16 0x400d6504 in app_main at src/main.cpp:48
  #17 0x4018f03f in main_task at build/pio/packages/framework-espidf/components/freertos/app_startup.c:208
  #18 0x4008ec1a in vPortTaskWrapper at build/pio/packages/framework-espidf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:134
That occurs while initializing nvs and here is the code that is executed before initialization:

Code: Select all

void app_main() {
	ESP_ERROR_CHECK(esp_eventLoop_create_default());
	
	esp_chip_info_t chip_info;
	esp_chip_info(&chip_info);
	ESP_LOGD(LOGTAG, "IDF version: %s", IDF_VER);
	ESP_LOGD(LOGTAG, "ESP32 cores: %u", chip_info.cores);
	
	esp_err_t err = nvs_flash_init();
	ESP_ERROR_CHECK(err);
	
	[...]
}
I also tried a different project that used nvs, but that project works
Attachments
sdkconfig.txt
this is the sdkconfig of the project
(54.97 KiB) Downloaded 65 times

ESP_rrtandler
Posts: 24
Joined: Wed May 31, 2023 6:54 pm

Re: NVS initialization fails

Postby ESP_rrtandler » Wed Jul 17, 2024 8:03 am

HI @jwachsmuth,

I would suggest first commenting out the

Code: Select all

ESP_ERROR_CHECK(esp_eventLoop_create_default());
to see if there is an interference between the nvs initialisation and anything, that may be already running in parallel to it from the event loop. Then you may simply swap the order of the lines, do nvs initialisation first and then create event loop.

If this doesn't help, you may consider posting the content of partition table as well as the code of

Code: Select all

esp_eventLoop_create_default()
+ related event loop handlers.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 262 guests