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

    Using LoraWan and raw lora in the same device

    Scheduled Pinned Locked Moved LoPy
    8 Posts 3 Posters 303 Views 3 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.
    • A Offline
      AryaS1996
      last edited by

      Hi I'm new to pycom!

      I have 3 Lopy4 one of them configured as a gateway connected to TTN.

      I'm reading information from some sensors with one of the Lopys (sensor node) and sending it to another Lopy with raw Lora. I want to use this last device to send the information recived from the sensor node to the gateway using LoraWan with OTAA but I'm having some trouble trying to combine both protocols in the same node.

      Has anyone tryed something similar? Do you know if it's possible to use LoraWan and raw Lora in the same device in an efficient way?

      Any help would be very much appreciated.
      Thank you in advance!

      Arya

      robert-hhR J 2 Replies Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @AryaS1996
        last edited by robert-hh

        @AryaS1996 That should be possible, by calling LoRa.init() with the respective mode when needed. You have to preserve the LoRaWAN state, e.g. by using lora.nvram_save() before leaving LoraWAN mode and using lora.nvram_restore() after entering LoRAWAN mode again.

        J A 2 Replies Last reply Reply Quote 2
        • J Offline
          jcaron @AryaS1996
          last edited by

          @AryaS1996 I believe there was a thread on this subject a few months ago, though I can’t find it right now, and I don’t remember the conclusion.

          My guess is that you would have to use only raw LoRa and do the LoRaWan parts yourself rather than letting the LoRa stack do it. See the nano-gateway code for an example of such an implementation (though on the gateway side of course).

          You would need to manage encryption, counters, MAC commands and so on yourself. Quite a bit of work.

          I don’t think the LoRa stack as it works at the moment would allow you to switch modes on the fly (unless you perform a new join every time you want to send a frame to the gateway).

          robert-hhR A 2 Replies Last reply Reply Quote 1
          • robert-hhR Offline
            robert-hh @jcaron
            last edited by

            @jcaron Optimally, joining has to be done only once, doing ABP or OTAA. Then the node only has to memorize it's connection parameters.

            1 Reply Last reply Reply Quote 1
            • J Offline
              jcaron @robert-hh
              last edited by

              @robert-hh are you sure switching modes wouldn’t clear the saved state?

              robert-hhR 1 Reply Last reply Reply Quote 1
              • robert-hhR Offline
                robert-hh @jcaron
                last edited by

                @jcaron No. I would have to try.

                1 Reply Last reply Reply Quote 0
                • A Offline
                  AryaS1996 @robert-hh
                  last edited by

                  @robert-hh Using lora.nvram_save() worked and solved my problems!
                  Thank you very much for your help :)

                  1 Reply Last reply Reply Quote 1
                  • A Offline
                    AryaS1996 @jcaron
                    last edited by

                    @jcaron My first try was performing a new join every time and that worked but it was not efficient. Finally I could make it work using the lora.nvram_save() before leaving LoraWan and lora.nvram_restore() after entering LoRAWAN mode again. It seems to be working now :)

                    Thanks for your help!

                    1 Reply Last reply Reply Quote 2

                    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