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

    LoPy4 Nano-Gateway: no push/pull of ACKS

    Scheduled Pinned Locked Moved LoPy
    2 Posts 2 Posters 203 Views 2 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.
    • securigyS Offline
      securigy
      last edited by securigy

      I have been digging this issue for a while, including this forum, google, etc, but getting nowhere.

      • I registered the LoPy4 device in TTN
      • I registered another LoPy4 device (connected to PyTrack Expansion board) as Nano-Gateway.

      First, I need to fix the issue with gateway - it is not push/pull acks at all and I am not sure why...
      Config.py

      #!/usr/bin/env python
      #
      # Copyright (c) 2019, Pycom Limited.
      #
      # This software is licensed under the GNU GPL version 3 or any
      # later version, with permitted additional terms. For more information
      # see the Pycom Licence v1.0 document supplied with this file, or
      # available at https://www.pycom.io/opensource/licensing
      #
      
      """ LoPy LoRaWAN Nano Gateway configuration options """
      
      import machine
      import ubinascii
      
      #WIFI_MAC = ubinascii.hexlify(machine.unique_id()).upper()
      # Set  the Gateway ID to be the first 3 bytes of MAC address + 'FFFE' + last 3 bytes of MAC address
      GATEWAY_ID = "ca11ab1e" #WIFI_MAC[:6] + "FFFE" + WIFI_MAC[6:12]
      print("Gateway ID: %s" % GATEWAY_ID)
      
      # I cannot ping neither to this router nor to router.eu.thethings.network
      # I tried to use my local router 192.168.1.1 but the results are the same...
      SERVER = 'router.us.thethings.network'
      PORT = 1700
      
      NTP = "pool.ntp.org"
      NTP_PERIOD_S = 3600
      
      WIFI_SSID = 'zzzzzzzzzzzzzz'
      WIFI_PASS = 'zzzzzzzzzzzzzzzzzzz'
      
      # for EU868
      #LORA_FREQUENCY = 868100000
      #LORA_GW_DR = "SF7BW125" # DR_5
      #LORA_NODE_DR = 5
      
      # for US915
      # I tried both US frequencies - no difference...
      LORA_FREQUENCY_9039 = 903900000
      LORA_FREQUENCY_9151 = 915100000
      LORA_GW_DR = "SF10BW125" # DR_0
      LORA_NODE_DR = 4
      
      

      main.py

      
      #!/usr/bin/env python
      #
      # Copyright (c) 2019, Pycom Limited.
      #
      # This software is licensed under the GNU GPL version 3 or any
      # later version, with permitted additional terms. For more information
      # see the Pycom Licence v1.0 document supplied with this file, or
      # available at https://www.pycom.io/opensource/licensing
      #
      
      """ LoPy LoRaWAN Nano Gateway example usage """
      
      import config
      from nanogateway import NanoGateway
      
      if __name__ == '__main__':
          nanogw = NanoGateway(
              id=config.GATEWAY_ID,
              frequency=config.LORA_FREQUENCY_9039,
              datarate=config.LORA_GW_DR,
              ssid=config.WIFI_SSID,
              password=config.WIFI_PASS,
              server=config.SERVER,
              port=config.PORT,
              ntp_server=config.NTP,
              ntp_period=config.NTP_PERIOD_S
              )
      
          nanogw.start()
          nanogw._log('You may now press ENTER to enter the REPL')
          input()
      
      

      I did not change nanogateway.py except this (added the region):

      self.lora = LoRa(
                  mode=LoRa.LORA,
                  region=LoRa.US915,
                  frequency=self.frequency,
                  bandwidth=self.bw,
                  sf=self.sf,
                  preamble=8,
                  coding_rate=LoRa.CODING_4_5,
                  tx_iq=True
              )
      

      ...and yet, I get the following and no push/pull of ACK is being seen:
      Gateway ID: ca11ab1e
      [ 972.280] Starting LoRaWAN nano gateway with id: ca11ab1e
      [ 977.101] WiFi connected to: SoftDev
      [ 977.105] Syncing time with pool.ntp.org ...
      [ 983.261] RTC NTP sync complete
      [ 983.277] Opening UDP socket to router.us.thethings.network (13.66.213.36) port 1700...
      [ 983.289] Setting up the LoRa radio at 903.9001 Mhz using SF10BW125
      [ 983.299] LoRaWAN nano gateway online
      [ 983.304] You may now press ENTER to enter the REPL

      Please help.

      EDIT:

      • I deleted the gateway from the registry
      • changed how the gateway ID is comprised by using this (as it was originally instead of my own ID):
      WIFI_MAC = ubinascii.hexlify(machine.unique_id()).upper()
      # Set  the Gateway ID to be the first 3 bytes of MAC address + 'FFFE' + last 3 bytes of MAC address
      GATEWAY_ID = WIFI_MAC[:6] + "FFFE" + WIFI_MAC[6:12]
      
      • Then I registered the gateway with this ID.
        This fixed the problem of missing push/pull acks....

      However, the gateway is still showing in TTN Console as "not connected".
      Anybody can explain to me why? And how to fix that?

      EDIT2:
      Then after I started it with Upload and after 28 pairs of push/pull ack, I got this (a single packet from hell ;-):
      5266.078] Push ack
      [ 5281.065] Pull ack
      [ 5306.062] Pull ack
      [ 5326.067] Push ack
      [ 5331.073] Pull ack
      [ 5356.067] Pull ack
      [ 5381.071] Pull ack
      [ 5386.056] Push ack
      [ 5406.065] Pull ack
      [ 5406.543] Received packet: {"rxpk": [{"data": "oP0suSa13tED8G+NfAz5yHUMH7Yk7ayZQUVWVCyFVle2OCWcfa6RyoxCDoNuQ+DpcOVVQXQLImCv+eQo4L1YGvN+oTFX/XimQmjAMXoVCPf+G0AoA7Z2eA==", "time": "2019-08-26T22:56:39.303916Z", "chan": 0, "tmst": 1107406754, "stat": 1, "modu": "LORA", "lsnr": -13.0, "rssi": -123, "rfch": 0, "codr": "4/5", "freq": 903.9, "datr": "SF7BW125", "size": 88}]}
      [ 5406.610] Push ack
      [ 5431.056] Pull ack
      [ 5446.067] Push ack
      [ 5456.073] Pull ack

      No Idea, how and why...Could it be because I switched from SF10BW125 to SF7BW125 ?

      EDIT3:
      So the LoRa code is there and the questions remain against it since something is not working there and there is no way to know what...Considering this and how long it took to install DFU drivers and firmware updates for LoPy and Expansition Boards with this Zadig clumsiness, I am asking myself whether is it the right move to consider LoRaWAN at all...

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @securigy
        last edited by

        @securigy The single packet you have seen may be just noise. We see these all the time. The CRC should be wrong.

        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