Skip to content

(Possibly NVS related) crash on boot #1347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jamesbaber opened this issue Apr 23, 2018 · 5 comments
Closed

(Possibly NVS related) crash on boot #1347

jamesbaber opened this issue Apr 23, 2018 · 5 comments

Comments

@jamesbaber
Copy link

jamesbaber commented Apr 23, 2018

Hardware:

Board: ESP32 Dev Module
Core Installation/update date: 10/apr/2018
IDE name: Arduino IDE
Flash Frequency: 80Mhz
Upload Speed: 115200

Description:

The chip was running my project code which makes use of the Preferences library and it seemed to work fine but after I came back to it at a later date, it didn't work... After checking the serial console I found that it is now crashing with the output shown below. I tried replacing the application code with the "Blink" and "BareMinimum" examples but got the same result. I tried esptool erase_flash which gives no output so I can't tell if it did anything, but it certainly didn't fix it.

Sketch:

//Change the code below by your sketch
#include <Arduino.h>

void setup() {
  pinMode(22, OUTPUT);
}

void loop() {
  digitalWrite(22, HIGH);
  delay(1000);
  digitalWrite(22, LOW);
  delay(1000);
}

Debug Messages:

assertion "entry < ENTRY_COUNT" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/nvs_flash/src/nvs_page.hpp", line 186, function: uint32_t nvs::Page::getEntryAddress(size_t) const
abort() was called at PC 0x400dac73 on core 0
Guru Meditation Error: Core  0 panic'ed (abort)

Backtrace: 0x40008155:0x3ffc4770 0x40007d16:0x3ffc4790 0x400d96e6:0x3ffc47c0 0x400d9999:0x3ffc47e0 0x400da3e1:0x3ffc4820 0x400d92fc:0x3ffc4880 0x400d91ea:0x3ffc48d0 0x400d9236:0x3ffc48f0 0x400d05eb:0x3ffc4910 0x400dac1e:0x3ffc4930 0x400d82a9:0x3ffc4960

CPU halted.
Decoding stack results
0x400d96e6: nvs::Page::writeEntry(nvs::Item const&) at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/nvs_flash/src/nvs_page.hpp line 187
0x400d9999: nvs::Page::moveItem(nvs::Page&) at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/nvs_flash/src/nvs_page.cpp line 400
0x400da3e1: nvs::PageManager::load(unsigned int, unsigned int) at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/nvs_flash/src/nvs_pagemanager.cpp line 89
0x400d92fc: nvs::Storage::init(unsigned int, unsigned int) at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/nvs_flash/src/nvs_storage.cpp line 42
0x400d91ea: nvs_flash_init_custom(uint32_t, uint32_t) at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/nvs_flash/src/nvs_api.cpp line 70
0x400d9236: nvs_flash_init() at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/nvs_flash/src/nvs_api.cpp line 87
0x400d05eb: initArduino at /home/james/Arduino/hardware/espressif/esp32/cores/esp32/esp32-hal-misc.c line 84
0x400dac1e: app_main() at /home/james/Arduino/hardware/espressif/esp32/cores/esp32/main.cpp line 25
0x400d82a9: main_task at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/./cpu_start.c line 307
@lbernstone
Copy link
Contributor

You don't get any errors from erase_flash or uploading firmware? It sounds like your spi_flash may be damaged. The initialization code will open nvs to try to get your wifi config.

@jamesbaber
Copy link
Author

@lbernstone That could explain it, but what would cause it to be damaged? Hardware issue or corrupt data being pushed to it?
erase_flash completes with no output whatsoever regardless of if the ESP32 is even plugged in 😕 so I could be doing something wrong there!
While uploading code from the arduino IDE, the console output is fairly benign.

esptool.py v2.0-beta3
Connecting....
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash params set to 0x022f
Compressed 11120 bytes to 7191...

Writing at 0x00001000... (100 %)
Wrote 11120 bytes (7191 compressed) at 0x00001000 in 0.1 seconds (effective 828.9 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 105...

Writing at 0x00008000... (100 %)
Wrote 3072 bytes (105 compressed) at 0x00008000 in 0.0 seconds (effective 9621.9 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...

Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 40530.5 kbit/s)...
Hash of data verified.
Compressed 202560 bytes to 66351...

Writing at 0x00010000... (20 %)
Writing at 0x00014000... (40 %)
Writing at 0x00018000... (60 %)
Writing at 0x0001c000... (80 %)
Writing at 0x00020000... (100 %)
Wrote 202560 bytes (66351 compressed) at 0x00010000 in 1.8 seconds (effective 900.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

@lbernstone
Copy link
Contributor

erase_flash should definitely have some output and take some time. It is the best way to ensure that your nvs gets cleared if corrupt. Not sure exactly what it looks like in Windows CMD (you may need to explicitly call python esptool.py), but in linux I get the following:

larryb@larryb-EZpad:~/arduino-1.8.5/hardware/espressif/esp32/tools$ ./esptool.py erase_flash
esptool.py v2.3.1
Connecting....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 13.3s
Hard resetting via RTS pin...

@jamesbaber
Copy link
Author

@lbernstone Progress! Turns out I had mistakenly installed esptool from the Ubuntu APT repositories, without realising that version doesn't work very well... So reinstalled using PIP and now I'm getting erase_flash output. Erased successfully, re-flashed and its all working. Thanks for your help, glad its not a bigger issue.

@lbernstone
Copy link
Contributor

lbernstone commented Apr 24, 2018

Glad to help. Please close the issue!

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

No branches or pull requests

2 participants