network.WLAN(network.STA_IF).connect results in reset loop

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
pithy_prolix
Posts: 4
Joined: Mon Mar 23, 2020 7:16 am

network.WLAN(network.STA_IF).connect results in reset loop

Post by pithy_prolix » Mon Mar 23, 2020 8:54 am

Hello,

Newbie here.

I am trying to connect to a wifi router and it invariably will end up in an endless reset loop. I've tried with 3 different NodeMCU v2 boards, all with the same result. They must be erased & re-flashed.

My script (the ssid and password have been altered, of course):

Code: Select all

import network
import time
    
def connect():
    sta_if = network.WLAN(network.STA_IF)
    sta_if.active(True)
    sta_if.connect('not-the-real-ssid', 'not-the-real-password')
    for i in range(15):
        print(".")
        if sta_if.isconnected():
            break
        time.sleep(1)
    if sta_if.isconnected():
        print("Connection successful")
        print(sta_if.ifconfig())
    else:
        print("Connection could not be made.\n")
        
connect()
It gets into the 3rd or 4th iteration of the 'for' loop, seems to pause for a few seconds, then it goes into an endless reset loop.

Here's the error output with MicroPython v1.9.1:

Code: Select all

MicroPython v1.9.1-8-g7213e78d on 2017-06-12; ESP module with ESP8266
Type "help()" for more information.
>>>
 ets Jan  8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x40100000, len 32000, room 16
tail 0
chksum 0xee
load 0x3ffe8000, len 1104, room 8
tail 8
chksum 0xaa
load 0x3ffe8450, len 3000, room 0
tail 8
chksum 0xc0
csum 0xc0
and with MicroPython v1.12:

Code: Select all

MicroPython v1.12 on 2019-12-20; ESP module with ESP8266
Type "help()" for more information.
>>>
 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x40100000, len 31088, room 16
tail 0
chksum 0x44
load 0x3ffe8000, len 1028, room 8
tail 12
chksum 0x1e
ho 0 tail 12 room 4
load 0x3ffe8410, len 824, room 12
tail 12
chksum 0x89
csum 0x89
I understand 'wdt' refers to the watchdog timer but I have no idea why it is timing out & resetting the boards.

Notables:
  • When I log into the router it shows the board is connected (the MAC address matches).
  • Same behavior when the boards are attached to a laptop USB port or an externally powered USB hub (nothing else on the hub).
  • The 3 boards were purchased from different sources.
  • All 3 boards appear identical except 2 are printed "Amica" on the bottom and the 3rd has no name.
Sorry if this is a FAQ - I've tried Googling for an answer for quite a while. Any ideas, please?

pithy_prolix
Posts: 4
Joined: Mon Mar 23, 2020 7:16 am

Re: network.WLAN(network.STA_IF).connect results in reset loop

Post by pithy_prolix » Tue Mar 24, 2020 5:40 am

Forgot to add that I have tried 3 different short USB cables, all supposedly high quality, including one that was supplied with one of the boards.

I will try connecting to another wifi router and see what happens ...

pithy_prolix
Posts: 4
Joined: Mon Mar 23, 2020 7:16 am

Re: network.WLAN(network.STA_IF).connect results in reset loop

Post by pithy_prolix » Tue Mar 24, 2020 6:08 am

So, I tried a different router - the wireless hotspot functionality on my phone - and it works!

???

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: network.WLAN(network.STA_IF).connect results in reset loop

Post by jimmo » Tue Apr 14, 2020 5:35 am

pithy_prolix wrote:
Tue Mar 24, 2020 6:08 am
So, I tried a different router - the wireless hotspot functionality on my phone - and it works!
Not sure if helpful, but a crash while connecting to WiFi is often a sign of an issue with the board's power supply (i.e. the current draw needed during WiFi init causes the LDO to brown out, etc).

I wonder if maybe if the phone hotspot is closer then it doesn't have to ramp up the TX power so much?

pithy_prolix
Posts: 4
Joined: Mon Mar 23, 2020 7:16 am

Re: network.WLAN(network.STA_IF).connect results in reset loop

Post by pithy_prolix » Tue Apr 14, 2020 7:26 am

jimmo wrote:
Tue Apr 14, 2020 5:35 am
pithy_prolix wrote:
Tue Mar 24, 2020 6:08 am
So, I tried a different router - the wireless hotspot functionality on my phone - and it works!
Not sure if helpful, but a crash while connecting to WiFi is often a sign of an issue with the board's power supply (i.e. the current draw needed during WiFi init causes the LDO to brown out, etc).

I wonder if maybe if the phone hotspot is closer then it doesn't have to ramp up the TX power so much?
Thanks for the reply.

The router it is crashing with is less than 3 meters away and the signal registers as full strength on my laptop in the same location the NodeMCUs were crashing. :?

bonasta
Posts: 2
Joined: Sun Nov 29, 2020 10:31 pm

Re: network.WLAN(network.STA_IF).connect results in reset loop

Post by bonasta » Sun Nov 29, 2020 10:45 pm

I get exactly the same problem.
Board is Heltec WiFi Kit 8
Works under Arduino
Fails with MicroPython
I can log on to the board using wifi ok
I can list all visible SSIDs
These would probably rule out PSU problems as wireless(ie high current) hardware must work to support logqing on
Once i try doing connect the system does the exact problem described above

Jugovi
Posts: 1
Joined: Sat Jul 17, 2021 11:47 pm

Re: network.WLAN(network.STA_IF).connect results in reset loop

Post by Jugovi » Sat Jul 17, 2021 11:57 pm

I got the same issue, i was connecting my ESP32 throug my USB hub, which has a external power supply.
Once i connected the ESP32 directly on my computer it was able to connect.
I hope this help someone.

User avatar
mathieu
Posts: 88
Joined: Fri Nov 10, 2017 9:57 pm

Re: network.WLAN(network.STA_IF).connect results in reset loop

Post by mathieu » Thu Sep 02, 2021 4:40 pm

Same issue here on an ESP01S. What might be of interest is that once I create the problem (by attempting to connect to my wifi network), it persists after physically switching the power off and back on again. Only way I've found to make the problem go away is to re-flash the firmware (this is on μPython 1.12).

Any ideas?

Post Reply