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

    Don't erase lora context on nvram_restore()

    Scheduled Pinned Locked Moved Discussion
    lorawanrestorenvramnvramsavenvramrestore
    2 Posts 2 Posters 82 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.
    • D Offline
      d.alvrzx
      last edited by

      Re: LoRa NVRAM clear on restore issues

      Hey everyone:

      I'm referencing this topic, because it's been a big problem for a large number of LoPy4 we are running in the field. Basically, we would greatly benefit from lora.nvram_restore() not erasing the current context until a lora.nvram_save() or lora.nvram_erase() command has been issued.

      Some devices in the field are failing at doing the restore and, since are running ABP, then they go out of sync with the server because the fCnt resets (while the server has no way of knowing this). I know that going with ABP brings these kinds of issues, but OTAA just isn't an option for us because we are having trouble with the LoPy hearing the Join Accept packets from the server - and thus never join.

      So, the kind of behaviour we would like, would be:

      1. Turn on LoPy4
      2. Attempt to restore
      3. If the LoPy powers off during the restore (which can happen in our case, since the devices are manually connected/disconnected from their power supply), don't erase the lora context.
      4. When the LoPy powers on again, attempt to restore again (which should work, since the context was not erased before). However, since no lora.nvram_save() has been called, don't erase the past lora context from memory even if the restore was successful.
      5. Then do the work, transmit, lora.nvram_save() (which would update the lora context in memory).

      I feel this would be a more foolproof method of handling these functions, but of course I may be missing something, and Pycom didn't implement this in this manner because of some othe reason?

      Currently, if we fail once at doing the restore, the next time we attempt it, the fCnt is lost and we're out of sync with the server until the fCnt surpasses the value saved on the server. This would save us so many problems...

      Any way this can be implemented? What do you guys think?

      Best wishes,

      Dan

      p.s. Running the following firmware: (sysname='LoPy4', nodename='LoPy4', release='1.20.2.rc6', version='v1.11-01f49f7 on 2020-02-28', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1', pybytes='1.3.1')

      robert-hhR 1 Reply Last reply Reply Quote 4
      • robert-hhR Offline
        robert-hh @d.alvrzx
        last edited by

        @d-alvrzx I strongly support this request. I see, that restoring some of the data may cause trouble, if restore is executed multiple time w/o a save in between. Like the packet counters. But that is less cumbersome than loosing all data.

        See also my notes here to retrieve individual elements: https://forum.pycom.io/topic/5922/an-alternative-to-nvram_save-restore-using-the-sd-card/6?

        1 Reply Last reply Reply Quote 3

        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