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

    Factory reset via hardware

    Scheduled Pinned Locked Moved WiPy 2&3
    7 Posts 4 Posters 5.4k Views 5 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.
    • K Offline
      kolonuk
      last edited by

      Hi,

      I've just got round to playing with my Wipy 1, and the first thing I wanted to do was to put it onto my network.

      So, I followed the wifi tutorial, and saved the simple boot.py script (without static IP) to /flash and reset the board.

      And promptly lost it! It's not connected to my network, and it's not in AP mode. The heartbeat is flashing, so it's definitely alive, I assume it's stuck trying to run the boot.py...

      How do I do a factory reset if I can't get access to it?

      K 1 Reply Last reply Reply Quote 0
      • J Offline
        jgmdavies
        last edited by

        https://micropython.org/resources/docs/en/latest/wipy/wipy/tutorial/reset.html

        1 Reply Last reply Reply Quote 0
        • K Offline
          kolonuk
          last edited by

          Thanks! A case of RTFM I think!

          1 Reply Last reply Reply Quote 0
          • J Offline
            jgmdavies
            last edited by

            Aye, although my friend Google's usually quicker!

            By the way, AFAIK the most active WiPy discussions are over at http://forum.micropython.org/viewforum.php?f=11&sid=690913b619b63748024e6378122f4852 .

            Jim

            1 Reply Last reply Reply Quote 0
            • R Offline
              Roberto
              last edited by Roberto

              Hello @kolonuk ,

              The information that you require to boot your WiPy in the different boot and safe boot modes is posted in the documentation here:
              https://docs.pycom.io/wipy/wipy/general.html#boot-modes-and-safe-boot

              Furthermore, i want to help you with this nice script for your boot.py to connect to your network (make sure is a 2.4Ghz router, WiPy only supports 2.4Ghz).

              The good thing in this script is that if it fails to connect it will fallback to AP mode after boot. You just have to replace the "Router SSID" with yours and the "Router Password".
              Ex, The line you need to change should look like
              known_nets = [('MyNetworkName', '123456')]

              boot.py

              import machine
              import os
              
              uart = machine.UART(0, 115200) # Remove this if you don't want the serial port enabled on boot
              os.dupterm(uart) # Remove this if you don't want the terminal to be dumped to serial port
              
              if machine.reset_cause() != machine.SOFT_RESET:
                  from network import WLAN
              
                  # Put your network SSID and password here. You can use multiple networks, this script will try to connect to any of them, if it fails, it will fallback to AP mode
                  known_nets = [('Router SSID', 'Router Password')] 
              
                  wl = WLAN()
              
                  original_ssid = wl.ssid()
                  original_auth = wl.auth()
              
                  wl.mode(WLAN.STA)
              
                  available_nets = wl.scan()
                  nets = frozenset([e.ssid for e in available_nets])
              
                  known_nets_names = frozenset([e[0] for e in known_nets])
                  net_to_use = list(nets & known_nets_names)
              
                  try:
                      net_to_use = net_to_use[0]
                      pwd = dict(known_nets)[net_to_use]
                      sec = [e.sec for e in available_nets if e.ssid == net_to_use][0]
                      wl.connect(net_to_use, (sec, pwd), timeout=10000) # Timeout for connection, change this if you require a different timeout (ms)
                  except:
                      wl.init(mode=WLAN.AP, ssid=original_ssid, auth=original_auth, channel=6, antenna=WLAN.INT_ANT)
              
              K 1 Reply Last reply Reply Quote 0
              • K Offline
                kolonuk @Roberto
                last edited by

                @Roberto I was thinking of something like that... Maybe something like this should be the default final result of the wifi tutorial? fall back to AP mode, I mean...

                Anyway, I'm moving over to the micropython forums (I did wonder why it was quiet here!)

                Thanks!

                1 Reply Last reply Reply Quote 0
                • K Offline
                  Keptenkurk @kolonuk
                  last edited by

                  And until machine.reset_cause is fixed it also works on the LoPy with the line:
                  if machine.reset_cause() != machine.SOFT_RESET:
                  removed

                  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