How to recover from infinite reboot loops in NodeMCU?

Urmil Parikh picture Urmil Parikh · Apr 18, 2015 · Viewed 8.1k times · Source

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?

Answer

Urmil Parikh picture Urmil Parikh · Apr 21, 2015

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.