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 LoRaWAN OTAA join freezing after subband selection

    Scheduled Pinned Locked Moved Firmware
    lorafipybug
    9 Posts 4 Posters 1.8k Views 5 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.
    • N Offline
      nemik
      last edited by

      Hello everyone,

      So first off here is my example code: https://gist.github.com/nemik/c8be84ef2fa8c3f89c4a2a49f2643d8d

      When I run my firmware and don't use a sub-band selection, I can eventually join my MultiTech Conduit gateway but it takes a long time and doesn't always work. Then when it does, I only get maybe 1 in 20 packets.

      So I figured the problem is that the LoRa part of PyCom is transmitting on all channels and not a sub-band like the Conduit is listening on. So I added that selection function that's found in many forum posts but after I do it, the firmware freezes up when doing an activation join.

      I never get to line 47 after the join.

      Is anyone else running into this or am I doing something wrong? With how many gateways and systems use sub-bands, I'm surprised it's not part of the PyCom LoRa library.

      Thank you for any suggestions.

      J 2 Replies Last reply Reply Quote 0
      • J Offline
        jmarcelino @nemik
        last edited by jmarcelino

        This post is deleted!
        robert-hhR 1 Reply Last reply Reply Quote 0
        • robert-hhR Offline
          robert-hh @jmarcelino
          last edited by

          @jmarcelino said in FiPy LoRaWAN OTAA join freezing after subband selection:

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

          Please? (just changing 72 to 64)

          What?

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jmarcelino @robert-hh
            last edited by jmarcelino

            @robert-hh
            Thanks Robert didn't know what I was thinking :) It wasn't a viable solution.
            I'll check in this properly later today.

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

              Hi @nemik

              We found the problem, it was a bug in adding channels which is fixed in this patch, this will come included on the next firmware release: https://github.com/pycom/pycom-micropython-sigfox/commit/ae3a294c40026433dbdac3e08da788b2b4c4dfdb

              I also recommend that you add the missing DR4 channel so your subchannel selection code should be (extra line of code at the end):

              Thank you for your report and sorry for the inconvenience caused.

              def select_subband(lora, subband):
                if (type(subband) is int):
                  if ((subband<1) or (subband>8)):
                    raise ValueError("subband out of range (1-8)")
                else:
                  raise TypeError("subband must be 1-8")
              
                for channel in range(0, 72):
                  lora.remove_channel(channel)
              
                for channel in range((subband-1)*8, ((subband-1)*8)+8):
                  lora.add_channel(channel, frequency=902300000+channel*200000, dr_min=0, dr_max=3)
              
                lora.add_channel(63+subband, frequency=903000000+((subband-1)*1600000), dr_min=4, dr_max=4)
              
              robert-hhR B 2 Replies Last reply Reply Quote 1
              • robert-hhR Offline
                robert-hh @jmarcelino
                last edited by

                @jmarcelino In your example, last line, sb seems not to be defined.

                J 1 Reply Last reply Reply Quote 1
                • J Offline
                  jmarcelino @robert-hh
                  last edited by

                  @robert-hh
                  Thanks, should have been subband to match the rest of the code

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

                    Hi @jmarcelino

                    Thanks for this fix -- I've just been looking at the code in this area because of a problem that I've had with the new 'region-aware' firmware not working when I've removed the channels and added them back for AU915. Basically the code will 'freeze' after the send. The changes in the commit you mentioned showed me the reason why!

                    But, from the code in the commit that you mentioned, I don't think that the last channel that you added - 63+subband, will be added. The code in the commit will rule out any channel where the dr_min is not 0.

                    I'm thinking that the freezing that I have been seeing is from LoRaMac.c::ScheduleTx() which has a while loop looking for a valid channel supporting the requested data rate. With no valid channels because of the bug fixed in your commit, ScheduleTx() will never terminate. With your commit, the channels should be added correctly again. Though I will have to make sure that channel 65 for me, has dr_min=0, instead of dr_min=4, because of the requirement for dr_min=0.

                    Looking forward to the next release!

                    Thanks,
                    Brian

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

                      I have raised a ticket for the issue of allowing dr_min > 0 for channels 64-71, tested the fix and added a pull request.
                      Hope that it helps (it is working for me!).

                      Regards,
                      Brian

                      1 Reply Last reply Reply Quote 1

                      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