Using LoraWan and raw lora in the same device



  • 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



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



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



  • @jcaron No. I would have to try.



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



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



  • @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).



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


Log in to reply
 

Pycom on Twitter