Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

nvs_flash_init() panics #3531

Closed
taherrera opened this issue Sep 14, 2022 · 1 comment
Closed

nvs_flash_init() panics #3531

taherrera opened this issue Sep 14, 2022 · 1 comment

Comments

@taherrera
Copy link

taherrera commented Sep 14, 2022

I have a serious problem with NVS storage. I have tried this with an ESP32-WROOM (dev module) and ESP32-WROVER (custom PCB).

NVS sometimes works, and some times it does not. In this example here, I cant even call nvs_flash_init(). I have erased_flash multiple times.

This is part of my main:

int app_main(void){

    esp_task_wdt_init(60, true); //enable panic so ESP32 restarts after 60 seconds
    esp_task_wdt_add(NULL); //add current thread to WDT watch

    int res;
    res = platform_init(&Cfg);

   // .. keeps on..
}

This is the part of the function platform_init():

int platform_init(instacrop_cfg_t * cfg){
  int res;
  if (storage_init()){
    console_printf("[E] platform.c platform_init: unable to initialize storage\n");
    return -1;
  }

  // ... keeps on..
}

This is part of my function storage_init():

int32_t storage_init(){
    esp_err_t err = nvs_flash_init();
    // .. keeps on..
}

ets Jun  8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7876
load:0x40078000,len:13724
load:0x40080400,len:4584
0x40080400: _init at ??:?

entry 0x400806f4
I (26) boot: ESP-IDF v4.2.2-276-g4e4142e 2nd stage bootloader
I (26) boot: compile time 15:11:48
I (27) boot: chip revision: 0
I (31) boot.esp32: SPI Speed      : 40MHz
I (35) boot.esp32: SPI Mode       : DIO
I (40) boot.esp32: SPI Flash Size : 4MB
I (44) boot: Enabling RNG early entropy source...
I (50) boot: Partition Table:
I (53) boot: ## Label            Usage          Type ST Offset   Length
I (61) boot:  0 nvs              WiFi data        01 02 00010000 00006000
I (68) boot:  1 otadata          OTA data         01 00 00016000 00002000
I (76) boot:  2 phy_init         RF data          01 01 00018000 00001000
I (83) boot:  3 ota_0            OTA app          00 10 00020000 00177000
I (91) boot:  4 ota_1            OTA app          00 11 001a0000 00177000
I (98) boot:  5 storage          WiFi data        01 02 00317000 00010000
I (106) boot: End of partition table
I (110) boot: ota rollback check done
I (114) esp_image: segment 0: paddr=0x00020020 vaddr=0x3f400020 size=0x1ad98 (109976) map
I (165) esp_image: segment 1: paddr=0x0003adc0 vaddr=0x3ffbdb60 size=0x02b04 ( 11012) load
I (170) esp_image: segment 2: paddr=0x0003d8cc vaddr=0x40080000 size=0x0274c ( 10060) load
0x40080000: _WindowOverflow4 at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:1821

I (176) esp_image: segment 3: paddr=0x00040020 vaddr=0x400d0020 size=0x6d82c (448556) map
0x400d0020: _stext at ??:?

I (351) esp_image: segment 4: paddr=0x000ad854 vaddr=0x4008274c size=0x10d94 ( 69012) load
0x4008274c: esp_timer_impl_update_apb_freq at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/esp_timer/src/esp_timer_impl_lac.c:192

I (392) boot: Loaded app from partition at offset 0x20000
I (392) boot: Disabling RNG early entropy source...
I (393) cpu_start: Pro cpu up.
I (396) cpu_start: Application information:
I (401) cpu_start: Project name:     instacrop_app
I (407) cpu_start: App version:      1
I (411) cpu_start: Compile time:     Sep 13 2022 20:07:05
I (417) cpu_start: ELF file SHA256:  6c9891ffff5ed808...
I (423) cpu_start: ESP-IDF:          v4.2.2-276-g4e4142e
I (429) cpu_start: Single core mode
I (434) heap_init: Initializing. RAM available for dynamic allocation:
I (441) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (447) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (453) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (459) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (465) heap_init: At 3FFCA9C8 len 00015638 (85 KiB): DRAM
I (471) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (478) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (484) heap_init: At 400934E0 len 0000CB20 (50 KiB): IRAM
I (490) cpu_start: Pro cpu start user code
I (508) spi_flash: detected chip: gd
I (509) spi_flash: flash io: dio
I (509) cpu_start: Starting scheduler on PRO CPU.
[I] platform.c platform_init: starting storage
Re-enable cpu cache.
Guru Meditation Error: Core  0 panic'ed (Cache disabled but cached memory region accessed). 

