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

    Lorawan node can not send packages. US frequency.

    Scheduled Pinned Locked Moved LoPy
    nodelorawanus-frequencylostpackages
    4 Posts 3 Posters 1.3k 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.
    • B Offline
      blackansible
      last edited by

      I tried to set a lorawan nsode US frequencies, but i can not get traffic in my gateway, sometimes only get 1 or 2 packages. I supposed that my transcever was damaged but if i use lora-lora connection it works well.

      I am attaching the code if the community see something wrong that helps me.

      from network import LoRa
      import socket
      import binascii
      import struct
      import time

      Initialize LoRa in LORAWAN mode.

      lora = LoRa(mode=LoRa.LORAWAN, public=True, adr=True)

      create an ABP authentication params

      dev_addr = struct.unpack(">l", binascii.unhexlify('01 0E 1A DD'.replace(' ','')))[0]
      nwk_swkey = binascii.unhexlify('47400CAAE9B7B6E2A3EDD26F45274BBE'.replace(' ',''))
      app_swkey = binascii.unhexlify('D06604A453F36920881C5AD78FE10E4D'.replace(' ',''))

      set the channels

      #lora.add_channel(0, frequency=902300000, dr_min=0, dr_max=4)
      #lora.add_channel(1, frequency=902500000, dr_min=0, dr_max=4)
      #lora.add_channel(2, frequency=902700000, dr_min=0, dr_max=4)
      #lora.add_channel(3, frequency=902900000, dr_min=0, dr_max=4)
      #lora.add_channel(4, frequency=903100000, dr_min=0, dr_max=4)
      #lora.add_channel(5, frequency=903300000, dr_min=0, dr_max=4)
      #lora.add_channel(6, frequency=903500000, dr_min=0, dr_max=4)
      #lora.add_channel(7, frequency=903700000, dr_min=0, dr_max=4)

      lora.add_channel(0, frequency=902300000, dr_min=0, dr_max=3)

      remove all the non-default channels

      for i in range(1, 15):
      lora.remove_channel(i)

      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, 3)

      make the socket blocking

      s.setblocking(False)

      for i in range (200):
      print("Sending..")
      s.send(b'PKT #' + bytes([i]))
      time.sleep(4)

      rx = s.recv(256)
      if rx:
          print(rx)
      time.sleep(6)
      
      J J 2 Replies Last reply Reply Quote 0
      • J Offline
        jmarcelino @blackansible
        last edited by jmarcelino

        @blackansible said in Lorawan node can not send packages. US frequency.:

        for i in range(1, 15):
        lora.remove_channel(i)

        Are you using a single channel gateway (for example another LoPy as as a nano gateway)?

        If so you need to remove_channels up to 72, not just 15.

        1 Reply Last reply Reply Quote 0
        • J Offline
          jcaron @blackansible
          last edited by

          @blackansible what does lora.has_joined() return? Note that it may take a little while to join.

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jmarcelino @jcaron
            last edited by

            @jcaron
            The code is using ABP so there is no actual join procedure, it's just assigning keys

            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