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

    OTAA does not join for US config. using last firmware

    Scheduled Pinned Locked Moved LoPy
    otaausalorattn gatewayjoin
    4 Posts 2 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 jmarcelino

      I changed frequencies as recommended.
      Changed dr_max=4 instead of 5
      Changed socket.SO_DR, 3
      But funciton lora.has_joined(): always send false

      With abp works without problem. Do you see an error in my code. I read all the post about OTAA and nothing. Somebody from pycom engineering.

      Best regards,

      from network import LoRa
      import socket
      import binascii
      import struct
      import time
      
      # Initialize LoRa in LORAWAN mode.
      lora = LoRa(mode=LoRa.LORAWAN)
      
      # create an OTA authentication params
      dev_eui = binascii.unhexlify('70 B3 D5 49 9E A9 24 C0'.replace(' ',''))
      app_eui = binascii.unhexlify('70 B3 D5 7E F0 00 5A 3F'.replace(' ',''))
      app_key = binascii.unhexlify('36 AB 76 25 FE 77 77 68 81 68 3B 49 53 00 FF D6'.replace(' ',''))
      
      # remove channels
      for channel in range(0, 72):
          lora.remove_channel(channel)
      
      # set the default channel to the same frequency (must be before sending the OTAA join request)
      lora.add_channel(0, frequency=903900000, dr_min=0, dr_max=4)
      
      # join a network using OTAA
      lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0)
      
      # wait until the module has joined the network
      while not lora.has_joined():
          time.sleep(2.5)
          print('Not joined yet...')
      
      # 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)
      
      time.sleep(5.0)
      
      for i in range (200):
          s.send(b'PKT #' + bytes([i]))
          time.sleep(4)
          rx = s.recv(256)
          if rx:
              print(rx)
          time.sleep(6)
      
      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jmarcelino @blackansible
        last edited by jmarcelino

        @blackansible
        What are you using as your LoRaWAN gateway?

        B 1 Reply Last reply Reply Quote 0
        • B Offline
          blackansible @jmarcelino
          last edited by

          @jmarcelino Lopy gateway

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

            @blackansible
            Try this modification in your nanogateway.py code:

            https://forum.pycom.io/post/8290

            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