Nodes unable to join TTN via LoPy nano gateway

  • Hi all,

    I am trying to set up the LoPy as a nano gateway. I followed the tutorial, but still run into some connectivity issues.

    The nano gateway is registered, I ticked the box 'I'm using a packet forwarder' and I can see in the console that it is connected to TTN.

    In order to test the gateway, I am using an MTDOT-BOX-G-915 that I used previously to test another gateway (but not based on a LoPy).

    The nano gateway can forward the Join Requests of the node to TTN (I can see those messages in the console, see the screenshot below). But then it seems no packet goes back to the node as it is not able to join the network.


    The interesting thing bit is that all the Join Requests are made by the same node, but the app eui and dev eui change all the time.

    Here are a the detail couple of requests made by the same node:

    "gw_id": "eui-XXXX",
      "payload": "ACYhbpBc59DgWb8gIzfm0DQIcXrQTus=",
      "dev_eui": "34D0E6372320BF59",
      "lora": {
     "spreading_factor": 10,
        "bandwidth": 125,
        "air_time": 370688000
      "coding_rate": "4/5",
      "timestamp": "2017-05-22T14:50:20.747Z",
      "rssi": -54,
      "snr": -9,
      "app_eui": "E0D0E75C906E2126",
      "frequency": 917999900
    "gw_id": "eui-XXXX",
      "payload": "AEVFAPB+1bNwy76QCQoZEQAX/JeBwlI=",
      "dev_eui": "0011190A0990BECB",
      "lora": {
     "spreading_factor": 10,
        "bandwidth": 125,
        "air_time": 370688000
      "coding_rate": "4/5",
      "timestamp": "2017-05-22T14:52:18.184Z",
      "rssi": -97,
      "snr": -65,
      "app_eui": "70B3D57EF0004545",
      "frequency": 917999900

    Here is the (I am in Australia, so I had to change the frequency and some other details) :

    SERVER = '' 
    PORT = 1700
    NTP = "" 
    NTP_PERIOD_S = 3600 
    LORA_FREQUENCY = 91800000
    LORA_DR = "SF10BW125"  

    In the file nanogatewy.pi I changed the following:

    RX_PK = {"rxpk": [{"time": "", "tmst": 0,
                       "chan": 6, "rfch": 0,
                       "freq": 918.0, "stat": 1,
                       "modu": "LORA", "datr": "SF10BW125",
                       "codr": "4/5", "rssi": 0,
                       "lsnr": 0, "size": 0,
                       "data": ""}]}

    I also made sure that the port 1700 is open on my router and that UDP packets coming through that port are routed to the LoPy.

    I did try other TTN routers (asia-se, au,...) as well, but with always the same results.

    Also, I tried to connect the LoPy as a node to TTN via an other gateway, and it did work properly. So the Lora radio module works.

    Do you have any idea why I cannot get that node to join TTN via the LoPy nano gateway? Is there something I am missing somewhere?



  • Finally I could get the node to join TTN! :D

    I needed to add a delay of 5 seconds before the node starts listening for the response of the Join Request with the command AT+JD:

    > AT+JD=5
    > AT+JOIN
    Successfully joined network

    Also the fix for _send_down_link in my last post is no more needed as the frequency in the Event Data is now ok.

  • I have made some progress thanks to your suggestion.

    To set the node to use only one channel (here 918Mhz) I can use the commands AT+CHM:


    and AT+TXCH to do a check:

    Index	Frequency  DR Max Min  On
      0	916800000      3   0    0
      1	917000000      3   0    0
      2	917200000      3   0    0
      3	917400000      3   0    0
      4	917600000      3   0    0
      5	917800000      3   0    0
      6	918000000      3   0    1
      7	918200000      3   0    0
      U	917500000      4   4    1
      R2	923300000      8   8

    Then I could see in the Console that the Join Requests are accepted, but the nano gateway still did not transfert those messages to the node.

    Here is the Event Data of the Join Accept:

      "gw_id": "eui-XXX",
      "payload": "IHFSiaovCJacFacBPZaei8Q=",
      "lora": {
        "spreading_factor": 10,
        "bandwidth": 500,
        "air_time": 82432000
      "coding_rate": "4/5",
      "timestamp": "2017-05-24T10:52:35.449Z",
      "frequency": 925700000

    So I figured that the frequency in the Event Data (925.7 Mhz) does not match the frequency the node is using.

    To fix that, I modified the function _send_down_link so that it uses the good frequency to forward the message:

    def _send_down_link(self, data, tmst, datarate, frequency):
            self.lora.init(mode=LoRa.LORA, frequency=self.frequency, bandwidth=LoRa.BW_125KHZ,
                           sf=self._dr_to_sf(datarate), preamble=8, coding_rate=LoRa.CODING_4_5,
            while time.ticks_us() < tmst:

    (it simply ignores the wrong frequency mentionned in the Event Data).

    Now I get the following error:

    > Downlink timestamp error!, t_us: 4295066743

    Do you have any idea how I can fix that one?

  • Thanks! I'll have a look and let you know how it goes.

  • @jojo you need to set your MTDOT to only use a single channel - I'm not exactly sure how to do this but try their documentation! I'll have a look into it for you if you can't find anything.

  • Hi @bucknall,

    As I use an MTDOT, I am using the following at commands:

    # waking up the moduel
    > at
    # enable public network mode
    > at+pn=1
    # selecting the sub-band for Australia
    > at+fsb=2
    # selecting OTA mode
    > at+njm=1
    # app eui
    > at+ni=0,XXXXXX
    Set Network ID: XX-XX-XX
    # app key
    > at+nk=0,XXXXXX
    Set Network Key: XXXXXX
    # bumping the tx power
    > at+txp=20
    # joining the network
    > at+join
    Failed to join network

    (more info on the AT commands can be found here here).

  • Hi @jojo,

    Could you please share the code that you are using for your nodes? The Nano-Gateway is only a single channel gateway (Not a formal LoRaWAN Gateway) so you need to do some specific configuration to allow for this.


Pycom on Twitter