esp8266 network run wlan.connect esp8266 restart

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
skylin008
Posts: 82
Joined: Wed Mar 11, 2015 6:21 am

esp8266 network run wlan.connect esp8266 restart

Post by skylin008 » Tue Mar 29, 2016 7:19 am

The firmware version for:MicroPython v1.6-312-gb4070ee-dirty on 2016-03-29; ESP module with ESP8266

when I run follow code,esp8266-12f restart.

Code: Select all

import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.isconnected()
False
wlan.connect('essid', 'password')   #essid and password from router distribution
the esp8266-12f restart every time.

How to fix this issue?Tks!

User avatar
deshipu
Posts: 1385
Joined: Thu May 28, 2015 5:54 pm

Re: esp8266 network run wlan.connect esp8266 restart

Post by deshipu » Tue Mar 29, 2016 8:46 am

I can confirm the same problem with the recent code from the repository (as of 8fc5e56a6a06523ff864d309c7718885a990cb2b).

Also. WLAN.scan() no longer works:

Code: Select all

>>> wlan.scan()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: argument num/types mismatch

User avatar
deshipu
Posts: 1385
Joined: Thu May 28, 2015 5:54 pm

Re: esp8266 network run wlan.connect esp8266 restart

Post by deshipu » Tue Mar 29, 2016 9:26 am

I suppose that part is still "under construction" :-)

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: esp8266 network run wlan.connect esp8266 restart

Post by pfalcon » Tue Mar 29, 2016 6:22 pm

The original issue was fixed, see https://github.com/micropython/micropython/issues/1942 .
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: esp8266 network run wlan.connect esp8266 restart

Post by wendlers » Tue Mar 29, 2016 6:54 pm

Hi, deshipu,
deshipu wrote: Also. WLAN.scan() no longer works:

Code: Select all

>>> wlan.scan()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: argument num/types mismatch
"wlan.scan" needs a callback as an argument (taking a tuple as parameter). E.g. the following works for me:

Code: Select all

>>> os.uname()
(sysname='ESP8266', nodename='ESP8266', release='1.5.2(80914727)', version='v1.6-318-gd88250c on 2016-03-29', machine='ESP module with ESP8266')

def scan_found(t):
    print("found:", t)
 
>>> wlan.scan(scan_found)

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: esp8266 network run wlan.connect esp8266 restart

Post by pfalcon » Wed Mar 30, 2016 8:44 am

wlan.scan() was switched from callback to return result synchronously in alpha. I had an idea to keep supporting callback, but as I'm deep into other stuff, have merged it as is to avoid confusion.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: esp8266 network run wlan.connect esp8266 restart

Post by wendlers » Wed Mar 30, 2016 6:59 pm

Now (using, 61fa7c81527016be164321c442fe5317daa260ee), I think I get the same behavior as initially described in this post:

Code: Select all

MicroPython v1.6-327-g61fa7c8 on 2016-03-30; ESP module with ESP8266
Type "help()" for more information.
>>> import network
>>> wlan = network.WLAN(network.STA_IF)
>>> wlan.active()
False
>>> wlan.active(True)
mode : sta(5c:cf:7f:11:62:85) + softAP(5e:cf:7f:11:62:85)
#5 ets_task(40214e78, 28, 3fffad60, 10)
add if0
>>> wlan.active()
True
>>> wlan.connect('xxxx', 'yyyy')
Fatal exception 3(LoadStoreErrorCause):
epc1=0x4000deed, epc2=0x00000000, epc3=0x00000000, excvaddr=0x40000040, depc=0x00000000

 ets Jan  8 2013,rst cause:2, boot mode:(1,6)
I tired to figure out, why "connect" seamed to be working before with code from the repository, and so far it looks like so:

When I deploy the firmware from the repository to a clean board (clean flash), or a board that was treated with "esptool.py erase_flash", I get the above behavior.

However when using a board that was previously flashed with ALPHA v02, and had a working (and thus stored connection), then a version deployed from the repo (without doing a flash erase before), is able to use "connect" without a restart. This is even true when connecting to different APs:

Code: Select all

MicroPython v1.6-327-g61fa7c8 on 2016-03-30; ESP module with ESP8266
Type "help()" for more information.
>>> import network
>>> wlan = network.WLAN(network.STA_IF)
>>> wlan.active(True)
>>> wlan.isconnected()
True
>>> wlan.disconnect()
state: 5 -> 0 (0)
rm 0
>>> wlan.connect('aaa', 'bbb')
f r0, >>> scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 26
cnt 

connected with aaa, channel 11
dhcp client start...
ip:192.168.x.y,mask:255.255.255.0,gw:192.168.x.y

gschmott
Posts: 6
Joined: Sun Mar 13, 2016 5:03 pm

Re: esp8266 network run wlan.connect esp8266 restart

Post by gschmott » Thu Mar 31, 2016 12:52 am

I'm seeing identical behavior with today's latest commit (61fa7c81527016be164321c442fe5317daa260ee). I erase the flash using esptool.py and then try the following:

Code: Select all

>>> import network
>>> wlan = network.WLAN(network.STA_IF)
>>> wlan.active(True)
>>> wlan.isconnected()
False
>>> wlan.connect('xxxxx', 'yyyyy')
Fatal exception 3(LoadStoreErrorCause):
epc1=0x4000deed, epc2=0x00000000, epc3=0x00000000, excvaddr=0x40000008, depc=0x00000000

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)
Unfortunately, I don't have access to one of the early apha releases. It also looks like os.listdir('.') isn't too happy either:

Code: Select all

>>> import os
>>> os.listdir('.')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: 19
>>>
I wonder if they are somehow related if the network configuration is being stored/retrieve from flash?

Thoughts?

User avatar
deshipu
Posts: 1385
Joined: Thu May 28, 2015 5:54 pm

Re: esp8266 network run wlan.connect esp8266 restart

Post by deshipu » Thu Mar 31, 2016 10:10 am


spirkaa
Posts: 2
Joined: Wed May 18, 2016 7:50 am

Re: esp8266 network run wlan.connect esp8266 restart

Post by spirkaa » Fri May 20, 2016 3:59 pm

I still get this error on WeMos D1 mini with MicroPython v1.8-89-gf9dc644-dirty on 2016-05-20, but can avoid it. What i do:
1. Flash WiFiClientBasic.ino example from Arduino esp8266 with my ssid & password
2. Flash micropython WITHOUT erase_flash
3. Run repl, paste and run do_connect()

Post Reply