Page 3 of 3

Re: Micropython crashing and rebooting every 9seconds

Posted: Tue Aug 06, 2019 6:31 pm
by Cevc
It finally works!

I disabled the AP network, but left STA on. Now it works, even in my flat, and for most of my planned projects, I'll be connected to the local WiFi anyway, so AP is not needed.

Thanks very much Roberthh, and everyone else for all your help!

Seeing as I now have 7 extra boards lying around, is there any way to alter the boot file before flashing the device? It would be useful to be able to flash them so that AP is off by default.

Re: Micropython crashing and rebooting every 9seconds

Posted: Tue Aug 06, 2019 7:25 pm
by Roberthh
You can do so, but it requires to build your own firmware image. Using Linux, this requires some steps, but is quite straightforward. In the ports/esp8266/modules directory there is a file called _boot.py (take care of the _), which is executed first at boot time.
Being able to make your own image is any advantageous, because it allows to "freeze" python scripts into the firmware. Then they start faster and consume no RAM for the code. And TAM is a precious resource on the ESP8266. The micropython repository is at https://github.com/micropython/micropython, instructions to build the ESP8266 firmware are at https://github.com/micropython/micropyt ... ts/esp8266. Please follow them carefully.
There are also some threads about copying and flashing the file system of an existing device. But making your own image is a more robust approach.
It still would be interesting to know the reason for the crash. Are you able to catch some communication data? Is by chance your router set in the range of 192,168.4.x? Can you run a protocol sniffer in the subnet the esp8266 uses?

Re: Micropython crashing and rebooting every 9seconds

Posted: Tue Aug 06, 2019 7:33 pm
by Christian Walther
There is, if you want to rebuild the firmware (it’s done in ports/esp8266/modules/inisetup.py called from _boot.py), but I’m not sure you need to – you can just disable it on the REPL after flashing, and it will stay off.