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

    FiPy with LoRaWAN using AS923 channel plan

    Scheduled Pinned Locked Moved FiPy
    lorawanlorawan channelas923
    3 Posts 2 Posters 1.5k 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.
    • K Offline
      kompleteb
      last edited by kompleteb

      Been trying to get my FiPy hooked up with LoraWAN and struck an incompatiblity with AS923.

      The following code:

      import uos
      import utime
      from network import LoRa
      from machine import unique_id
      import ubinascii

      def mac2eui(mac):
      mac = mac[0:6] + 'fffe' + mac[6:]
      return hex(int(mac[0:2], 16) ^ 2)[2:] + mac[2:]

      print(uos.uname())
      unique_id = ubinascii.hexlify(unique_id()).decode()

      lora = LoRa(mode=LoRa.LORAWAN)
      dev_eui = mac2eui(unique_id)
      print("\n",dev_eui)
      app_eui = binascii.unhexlify('70 B3 D5 7E F0 00 3B FD'.replace(' ',''))
      app_key = binascii.unhexlify('36 AB 76 25 FE 77 0B 68 81 68 3B 49 53 00 FF D6'.replace(' ',''))

      for channel in range(0, 16):
      lora.remove_channel(channel)

      lora.add_channel(0, frequency=923200000, dr_min=0, dr_max=5)
      lora.add_channel(1, frequency=923400000, dr_min=0, dr_max=5)

      lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0)

      while not lora.has_joined():
      print("not joined yet...")
      utime.sleep(2.5)

      print("JOINED!!!!")

      gives the following output:

      (sysname='FiPy', nodename='FiPy', release='1.13.0.b1', version='v1.8.6-849-656704e on 2018-01-10', machine='FiPy with ESP32', lorawan='1.0.0', sigfox='1.0.1')

      32aea4fffe2a4bdc
      Traceback (most recent call last):
      File "<stdin>", line 27, in <module>
      ValueError: invalid argument(s) value

      MicroPython v1.8.6-849-656704e on 2018-01-10; FiPy with ESP32
      Type "help()" for more information.

      The issue is that the add_channel() method does not allow for a dr_max > 4. The AS923 however allows for the following data rates:

      0 LoRa: SF12 / 125 kHz 250
      1 LoRa: SF11 / 125 kHz 440
      2 LoRa: SF10 / 125 kHz 980
      3 LoRa: SF9 / 125 kHz 1760
      4 LoRa: SF8 / 125 kHz 3125
      5 LoRa: SF7 / 125 kHz 5470
      6 LoRa: SF7 / 250 kHz 11000
      7 FSK: 50 kbps 50000

      Am I missing something?

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

        @kompleteb
        Our implementation pre-dates the first AS923 implementation so we don't have support for it yet - it assumes US915.

        Usually you can go around the issue by defining channels manually using add_channel and remove_channel, but for datarates to match you need to think:

        datarate on AS923 = LoPy datarate + 2

        So if you set datarate 0 it's actually AS923 datarate 2, up to datarate 3 which is 5 on AS923. It's not possible to use AS923 data rates 0 and 1.

        This is all changing as we're making progress on updating our LoRa stack implementation, taking in the missing regions and more. But for now it only works with you consider it relative to US915.

        1 Reply Last reply Reply Quote 0
        • K Offline
          kompleteb
          last edited by kompleteb

          So this should do it, acknowledging that no channel willever use AS923 data rate 0 or 1?

          for channel in range(0, 15):
          lora.remove_channel(channel)

          lora.add_channel(0, frequency=923200000, dr_min=0, dr_max=3)
          lora.add_channel(1, frequency=923400000, dr_min=0, dr_max=3)
          lora.add_channel(2, frequency=922200000, dr_min=0, dr_max=3)
          lora.add_channel(3, frequency=922400000, dr_min=0, dr_max=3)
          lora.add_channel(4, frequency=922600000, dr_min=0, dr_max=3)
          lora.add_channel(5, frequency=922800000, dr_min=0, dr_max=3)
          lora.add_channel(6, frequency=922000000, dr_min=0, dr_max=3)

          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