← index #4298Issue #4459
Related · medium · value 1.047
QUERY · ISSUE

compatibility : esp8266 *may* stop processing wifi when (ab)using micropython.schedule()

openby pmp-popened 2018-11-09updated 2022-03-30
port-esp8266

use case was scheduling asyncio loop step while REPL is running like it can be done with cpython PyOS_InputHook ( cf https://gist.github.com/pmp-p/2cc65bc914cb046972a3e94003fe7f1c )

import micropython, time
def hog(v):
    time.sleep_us(1) # <= will make wifi hang
    micropython.schedule( hog , 1)

micropython.schedule( hog , 1)
CANDIDATE · ISSUE

esp8266 Waiting for STA_IF connect causing reset

closedby astrilchukopened 2019-02-04updated 2019-02-28
bugport-esp8266

On NodeMCU esp8266 running 1.10 I get a reset after approximately 5 iterations of the while loop shown below.

import machine
import network
station = network.WLAN(network.STA_IF)
while not station.isconnected():
	machine.idle()

When I reflashed with 1.10 from 1.9.4 it stopped working - but I suspect that may be because it lost saved wifi credentials.

Edit: forgot to include reset message:

 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x40100000, len 31020, room 16 
tail 12
chksum 0xd2
ho 0 tail 12 room 4
load 0x3ffe8000, len 1100, room 12 
tail 0
chksum 0x9a
load 0x3ffe8450, len 824, room 8 
tail 0
chksum 0xbd
csum 0xbd

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied