ESP8266 D1 Mini boot loops

Hi all,

Since updating to:
Updating espressif8266 @ 2.5.1 [Up-to-date]
Updating toolchain-xtensa @ 2.40802.200502 [Up-to-date]

I have noticed that whenever I reboot my ESP8266 D1 Miniā€™s, they go into a boot loop.

I originally logged a bug report on Github thinking it was a framework issue, but I havenā€™t been able to reproduce it on a core-only project. Link: ESP.restart() or auto-reboot after firmware update causes boot loop Ā· Issue #7306 Ā· esp8266/Arduino Ā· GitHub

If I try to downgrade toolchain-xtensa by reverting to espressif@2.4.0, it says it is downgrading toolchain-xtensa, but it still stays at 2.40802.200502

eg:
PackageManager: Installing toolchain-xtensa @ ~2.40802.191122
toolchain-xtensa @ 2.40802.200502 is already installed

Has anyone else come across this?

My projects worked fine before doing this pio update.

It also looks like if I try to install the previous version of toolchain-xtensa, it lies about the version it installs:

$ pio platform install espressif8266@2.4.0
PlatformManager: Installing espressif8266 @ 2.4.0
espressif8266 @ 2.4.0 has been successfully installed!
PackageManager: Installing toolchain-xtensa @ ~2.40802.191122
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%
toolchain-xtensa @ 2.40802.200502 has been successfully installed!
PackageManager: Installing tool-esptool @ <2
tool-esptool @ 1.413.0 has been successfully installed!
PackageManager: Installing tool-esptoolpy @ ~1.20800.0
Downloading  [####################################]  100%
tool-esptoolpy @ 1.20800.0 has been successfully installed!
The platform 'espressif8266@2.4.0' has been successfully installed!
The rest of packages will be installed automatically depending on your build environment.

Oh boyā€¦ installing ~2.40802.191122 but then receiving 2.40802.200502 has been successfully installed ā€¦ thatā€™s not confusing at all! :open_mouth:

Funny you say D1 Mini ā€¦ I flashed one last night OTA, and it wouldnā€™t boot back up, so I did a serial update, and it seems to have been fine since then. Either that, or because I also updated to 2.5.1 ā€¦ so I chalked it up to the eboot changes introduced as part of ESP8266_Arduino_2.7.0 or some other breakage from jumping from a 2.5.0 or 2.7.0 coreā€¦

I think I might have ruled out the xtensa upgrade - however thereā€™s certainly something strange going on with setting the CPU speedā€¦

Iā€™ve been using 160Mhz for a long time, however when I do that now I have issuesā€¦ See the latest github comment where my dataset is currently:

Build at 80 Mhz ( ESP.getCpuFreqMHz() shows 80):
Flash -> up ok -> reboot -> up ok

Build at 160Mhz ( ESP.getCpuFreqMHz() shows 160):
Flash -> up ok -> reboot -> up ok -> reboot -> up ok -> flash 160Mhz build -> no boot.
Power cycle -> up ok -> reboot -> no boot
Power cycle -> up ok -> Flash 80 Mhz build -> no boot
Power cycle -> up ok -> reboot -> up ok -> reboot -> up ok
Flash 80Mhz build -> up ok -> reboot -> up ok

1 Like

Ok, so just to check Iā€™m understanding this rightā€¦ youā€™re saying if you build and flash 80Mhz, it seems to restart and update ok, but if you build at 160Mhz, it will firstly crash on restart, then boot fine, crash again if you restart, but if you then flash an 80Mhz project, it will crash on restart, but then be fine then onwards?

Implying 160Mhz really doesnā€™t want to restart now for some reason. I donā€™t think have any unaccounted D1 Minis I can test this one, but will try to reproduce this on a NodeMCU v3 and Digistump Oak in the morning if I have time.

Building anything at 80Mhz seems to be fine. You can flash a 160Mhz image booted from an 80Mhz image, and that will reboot fine after the flash - and the image will boot and reboot ok. If you flash a different 160Mhz image while booted at 160Mhz, thatā€™s when things start going screwy.

You can flash a 80Mhz image while booted at 160Mhz, but it will crash on reboot needing a power cycle.

As such, I wonder if its something with the flashing process at 160Mhz that is different and causing issues - as any other 160Mhz image flashed while running at 160Mhz will start the failures.

EDIT: Interestingly, this does not happen on an ESP01S which flashes, reboots and runs fine at 160Mhzā€¦

Very strange indeed! :open_mouth:

You might want to follow this issue also, as someone else has just opened an issue about 2.7.0/2.7.1 and ESP.reset()/ESP.restart() causing lockups.

Edit: Iā€™m currently on the prowl for MDNS issues, and saw this interesting titbit -

It may not be an issue with mDNS but with NONOS-SDK FW.
Latest release 2.7.0 is using NONOS-SDK v2.2.1+100 (2019-07-03).
You may try with ā€œLegacy 2.2.1ā€ which was previously shipped, or with more recent ones: 2.2.1(2019-11-22) is the latest.

In other words, it might be worth playing with the SDK version liked mentioned in this post. The comment suggests you would PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK221 to revert to the SDK version they previously used, but I donā€™t think thatā€™s actually right. Trawl through the history for this file to see when when the different versions of the ESP8266 Arduino core used different SDK versions.

Edit2: One final titbit for nowā€¦ since you mentioned the ESP01S was working fineā€¦ I wonder if itā€™s somehow related to the still open XMC issueā€¦