Micropython crashing and rebooting every 9seconds

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Cevc
Posts: 10
Joined: Thu Apr 25, 2019 7:54 am

Re: Micropython crashing and rebooting every 9seconds

Post by Cevc » Sat Aug 03, 2019 2:39 pm

I did the exact same thing as you, also on esptool version 2.6. Ran the commands:

Code: Select all

esptool.py --port COM3 --baud 460800 erase_flash
esptool.py --port COM3 --baud 460800 write_flash --flash_size=detect -fm dio 0 esp8266-20190529/v1.11.bin
I also tried to directly specify '4MB' intstead of 'detect'.

The output during flashing seems identical to yours:

Code: Select all

esptool.py v2.6
Serial port COM3
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: cc:50:e3:3c:f4:f9
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0240
Compressed 617880 bytes to 402086...
Wrote 617880 bytes (402086 compressed) at 0x00000000 in 9.2 seconds (effective 535.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Still, the same thing.

I still have to try this somewhere where there is on wifi whatsoever, just to make sure its not an interference issue. Do you think that could explain this at all?

User avatar
Roberthh
Posts: 1701
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Micropython crashing and rebooting every 9seconds

Post by Roberthh » Sat Aug 03, 2019 3:29 pm

About the WiFi that is just a blind guess. The probability of interference is minor.

User avatar
Roberthh
Posts: 1701
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Micropython crashing and rebooting every 9seconds

Post by Roberthh » Sat Aug 03, 2019 3:37 pm

I still cannot believe that you got so many bad boards. So it would be interesting to consider, what in all your tests did not change (except yourself, of course). The PC you used for the connection? The USB port?
Another thought I had: do connect directly or do you use an USB hub?
The fault still looks like a kind of power problem. During flashing, the power consumption is low, like ~25mA. That increases to ~100mA with peaks to ~200mA when the device is started and uses WiFi.

OutoftheBOTS_
Posts: 662
Joined: Mon Nov 20, 2017 10:18 am

Re: Micropython crashing and rebooting every 9seconds

Post by OutoftheBOTS_ » Sat Aug 03, 2019 9:10 pm

I had problems with a rebooting ESP when I first starting building my own dev boards, it was caused by the EN pin (enable pin) dipping when the wifi started up. Seems the ESP is super sensitive for this and myself and others have fixed this problem by soldering a 100nf cap across the EN pin

User avatar
Roberthh
Posts: 1701
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Micropython crashing and rebooting every 9seconds

Post by Roberthh » Sun Aug 04, 2019 6:41 am

That could be indeed be the culprit, if all boards come from the same batch. In the boards I have this pin is connected to a 10k or 12k pull-up resistor. If that one is omitted, the pin should be very sensitive to fluctuations. A chip internal Pull-Up is not mentioned, and might not be useful, since that pin is used to power don the device to µA level. A 12k pull-up will consume 275µA current alone. If that is th ereason, I wonder why the reset reason is told as WDT.

Cevc
Posts: 10
Joined: Thu Apr 25, 2019 7:54 am

Re: Micropython crashing and rebooting every 9seconds

Post by Cevc » Mon Aug 05, 2019 6:39 pm

So... I think I've gotten somewhere... but its extremely strange!

I was hiking in the South Downs this weekend, and like any sane tinkerer would, brought the ESP8266 and a battery pack to test it where no WiFi exists.

And lo and behold, it works flawlessly!

To double check this, I brought my laptop with me to work today and tested it there, and also there it works flawlessly, despite there being 30 different WiFi networks in range (I work from a WeWork office). I haven't re/flashed anything either. Just brought the same board that I flashed earlier last week that was restarting itself, and as soon as it's no longer in or around my flat, it works perfectly.

However, as soon as I come back home, I face the exact same problem as before again.

So it seems it must be something to do with interfering signals. Not sure if its WiFi or something else. I tried disconnecting every WiFi enabled gadget in the house, such as chromecasts, google homes, smart speakers, etc, and disabling the WiFi, but nothing. So IF it is WiFi interference, it must be a neighbors or something. Or do any of you have any other ideas?

For example, OutoftheBOTS_ do you recon the EN pin could be affected by something like wireless interference?

It seems my original suspicion of a cursed flat isn't to far from the truth afterall...

OutoftheBOTS_
Posts: 662
Joined: Mon Nov 20, 2017 10:18 am

Re: Micropython crashing and rebooting every 9seconds

Post by OutoftheBOTS_ » Mon Aug 05, 2019 9:21 pm

Have you run it from the same battery pack you used while in the wild at home in your flat??

The EN pin must be held high without any dips and if you have a poor power supply or not enough capacitance on the EN pin then it can dip. I have found if it dips the tiniest then you get ghosts in the machine and if it dips anything more than a tiny tiny bit then the ESP reboots.

Cevc
Posts: 10
Joined: Thu Apr 25, 2019 7:54 am

Re: Micropython crashing and rebooting every 9seconds

Post by Cevc » Tue Aug 06, 2019 5:58 am

Yes I did try it with that battery pack at home as well. Same behaviour, restarts every 9 seconds.

And plugging it into the computer or a battery pack both worked fine at work, so it doesn't seem to be a power issue to me.

User avatar
Roberthh
Posts: 1701
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Micropython crashing and rebooting every 9seconds

Post by Roberthh » Tue Aug 06, 2019 6:07 am

You could try to disable WiFi. Once set, that will survive shutdown and boot. You have to do that at work. You can disable either AP mode, or STA mode, or both, to see, which mode causes the trouble.
Disable AP mode

Code: Select all

import network
wifi = network.WLAN(network.AP_IF)
wifi.active(False)
Disable STA mode

Code: Select all

import network
wifi = network.WLAN(network.STA_IF)
wifi.active(False)
And yes: taking care of the EN pin is still an issue. The Wifi phenomenon may still correlate with a power or signal problem. For test, you can also connect EN to 3.3V with a strong pullup, e.g. a wire.

Cevc
Posts: 10
Joined: Thu Apr 25, 2019 7:54 am

Re: Micropython crashing and rebooting every 9seconds

Post by Cevc » Tue Aug 06, 2019 12:33 pm

Thanks Roberthh, I'll give this a try today!

Post Reply