LoRaWAN nano gateway and activation issues

  • Hi! I've been playing with two LoPy boards on The Things Network, just some basic getting started. I've used the LoRaWAN nano gateway example to deploy one of them, and the OTAA node example on the other, following pretty much the tutorial. It generally works well, I can send and receive messages from the node. But I run into an issue, that if I restart the node a few times, after a while it does not seem to be able to activate on the network when starting. Not all the time, but happened quite a few times in this last few days I've been playing with it.

    What happens, is that watching the device's traffic (in The Things Network console), all I see is a series of Activation requests, and no other communication.

    In the same time, watching the gateway traffic, I see a series of Join Request and Join Accept messages:

    So I'd assume that the network accepted the device, but it still doesn't activate correctly.

    The only way I can activate in this case is restarting the gateway, after which the node device correctly activates and begins to communicate.

    Does this look like some kind of issue in the nanogateway, the lora library on LoPy, or the node? Any feedback?

  • @bucknall i have the same problem of @moenad OTTA with nanogateway, (but not with Conduit for example). Could you find any solution to this?

  • Activation problems usually boil down to one of two issues:

    1. You have a firewall on your WiFi which is blocking inbound UDP to the LoPy

    2. The join accept is processed too late along the path to meet the node's receive window. This is where it gets a bit more complicated.

    For what are, to me, dubious reasons TTN insists on sending downlinks such as join accept messages at the very last moment. If you look at your timestamp on your screenshots you see the join request at 11:42:28 and the the join accept at 11:42:33 or 5 seconds later.

    The problem is 5 seconds - according to the LoRaWAN spec - is exactly when the node expects the join accept reply, so if you have a slower network or the LoPy is doing something else the window is easily missed.

    TTN doesn't need to do this as most gateways have the ability to queue packets for transmission in advance, but for some reason they do.

    I've had a look in the past and maybe the _type == PULL_RESP handling block in the nanogateway.py code could be optimised to help with this but optimising timing critical network code can - paradoxically - be time consuming ...

  • @moenad I only ask because the LoPy will work without an antenna but it should not be used in this manner.

    Let me create/add another device to the TTN and see if I can replicate your issue.

  • @bucknall Yes, I do. As I said, ABP is working, OTAA is stuck in an infinite loop of Join Request/Accept exactly like the OP mentioned in his post.

  • @moenad It might sound a little silly but do you have the antenna connected to the correct connector (closest to the LED)?

  • @bucknall

    Honestly, there's nothing worth sharing.

    I copy pasted this file as is: https://github.com/pycom/pycom-libraries/blob/master/examples/lorawan-nano-gateway/nanogateway.py, same for main.py in the same repo. The only file I edited in the config.py are not LoRa related (WIFI SSID and Password). Gateway is available in Europe.
    For the LoRawan node, I'm running this example as is (copy/pasted) https://github.com/pycom/pycom-libraries/blob/master/examples/lorawan-nano-gateway/otaa_node.py
    I changed the dev_eui, app_eui and app_key to match the ones in the TTN.

    I'm still in the first stages with lopy, haven't started working on my own project yet.

  • @moenad hmm I'm stumped in that case because I also followed the instructions as to ensure that I was replicating any issues!

    Would you mind sharing your code with me (via private message/email - alex@pycom.io) so I can see what/if there are any differences to what I'm using?

  • @bucknall I did that multiple times :) I also removed the gateway and re-created it.

    I'm also running the latest firmware.

  • @moenad Hmm ok - I have an instance running with the exact code (the docs OTAA example) I linked to below and it's functioning correctly.

    Maybe try removing the previous TTN application you set up and creating another one? I had issues previously with TTN seeming to not issue the correct Application EUI for my devices.

    I did notice that it takes quite some time for the device to connect via OTAA however...

  • @bucknall

    I have the exact same code running, I followed the documentation properly. Trying the RAK811 right now, ABP works, OTAA doesn't.
    ABP also works fine on the lopy node, I thought first it only works once because the same counter data "PKT #1"... wasn't showing again.
    I have the channels restricted on the RAK811 also, similar to the ones mentioned in the docs.

    One more thing, the up to date instructions you linked first is using ABP not OTAA. So the main issue for me is getting OTAA to work.

  • @moenad Ah ok - what code are you using for your LoRa node? You need to restrict the LoRaWAN channels that it uses.

    The reason behind this is that the LoPy does not have access to all of the required channels for a 'true' LoRaWAN gateway and thus you need to restrict the channels that a node will use. We provide an example within our docs for how to set up the node correctly (https://docs.pycom.io/chapter/tutorials/lopy/lorawan-nano-gateway.html).

    Let me know if this helps!

  • @bucknall said in LoRaWAN nano gateway and activation issues:



    Thank you for the reply. I did exactly as what's mentioned in the link before and it never worked. So I re-did everything now following the instructions in the link, and I get the same issue. It's been running for the past 15-20 minutes, nothing yet.

    In the TTN gateway traffic I only see Join Request and Join Accept, one after the other.
    In the TTN applications device/node data, I see Activation packet only.
    In the OTAA example from github, I only get "Not Joined yet".

    Trying a RAK811 lora node, will do exactly the same thing. It won't connect either and I keep seeing the same data cycle happening here.

  • @moenad @jcvg

    I've set up a LoPy LoRaWAN Nano Gateway using the Things Network and it seems to be working correctly. There are some slightly different instructions (i.e. selecting legacy packet forwarder) but generally the instructions are the same.

    I did find that it took a little while for my node LoPys to connect to the Gateway. How long are you waiting for the nodes to connect?

    Also there are up to date instructions here - https://github.com/franckalbinet/iot-smr3128-ictp/blob/master/labs/lorawan-nano-gateway.md. I will move these over to the docs when I get time.

    Let me know how you get on!



  • Same issue, I've been trying for few days without any luck....

    I only managed to get it to work via ABP.

  • @jcvg Yes, it might be the case, the thing is that this is not "systematic". I'll give another try in the next few days and report back.

  • @agotsis, could it be the nano gateway that somehow does not relay that join-accept after too many attempts?

  • @jcvg I have also observed this behavior occasionally (only with OTAA, not with ABP), but to my understanding this has to do with TTN and not the LoPys. I attribute this to TTN because without making any change to my nodes, all of a sudden the problem disappears and then after some days re-appears. Unfortunately I can not replicate it right now. Give it a try tomorrow for example and see what is the case.

  • Dear Alex,

    I am seeing the exact same thing here. Have you managed to replicate it?



  • Hi @imrehg,

    Investigating this for you! This sounds like the gateway might be having an issue with memory - could be to do with the gateway.py script - will get back to you with more info once I've tried to replicate your issue!



Log in to reply

Pycom on Twitter