How to accomplish lora.nvram_restore() ?



  • I'm trying to understand saving & restoring lora nvram.

    In boot.py I connect to TTN, send a packet, and do "lora.nvram_save()".
    the packet is received.

    main.py is:
    from network import LoRa
    import socket
    lora = LoRa(mode=LoRa.LORAWAN)
    lora.nvram_restore()
    s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
    s.setsockopt(socket.SOL_LORA, socket.SO_DR, 3)
    s.setblocking(False)
    s.send('LoRa Continues')

    The second packet is not received.

    I've also tried lora = LoRa(). Also no success.

    Any idea what I'm missing?



  • Yes, thank you. I know I only need save/restore for deepsleep. But was testing it without deepsleep. Shouldn't it still work?

    Still looking for any posted example of use of save / restore.

    Yes, splitting code irrelevant if deepsleep.



  • @jalperin you only need to use nvram_save / nvram_restore if you use deep sleep.

    Also I'm not quite sure what's your logic for having some of the code in boot.py and some in main.py. Both are executed sequentially.



  • Update.

    comment out lora.nvram_restore() and the second message is received.

    Do I need more code or is the restore messing up?


Log in to reply
 

Pycom on Twitter