Core  0 register dump:
PC      : 0x400d5b7c  PS      : 0x00060034  A0      : 0x4008f564  A1      : 0x3ffbe230  
0x400d5b7c: xTaskIncrementTick at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/tasks.c:2733

0x4008f564: _frxt_timer_int at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/portasm.S:338

A2      : 0xe0000020  A3      : 0x00050021  A4      : 0x400814f4  A5      : 0xbfffffff  
0x400814f4: _xt_lowint1 at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:1186

A6      : 0x00000059  A7      : 0x3ffb7040  A8      : 0x8008f3f0  A9      : 0x3ffb6ea0  
A10     : 0x3ffb75d8  A11     : 0x03000248  A12     : 0x3ffb7040  A13     : 0x00000004  
A14     : 0x00000000  A15     : 0x00000001  SAR     : 0x00000016  EXCCAUSE: 0x00000007  
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000  
Core  0 was running in ISR context:
EPC1    : 0x40091cf9  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x400d5b7c
0x40091cf9: spi_flash_ll_set_read_mode at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/soc/src/esp32/include/hal/spi_flash_ll.h:271
 (inlined by) spi_flash_hal_configure_host_io_mode at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/soc/src/hal/spi_flash_hal_common.inc:89

0x400d5b7c: xTaskIncrementTick at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/tasks.c:2733


Backtrace:0x400d5b79:0x3ffbe230 0x4008f561:0x3ffbe250 0x40081556:0x3ffbe260 0x40091cf6:0x3ffb6ed0 0x40093271:0x3ffb6f00 0x4009327e:0x3ffb6f20 0x40083596:0x3ffb6f40 0x400836fd:0x3ffb6f70 0x40105c8d:0x3ffb6f90 0x401049c1:0x3ffb6fb0 0x4010513d:0x3ffb6fd0 0x401035a3:0x3ffb7030 0x40104301:0x3ffb7090 0x401045c7:0x3ffb70f0 0x4010463f:0x3ffb7120 0x401032fb:0x3ffb7140 0x4010330e:0x3ffb7160 0x400d3beb:0x3ffb7180 0x400d354d:0x3ffb71a0 0x400d3089:0x3ffb72f0 0x40100b54:0x3ffb7310
0x400d5b79: xTaskGetIdleTaskHandle at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/tasks.c:2608 (discriminator 1)

0x4008f561: _frxt_timer_int at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/portasm.S:328

0x40081556: _xt_lowint1 at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:1193

0x40091cf6: spi_flash_ll_set_read_mode at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/soc/src/esp32/include/hal/spi_flash_ll.h:262
 (inlined by) spi_flash_hal_configure_host_io_mode at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/soc/src/hal/spi_flash_hal_common.inc:89

0x40093271: spi_flash_chip_generic_config_host_io_mode at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/spi_flash/spi_flash_chip_generic.c:334

0x4009327e: spi_flash_chip_generic_read at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/spi_flash/spi_flash_chip_generic.c:146

0x40083596: esp_flash_read at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/spi_flash/esp_flash_api.c:557

0x400836fd: spi_flash_read at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/spi_flash/esp_flash_api.c:762

0x40105c8d: nvs::nvs_flash_read(unsigned int, void*, unsigned int) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_ops.cpp:76

0x401049c1: nvs::Page::readEntry(unsigned int, nvs::Item&) const at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_page.cpp:791

0x4010513d: nvs::Page::findItem(unsigned char, nvs::ItemType, char const*, unsigned int&, nvs::Item&, unsigned char, nvs::VerOffset) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_page.cpp:835
 (inlined by) nvs::Page::findItem(unsigned char, nvs::ItemType, char const*, unsigned int&, nvs::Item&, unsigned char, nvs::VerOffset) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_page.cpp:798

