Watchdog trigger when starting wlan in WLAN.STA mode



  • Hi all

    If I run the function below in /flash/main.py it reliably triggers the watchdog, and the same if I call the function after a successful boot.
    However, if I execute the lines in this function via the repl one by one, I don't trigger the watchdog. Is this a timing issue ?

    def setup_wlan_client():
        wlan=WLAN(mode=WLAN.STA)
        net = [net for net in wlan.scan() if net.ssid == 'bart'][0]
        wlan.connect(net.ssid, auth=(net.sec, '*****'), timeout=5000)
        while not  wlan.isconnected():
            pass
        print(wlan.ifconfig())
    

    Here's my os info:

    os.uname()
    (sysname='LoPy', nodename='LoPy', release='0.9.3.b2', version='d78a5a3 on 2016-11-05', machine='LoPy with ESP32')
    

    Here's the watchdog log after successful hard reset.

    ...
    mode : softAP(24:0a:c4:00:85:0d)
    dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
    dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
    MicroPython d78a5a3 on 2016-11-05; LoPy with ESP32
    Type "help()" for more information.
    >>> setup_wlan_client()
    mode : sta(24:0a:c4:00:85:0c)
    n:4 0, o:6 0, ap:255 255, sta:4 0, prof:6
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    
    connected with bart, channel 4
    Task watchdog got triggered. The following tasks did not feed the watchdog in time:
    Tasks currently running:
    CPU 0: MicroPy
    Aborting.
    Guru Meditation Error: Core   0 panic'ed (Unhandled debug exception)
    Register dump:
    PC      :  400e6d17  PS      :  00060036  A0      :  800f2088  A1      :  3ffd51f0  
    A2      :  0000000a  A3      :  0000000a  A4      :  00000004  A5      :  00000000  
    A6      :  00000000  A7      :  fffffff8  A8      :  00000000  A9      :  3ffd5160  
    A10     :  00000000  A11     :  3ffdd7b3  A12     :  3ffd512f  A13     :  00000030  
    A14     :  00000000  A15     :  00000000  SAR     :  00000011  EXCCAUSE:  00000001  
    EXCVADDR:  00000000  LBEG    :  4000c2e0  LEND    :  4000c2f6  LCOUNT  :  ffffffff  
    CPU halted.
    


  • @bmarkus
    your suggestion is correct, and resolves the issue!

    So the good solution is:

    while not wlan.isconnected():
        tim.sleep_ms(50)
    

    But pass or machine.idle() in the while loop trigger watchdog expiry!



  • This post is deleted!


  • I would replace the pass inside of the while loop with a small delay, like 100ms or so for testing.


Log in to reply
 

Pycom on Twitter

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.