NVDS MAGIC FAILED issue with latest esp-idf

Lucas.Hutchinson
Posts: 79
Joined: Tue Apr 26, 2016 5:10 am

NVDS MAGIC FAILED issue with latest esp-idf

Postby Lucas.Hutchinson » Wed Feb 22, 2017 11:19 pm

Hi all,

I am having trouble with using the ble GATT_Server and GATT_Client examples with the latest esp-idf (commits after 61c7bd3).

No matter what i try i always seem to get the error "NVDS MAGIC FAILED".

I have tried:
Erasing the esp32 flash using: "make erase_flash"
Cleaning the project then rebuilding: "make clean" then "make flash -j8" and also "make clean" then "make flash"
Deleting the repository then getting a fresh clone, doing "make menuconfig" then "make flash -j8"

Below is a dump of the uart output:

Code: Select all

rst:0x10 (RTCWDT_RTC_RESET),boot:0x16 (SPI_FAST_FLASH_BOOT)<\r><\n>
configsip: 0, SPIWP:0x00<\r><\n>
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00<\r><\n>
mode:DIO, clock div:2<\r><\n>
load:0x3fff0008,len:8<\r><\n>
load:0x3fff0010,len:3488<\r><\n>
load:0x40078000,len:7636<\r><\n>
ho 0 tail 12 room 4<\r><\n>
load:0x40080000,len:252<\r><\n>
entry 0x40080034<\r><\n>
<27>[0;32mI (46) boot: ESP-IDF v2.0-rc1-114-gc057f06 2nd stage bootloader<27>[0m<\r><\n>
<27>[0;32mI (47) boot: compile time 12:14:13<27>[0m<\r><\n>
<27>[0;32mI (47) boot: Enabling RNG early entropy source...<27>[0m<\r><\n>
<27>[0;32mI (67) boot: SPI Speed      : 40MHz<27>[0m<\r><\n>
<27>[0;32mI (80) boot: SPI Mode       : DIO<27>[0m<\r><\n>
<27>[0;32mI (92) boot: SPI Flash Size : 4MB<27>[0m<\r><\n>
<27>[0;32mI (105) boot: Partition Table:<27>[0m<\r><\n>
<27>[0;32mI (116) boot: ## Label            Usage          Type ST Offset   Length<27>[0m<\r><\n>
<27>[0;32mI (139) boot:  0 nvs              WiFi data        01 02 00009000 00006000<27>[0m<\r><\n>
<27>[0;32mI (162) boot:  1 phy_init         RF data          01 01 0000f000 00001000<27>[0m<\r><\n>
<27>[0;32mI (185) boot:  2 factory          factory app      00 00 00010000 00100000<27>[0m<\r><\n>
<27>[0;32mI (208) boot: End of partition table<27>[0m<\r><\n>
<27>[0;32mI (221) boot: Disabling RNG early entropy source...<27>[0m<\r><\n>
<27>[0;32mI (238) boot: Loading app partition at offset 00010000<27>[0m<\r><\n>
<27>[0;32mI (1276) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512) <27>[0m<\r><\n>
<27>[0;32mI (1277) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x2ad44 (175428) map<27>[0m<\r><\n>
<27>[0;32mI (1293) boot: segment 2: paddr=0x0004ad54 vaddr=0x3ffc0000 size=0x01dc0 (  7616) load<27>[0m<\r><\n>
<27>[0;32mI (1323) boot: segment 3: paddr=0x0004cb1c vaddr=0x40080000 size=0x00400 (  1024) load<27>[0m<\r><\n>
<27>[0;32mI (1347) boot: segment 4: paddr=0x0004cf24 vaddr=0x40080400 size=0x120f4 ( 73972) load<27>[0m<\r><\n>
<27>[0;32mI (1408) boot: segment 5: paddr=0x0005f020 vaddr=0x400c0000 size=0x00000 (     0) load<27>[0m<\r><\n>
<27>[0;32mI (1409) boot: segment 6: paddr=0x0005f028 vaddr=0x00000000 size=0x00fe0 (  4064) <27>[0m<\r><\n>
<27>[0;32mI (1431) boot: segment 7: paddr=0x00060010 vaddr=0x400d0018 size=0x62370 (402288) map<27>[0m<\r><\n>
<27>[0;32mI (1459) heap_alloc_caps: Initializing. RAM available for dynamic allocation:<27>[0m<\r><\n>
<27>[0;32mI (1481) heap_alloc_caps: At 3FFCB880 len 00014780 (81 KiB): DRAM<27>[0m<\r><\n>
<27>[0;32mI (1502) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM<27>[0m<\r><\n>
<27>[0;32mI (1524) heap_alloc_caps: At 400924F4 len 0000DB0C (54 KiB): IRAM<27>[0m<\r><\n>
<27>[0;32mI (1544) cpu_start: Pro cpu up.<27>[0m<\r><\n>
<27>[0;32mI (1556) cpu_start: Starting app cpu, entry point is 0x40080b04<27>[0m<\r><\n>
<27>[0;32mI (0) cpu_start: App cpu up.<27>[0m<\r><\n>
<27>[0;32mI (1588) cpu_start: Pro cpu start user code<27>[0m<\r><\n>
<27>[0;32mI (1649) cpu_start: Starting scheduler on PRO CPU.<27>[0m<\r><\n>
BTDM CONTROLLER VERSION: 010101<\r><\n>
btip start<\r><\n>
copy .data from 4000d890 to 3ffae6I , lencpu_018rt<\r> Set .bsg schedrom 3ffb8PP  PU.<27>[0m<\r>f70, len 00007f70<\r><\n>
BTDM ROM VERSION 0101<\r><\n>
BD_ADDR: 24:0A:C4:04:79:DA<\r><\n>
NVDS MAGIC FAILED<\r><\n>
RF Init OK with coex<\r><\n>
As soon as I go back to commit 61c7bd3 this error doesn't happen, all i have to do is go back to this commit, then do "make menuconfig", "make clean" then "make flash -j8" and the example starts up correctly.

Please let me know if there is any other information i can provide.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: NVDS MAGIC FAILED issue with latest esp-idf

Postby ESP_igrr » Thu Feb 23, 2017 12:28 am

We have a fix for this issue, as soon as it passes QA it will be available in GitHub master.

Lucas.Hutchinson
Posts: 79
Joined: Tue Apr 26, 2016 5:10 am

Re: NVDS MAGIC FAILED issue with latest esp-idf

Postby Lucas.Hutchinson » Thu Feb 23, 2017 12:34 am

That's great news!
Thanks for the quick reply.

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: NVDS MAGIC FAILED issue with latest esp-idf

Postby dave111 » Fri Mar 03, 2017 2:10 am

Hi
I'm also running into "NVDS MAGIC FAILED" with gatt_client. When will the fix become available? Thank you.

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: NVDS MAGIC FAILED issue with latest esp-idf

Postby dave111 » Tue Mar 07, 2017 6:42 am

Hello, I continue to have this NVDS MAGIC FAILED issue and it totally prevents me from doing any work on my project. Can someone please explain what this is and what is causing it? Is a fix still coming?

Is there anything I can try myself to solve this? In very seldom cases, I seem to get past the NVDS MAGIC FAILED message. But I am then unable to figure out what I did to cause this. And all of the next attempts then fail again. Please help.

ESP_Tianhao
Posts: 28
Joined: Thu Jan 05, 2017 10:46 am

Re: NVDS MAGIC FAILED issue with latest esp-idf

Postby ESP_Tianhao » Tue Mar 07, 2017 9:34 am

Hi, this is not a error.
This log is printed by rom code. Bluetooth have it's own NVDS(flash operations) in rom codes. But we haven't use this NVDS right now This NVDS is used for store BT/BLE key and other things. If you don't care that automatically connect after reset, please ignore this log. So it will not cause any problem.
Actually, we use NVS instead of NVDS to store Classic BT/BLE key, but this function is not in MASTER now.

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: NVDS MAGIC FAILED issue with latest esp-idf

Postby dave111 » Tue Mar 07, 2017 10:33 am

So should I just ignore "NVDS MAGIC FAILED"? Any idea why, as soon as I flash gatt_client, I run into a crash/restart loop like below? I update esp-idf often and this issue started about a weeks ago. gatt_client just won't start up any more.

I (44) boot: ESP-IDF v2.0-rc1-224-gc06cc31 2nd stage bootloader
I (45) boot: compile time 17:51:07
I (45) boot: Enabling RNG early entropy source...
I (65) boot: SPI Speed : 40MHz
I (78) boot: SPI Mode : DIO
I (90) boot: SPI Flash Size : 4MB
I (103) boot: Partition Table:
I (114) boot: ## Label Usage Type ST Offset Length
I (137) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (160) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (183) boot: 2 factory factory app 00 00 00010000 00100000
I (206) boot: End of partition table
I (219) boot: Disabling RNG early entropy source...
I (237) boot: Loading app partition at offset 00010000
I (1276) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512)
I (1277) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x2ae4c (175692) map
I (1294) boot: segment 2: paddr=0x0004ae5c vaddr=0x3ffc0000 size=0x01e20 ( 7712) load
I (1323) boot: segment 3: paddr=0x0004cc84 vaddr=0x40080000 size=0x00400 ( 1024) load
I (1347) boot: segment 4: paddr=0x0004d08c vaddr=0x40080400 size=0x12290 ( 74384) load
I (1409) boot: segment 5: paddr=0x0005f324 vaddr=0x400c0000 size=0x00000 ( 0) load
I (1410) boot: segment 6: paddr=0x0005f32c vaddr=0x00000000 size=0x00cdc ( 3292)
I (1432) boot: segment 7: paddr=0x00060010 vaddr=0x400d0018 size=0x62954 (403796) map
I (1459) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (1482) heap_alloc_caps: At 3FFCB8E0 len 00014720 (81 KiB): DRAM
I (1502) heap_alloc_caps: At 3FFE8000 len 00018000 (96 KiB): D/IRAM
I (1524) heap_alloc_caps: At 40092690 len 0000D970 (54 KiB): IRAM
I (1545) cpu_start: Pro cpu up.
I (1556) cpu_start: Starting app cpu, entry point is 0x40080b0c
I (0) cpu_start: App cpu up.
I (1588) cpu_start: Pro cpu start user code
I (1649) cpu_start: Starting scheduler on PRO CPU.
BTDM CONTROLLER VERSION: 010101
btip start
copy .data from 4000d890 to ffae6eI, len 00u_183r
70, len 00007f70m rffb800P tPU3
BTDM ROM VERSION 0101
BD_ADDR: 18:FE:3A:1A:AA:A1
NVDS MAGIC FAILED
RF Init OK with coex

FATAL: term closed

ESP_Tianhao
Posts: 28
Joined: Thu Jan 05, 2017 10:46 am

Re: NVDS MAGIC FAILED issue with latest esp-idf

Postby ESP_Tianhao » Tue Mar 07, 2017 10:37 am

I have try the GATT_SERVER demo after commit (61c7bd3), there's no problem in mine.
After this commit, we change something about RF/PHY initialize flow and maybe do some change about NVS.
I think you should erase all the flash , then download the ESP-IDF bin.

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: NVDS MAGIC FAILED issue with latest esp-idf

Postby dave111 » Tue Mar 07, 2017 3:38 pm

Let me point out that I am not the author of the first message of this thread. I jumped in because I am also seeing the "NVDS MAGIC FAILED" message. Not sure if this is the exact same issue, as reported by the other person.

So here is the thing:

- Running gatt_client ONCE is causing "NVDS MAGIC FAILED" on all successive attempts to run gatt_client. Simple as that.

- I found out how to reliably break out of this situation: by running "make erase_flash" and then again "make flash". This let's me run gatt_client once again without problems. But when I then reset the device (or turn it off and on again) it will again abort during startup, showing that "NVDS MAGIC FAILED" message. So I have to "erase_flash" and "flash" every time, only to run the app one more time.

Q:

- Any idea why running a BTLE client (and interrupting it at some point, possibly while it is connected to a gatt_server) will cause "NVDS MAGIC FAILED" message to occur on every successive restart of the device?

- What is the exact meaning of "NVDS MAGIC FAILED"? Can you think of a way to "fix NVDS MAGIC" - other than to use erase_flash and re-flashing the app?

Thank you very much.

dave111
Posts: 45
Joined: Fri Mar 03, 2017 1:37 am

Re: NVDS MAGIC FAILED issue with latest esp-idf

Postby dave111 » Wed Mar 08, 2017 10:09 am

I have to apologize. Please ignore my two previous postings. The voodoo behaviour I was seeing was caused by a defect USB cable. I have switched cables today and everything is back to normal. I still see a "NVDS MAGIC FAILED" message on start, but this does not seem to signal an error condition. It is followed by the expected log lines:

NVDS MAGIC FAILED
RF Init OK with coex
I (311) phy: phy_version: 329, Feb 22 2017, 15:58:07, 0, 0
Enable Classic BT
Enable Low Energy
E (311) BT: Startup BTU
...

Who is online

Users browsing this forum: No registered users and 215 guests