0x401035a3: nvs::Storage::populateBlobIndices(intrusive_list<nvs::Storage::BlobIndexNode>&) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_storage.cpp:45

0x40104301: nvs::Storage::init(unsigned int, unsigned int) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_storage.cpp:127

0x401045c7: nvs::NVSPartitionManager::init_custom(char const*, unsigned int, unsigned int) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_partition_manager.cpp:71
 (inlined by) nvs::NVSPartitionManager::init_custom(char const*, unsigned int, unsigned int) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_partition_manager.cpp:57

0x4010463f: nvs::NVSPartitionManager::init_partition(char const*) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_partition_manager.cpp:52

0x401032fb: nvs_flash_init_partition at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_api.cpp:163

0x4010330e: nvs_flash_init at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_api.cpp:168

0x400d3beb: storage_init at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../src/periph/storage.c:13

0x400d354d: platform_init at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../src/platform.c:170

0x400d3089: app_main at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../main.c:57

0x40100b54: main_task at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/esp32/cpu_start.c:623



ELF file SHA256: 6c9891ffff5ed808

Rebooting...

Some times this function works ok, and I can save a blob to the NVS, other times, I cannot save to the NVS and it panics.

The NVS also trows error when communicating via bluetooth with the ESP32, for example, this happens (most of the times) when I try to pair to the ESP32:

Re-enable cpu cache.
Guru Meditation Error: Core  0 panic'ed (Cache disabled but cached memory region accessed). 

Core  0 register dump:
PC      : 0x400d3b08  PS      : 0x00060034  A0      : 0x8008cf6a  A1      : 0x3ffbe1f0  
0x400d3b08: xQueueGenericSendFromISR at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/queue.c:987

A2      : 0x3ffb7f38  A3      : 0x3ffbe210  A4      : 0x3ffbe218  A5      : 0x3ffca254  
A6      : 0x3ff00040  A7      : 0xfffffff7  A8      : 0x80080e25  A9      : 0x3ffbe1e0  
A10     : 0x3ffb7f38  A11     : 0x3ffbe210  A12     : 0x3ffbe218  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x3ffcb1b0  SAR     : 0x0000001a  EXCCAUSE: 0x00000007  
EXCVADDR: 0x00000000  LBEG    : 0x4000164d  LEND    : 0x40001667  LCOUNT  : 0xfffffffc  
Core  0 was running in ISR context:
EPC1    : 0x40090b14  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x400d3b08
0x40090b14: spi_flash_ll_cmd_is_done at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/soc/src/esp32/include/hal/spi_flash_ll.h:86 (discriminator 1)
 (inlined by) spi_flash_hal_poll_cmd_done at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/soc/src/hal/spi_flash_hal_common.inc:31 (discriminator 1)

0x400d3b08: xQueueGenericSendFromISR at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/queue.c:987


Backtrace:0x400d3b05:0x3ffbe1f0 0x4008cf67:0x3ffbe210 0x4008d211:0x3ffbe240 0x400813ee:0x3ffbe260 0x40090b11:0x3ffcb000 0x40090952:0x3ffcb020 0x40091583:0x3ffcb040 0x4008340e:0x3ffcb060 0x40083575:0x3ffcb090 0x400fef19:0x3ffcb0b0 0x400fdc4d:0x3ffcb0d0 0x400fe3c9:0x3ffcb0f0 0x400fc9df:0x3ffcb150 0x400fcc43:0x3ffcb1a0 0x400fcf9f:0x3ffcb220 0x400fd65b:0x3ffcb290 0x400fc69f:0x3ffcb2b0 0x400f4e36:0x3ffcb2e0 0x400ebc5a:0x3ffcb340 0x400d5f01:0x3ffcb360 0x400ebead:0x3ffcb3b0 0x400ec0ea:0x3ffcb500 0x400e85a9:0x3ffcb530 0x400e96e6:0x3ffcb550
0x400d3b05: prvInitialiseMutex at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/queue.c:509
 (inlined by) prvInitialiseMutex at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/queue.c:492
 (inlined by) xQueueCreateMutex at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/queue.c:528

0x4008cf67: btdm_task_post_from_isr at ??:?

0x4008d211: r_rwbtdm_isr_wrapper at intc.c:?

