Factory reset via hardware



  • 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?



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



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


  • Pycom Pyoneers

    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)


  • 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



  • Thanks! A case of RTFM I think!




Log in to reply
 

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