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

    TTN join accept not handled properly

    Scheduled Pinned Locked Moved LoPy
    lopynetworknano gatewayttn
    20 Posts 8 Posters 10.0k Views 12 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.
    • R Offline
      rikkertmark
      last edited by

      @bucknall there are more people with the same problem, do you any idea what the problem is?

      B 1 Reply Last reply Reply Quote 0
      • B Offline
        bucknall @rikkertmark
        last edited by

        @rikkertmark & community members,

        There seem to have been some changes with how TTN has been configuring gateways/gateway traffic.

        I'm going to reach out to them and see what's going on because I've also had hit/miss success with gateways connecting to their network.

        Apologies for the confusion/frustration but I believe the issue is with their changes rather than the Nano-Gateway but I will very much verify this and get back to you with a solution.

        Thanks!

        Alex

        Developer Evangelist - Pycom

        1 Reply Last reply Reply Quote 1
        • M Offline
          miroslav.petrov
          last edited by

          +1
          My LoPy is also constantly sending join requests to the gateway and is not receiving the join accept. I am using the example code from the pycom docs.

          B 1 Reply Last reply Reply Quote 0
          • B Offline
            bucknall @miroslav.petrov
            last edited by

            Hi @miroslav.petrov,

            I'll push an update later today but do not use the example from the docs for the nano-gateway, instead use the code on GitHub -

            https://github.com/pycom/pycom-libraries/tree/master/examples/lorawan-nano-gateway

            This includes both the nano-gateway and the node (OTAA or ABP)

            Developer Evangelist - Pycom

            M 1 Reply Last reply Reply Quote 1
            • M Offline
              miroslav.petrov @bucknall
              last edited by

              @bucknall
              I am using LoPy as node and the gateway is ic880a(it is not mine). I am using the things network. I tried this example:
              https://github.com/pycom/pycom-libraries/blob/master/examples/lorawan-nano-gateway/abp_node.py
              and I changed the channels to the default in TTN. However, the node is not able to either send or receive messages.

              B 1 Reply Last reply Reply Quote 0
              • B Offline
                bucknall @miroslav.petrov
                last edited by

                @miroslav.petrov What version of firmware is your LoPy using? You can find out with this command:

                import os
                os.uname()
                

                Developer Evangelist - Pycom

                M 1 Reply Last reply Reply Quote 0
                • M Offline
                  miroslav.petrov @bucknall
                  last edited by

                  @bucknall

                  The latest.

                  B 1 Reply Last reply Reply Quote 0
                  • B Offline
                    bucknall @miroslav.petrov
                    last edited by

                    @miroslav.petrov I assume you're not based in an 868 MHz region? What do you have the data rate (e.g. dr_min=0, dr_max=5) set to?

                    Developer Evangelist - Pycom

                    M 1 Reply Last reply Reply Quote 0
                    • M Offline
                      miroslav.petrov @bucknall
                      last edited by

                      @bucknall
                      I am in Bulgaria we are using 868mhz. The data rate is set to (dr_min=0, dr_max=5) as in the example. If I change the dr_max to more than 5 I get errors.

                      J B 2 Replies Last reply Reply Quote 0
                      • J Offline
                        jmarcelino @miroslav.petrov
                        last edited by

                        @miroslav.petrov in 868Mhz EU and with a multichannel gateway you can delete all the remove_channel and add_channel calls as you'll just the default channels, which match TTN's

                        1 Reply Last reply Reply Quote 0
                        • B Offline
                          bucknall @miroslav.petrov
                          last edited by bucknall

                          @miroslav.petrov Hmm ok. Yes, the data rate you have set is correct. Can you share your abp_node.py file with your channel changes, please? If you're not using the nano-gateway, you don't need to set the channels as the gateway you are using will likely be multichannel.

                          Developer Evangelist - Pycom

                          M 2 Replies Last reply Reply Quote 0
                          • M Offline
                            miroslav.petrov @bucknall
                            last edited by

                            @bucknall
                            I tried setting the channels with this code

                            from network import LoRa
                            import socket
                            import binascii
                            import struct
                            import time
                            
                            # Initialize LoRa in LORAWAN mode.
                            lora = LoRa(mode=LoRa.LORAWAN)
                            
                            # create an ABP authentication params
                            dev_addr = struct.unpack(">l", binascii.unhexlify('26 XX XX AE'.replace(' ','')))[0]
                            nwk_swkey = binascii.unhexlify('A07061XXXX60D67F3XXXX28436D001C0'.replace(' ',''))
                            app_swkey = binascii.unhexlify('A89CE0XXXXECBCAD2F48F1XXXX6FCD81'.replace(' ',''))
                            
                            # join a network using ABP (Activation By Personalization)
                            lora.join(activation=LoRa.ABP, auth=(dev_addr, nwk_swkey, app_swkey))
                            
                            # remove all the non-default channels
                            for i in range(3, 16):
                                lora.remove_channel(i)
                            
                            # set the 3 default channels to the same frequency
                            lora.add_channel(0, frequency=868100000, dr_min=0, dr_max=5)
                            lora.add_channel(1, frequency=868300000, dr_min=0, dr_max=5)
                            lora.add_channel(2, frequency=868500000, dr_min=0, dr_max=5)
                            lora.add_channel(0, frequency=867100000, dr_min=0, dr_max=5)
                            lora.add_channel(1, frequency=867300000, dr_min=0, dr_max=5)
                            lora.add_channel(2, frequency=867500000, dr_min=0, dr_max=5)
                            lora.add_channel(0, frequency=867700000, dr_min=0, dr_max=5)
                            lora.add_channel(1, frequency=867900000, dr_min=0, dr_max=5)
                            
                            # create a LoRa socket
                            s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
                            
                            # set the LoRaWAN data rate
                            s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)
                            
                            # make the socket blocking
                            s.setblocking(False)
                            
                            
                            for i in range (200):
                                s.send(b'PKT #' + bytes([1, 2, 3]))
                                time.sleep(4)
                                rx = s.recv(256)
                                if rx:
                                    print(rx)
                                time.sleep(6)
                            ex
                            

                            I also tried removing the channel specifications like this:

                            from network import LoRa
                            import socket
                            import binascii
                            import struct
                            import time
                            
                            # Initialize LoRa in LORAWAN mode.
                            lora = LoRa(mode=LoRa.LORAWAN)
                            
                            # create an ABP authentication params
                            dev_addr = struct.unpack(">l", binascii.unhexlify('26 XX XX AE'.replace(' ','')))[0]
                            nwk_swkey = binascii.unhexlify('XXXXXX79F460XXXXXX8AD28436XXX1C0'.replace(' ',''))
                            app_swkey = binascii.unhexlify('XXXXXXE33XXXXXXD2F48F1F5CDXXXD81'.replace(' ',''))
                            
                            # join a network using ABP (Activation By Personalization)
                            lora.join(activation=LoRa.ABP, auth=(dev_addr, nwk_swkey, app_swkey))
                            
                            # create a LoRa socket
                            s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
                            
                            # set the LoRaWAN data rate
                            s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)
                            
                            # make the socket blocking
                            s.setblocking(False)
                            
                            
                            for i in range (200):
                                s.send(b'PKT #' + bytes([1, 2, 3]))
                                time.sleep(4)
                                rx = s.recv(256)
                                if rx:
                                    print(rx)
                                time.sleep(6)
                            ex
                            
                            1 Reply Last reply Reply Quote 0
                            • M Offline
                              miroslav.petrov @bucknall
                              last edited by

                              @bucknall

                              Do you have any suggestions?

                              1 Reply Last reply Reply Quote 0
                              • G Offline
                                gertjanvanhethof Pybytes Beta
                                last edited by

                                I updated my LoPy to the latest firmware and go the latest nano gateway sources from Pycom from github.
                                The issue is still there. Gateway is connected well but node is not able to connect to TNN. The join accept messages shown in the TTN console are received but PyMakr console still shows "Not joined".
                                Can you please fix this issue?

                                R 1 Reply Last reply Reply Quote 0
                                • R Offline
                                  rvandam @gertjanvanhethof
                                  last edited by

                                  @gertjanvanhethof I have the same problem with joining by OTAA.

                                  Strangely it works after I do a reset of the nano gateway, so:

                                  1. switch on the gateway (and wait a bit)
                                  2. switch on the node --> not joining
                                  3. reset the gateway --> now it works

                                  I bet there is something wrong in the order the nano gateway handle things.

                                  1 Reply Last reply Reply Quote 0
                                  • H Offline
                                    hakan kayan
                                    last edited by

                                    I know this is a quite old topic, but I have the same issue. It seems like the issue does still persists.

                                    1 Reply Last reply Reply Quote 0

                                    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