0x400813ee: _xt_lowint1 at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:1193

0x40090b11: get_spi_dev at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/soc/src/hal/spi_flash_hal_common.inc:26
 (inlined by) spi_flash_hal_poll_cmd_done at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/soc/src/hal/spi_flash_hal_common.inc:31

0x40090952: spi_flash_hal_read at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/soc/src/hal/spi_flash_hal_common.inc:122

0x40091583: spi_flash_chip_generic_read at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/spi_flash/spi_flash_chip_generic.c:155

0x4008340e: esp_flash_read at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/spi_flash/esp_flash_api.c:557

0x40083575: spi_flash_read at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/spi_flash/esp_flash_api.c:762

0x400fef19: nvs::nvs_flash_read(unsigned int, void*, unsigned int) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_ops.cpp:76

0x400fdc4d: nvs::Page::readEntry(unsigned int, nvs::Item&) const at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_page.cpp:791

0x400fe3c9: nvs::Page::findItem(unsigned char, nvs::ItemType, char const*, unsigned int&, nvs::Item&, unsigned char, nvs::VerOffset) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_page.cpp:835
 (inlined by) nvs::Page::findItem(unsigned char, nvs::ItemType, char const*, unsigned int&, nvs::Item&, unsigned char, nvs::VerOffset) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_page.cpp:798

0x400fc9df: nvs::Storage::findItem(unsigned char, nvs::ItemType, char const*, nvs::Page*&, nvs::Item&, unsigned char, nvs::VerOffset) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_storage.cpp:154

0x400fcc43: nvs::Storage::cmpMultiPageBlob(unsigned char, char const*, void const*, unsigned int) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_storage.cpp:488

0x400fcf9f: nvs::Storage::writeItem(unsigned char, nvs::ItemType, char const*, void const*, unsigned int) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_storage.cpp:293
 (inlined by) nvs::Storage::writeItem(unsigned char, nvs::ItemType, char const*, void const*, unsigned int) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_storage.cpp:266

0x400fd65b: nvs::NVSHandleSimple::set_blob(char const*, void const*, unsigned int) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_handle_simple.cpp:52
 (inlined by) nvs::NVSHandleSimple::set_blob(char const*, void const*, unsigned int) at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_handle_simple.cpp:47

0x400fc69f: nvs_set_blob at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/nvs_flash/src/nvs_api.cpp:441

0x400f4e36: config_save at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/bt/common/osi/config.c:462

0x400ebc5a: btc_config_flush at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/bt/host/bluedroid/btc/core/btc_config.c:314

0x400d5f01: btc_storage_add_bonded_device at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/bt/host/bluedroid/btc/core/btc_storage.c:54

0x400ebead: btc_dm_auth_cmpl_evt at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/bt/host/bluedroid/btc/core/btc_dm.c:348 (discriminator 3)

0x400ec0ea: btc_dm_sec_cb_handler at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/bt/host/bluedroid/btc/core/btc_dm.c:656

0x400e85a9: btc_thread_handler at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/bt/common/btc/core/btc_task.c:184

0x400e96e6: osi_thread_run at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/vendors/espressif/esp-idf/components/bt/common/osi/thread.c:68



ELF file SHA256: 1208fe3531d242d9

Rebooting...

The Bluetooth works perfectly If I do NOT call nvs_flash_init .

¿What could be wrong?

@paulbartell
Copy link
Member

paulbartell commented Sep 14, 2022

@taherrera : The nvs library is part of the esp-idf distribution from Espressif.

Perhaps your question could be better handled by Espressif's support channels.

As general advice on this type of situation, you might try the following:

  1. Verify that your board / module has the correct type and size of SPI NOR that is expected by esp-idf and your sdkconfig (modules are available in a variety of flash sizes, so the default partition layout may not be suitable for your project).
  2. Check that your nvs flash area is not mapped to a portion of the flash used for code storage (by inspecting the linker and map files).
  3. Try a lower SPI flash speed (esp_flash_speed_s)
  4. Disable other portions of the software to determine if memory corruption could be the cause of the issue.

Feel free to reopen this issue if you believe this problem to be specific to amazon-freertos. Otherwise, you might find help in the FreeRTOS Community Forums.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants