My NodeMCU program has gone in to infinite reboot loop.
My code is functionally working but any action I try to do, e.g. file.remove("init.lua")
or even just =node.heap()
, it panics and reboots saying: PANIC: unprotected error in call to Lua API (not enough memory)
.
Because of this, I'm not able to change any code or delete init.lua
to stop automatic code execution.
How do I recover?
I tried re-flashing another version of NodeMCU, but it started emitting garbage in serial port.
Then, I recalled that NodeMCU had two extra files: blank.bin
and esp_init_data_default.bin
.
I flashed them at 0x7E000
and 0x7C000
respectively.
They are also available as INTERNAL://BLANK
and INTERNAL://DEFAULT
in the NodeMCU flasher.
This booted the new NodeMCU firmware, all my files were gone and I'm out of infinite reboot loop.
Flash the following files:
0x00000.bin to 0x00000
0x10000.bin to 0x10000
And, the address for esp_init_data_default.bin depends on the size of your module's flash.
0x7c000 for 512 kB, modules like ESP-01, -03, -07 etc.
0xfc000 for 1 MB, modules like ESP8285, PSF-A85
0x1fc000 for 2 MB
0x3fc000 for 4 MB, modules like ESP-12E, NodeMCU devkit 1.0, WeMos D1 mini
Then, after flashing those binaries format its file system (run "file.format()" using ESPlorer) before flashing any other binaries.
Downloads Link
I've just finished working through a similar problem. In my case it was end-user error that caused a need to forcibly wipe init.lua
, but I think both problems could be solved similarly. (For completeness, my problem was putting a far-too-short dsleep()
call in init.lua
, leaving the board resetting itself immediately upon starting init.lua
.)
I tried flashing new NodeMCU firmware, writing blank.bin
and esp_init_data_default.bin
to 0x7E000
and 0x7C000
, and also writing 0x00000.bin
to 0x00000
and 0x10000.bin
to 0x10000
. None of these things helped in my case.
My hardware is an Adafruit Huzzah ESP8266 breakout (ESP-12), with 4MB of flash.
What worked for me was:
boot_v1.2.bin
, user1.1024.new.2.bin
, blank.bin
, and esp_init_data_default.bin
(under bin/ and bin/at/).boot_v1.2.bin
to 0x00000
user1.1024.new.2.bin
to 0x010000
esp_init_data_default.bin
to 0xfc000
blank.bin
to 0x7e000
esptool.py
1.2.1.esptool.py
after the first would fail).esptool.py --port <your/port> erase_flash
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With