Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Watchdog trigger when starting wlan in WLAN.STA mode

    Scheduled Pinned Locked Moved LoPy
    4 Posts 2 Posters 1.9k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      bartvandeenen
      last edited by bartvandeenen

      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.
      
      1 Reply Last reply Reply Quote 0
      • bmarkusB Offline
        bmarkus
        last edited by

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

        B 1 Reply Last reply Reply Quote 0
        • B Offline
          bartvandeenen
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • B Offline
            bartvandeenen @bmarkus
            last edited by

            @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!

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post

            Pycom on Twitter

            Pycom