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

    LoPy To MultiTech Conduit

    Scheduled Pinned Locked Moved LoPy
    25 Posts 6 Posters 10.7k Views 6 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.
    • L Offline
      livius
      last edited by

      https://github.com/pycom/pycom-micropython/pulls

      think about people first, then computers

      1 Reply Last reply Reply Quote 0
      • D Offline
        dchappel @johncaipa
        last edited by dchappel

        @johncaipa

        Until the firmware is updated, here is the workaround I came up with. Since the current firmware insists on using all the channels, this distributes the the desired sub-band frequencies among them all.

        It's not pretty, but it works!

        from network import LoRa
        import socket
        import time
        import binascii
        import utime
        
        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)
            
            index = (subband-1)*8
            for channel in range(0, 7):
                lora.add_channel(channel, frequency=902300000+index*200000, dr_min=0, dr_max=3)
                index+=1
                
            index = (subband-1)*8
            for channel in range(8, 15):
                lora.add_channel(channel, frequency=902300000+index*200000, dr_min=0, dr_max=3)
                index+=1
        
            index = (subband-1)*8
            for channel in range(16, 23):
                lora.add_channel(channel, frequency=902300000+index*200000, dr_min=0, dr_max=3)
                index+=1
                
            index = (subband-1)*8
            for channel in range(24, 31):
                lora.add_channel(channel, frequency=902300000+index*200000, dr_min=0, dr_max=3)
                index+=1
                
            index = (subband-1)*8
            for channel in range(32, 39):
                lora.add_channel(channel, frequency=902300000+index*200000, dr_min=0, dr_max=3)
                index+=1
        
            index = (subband-1)*8
            for channel in range(40, 47):
                lora.add_channel(channel, frequency=902300000+index*200000, dr_min=0, dr_max=3)
                index+=1
                
            index = (subband-1)*8
            for channel in range(48, 55):
                lora.add_channel(channel, frequency=902300000+index*200000, dr_min=0, dr_max=3)
                index+=1
                
            index = (subband-1)*8
            for channel in range(56, 63):
                lora.add_channel(channel, frequency=902300000+index*200000, dr_min=0, dr_max=3)
                index+=1
                
            index = (subband-1)*8
            for channel in range(64, 71):
                lora.add_channel(channel, frequency=902300000+index*200000, dr_min=0, dr_max=3)
                index+=1
        
        lora = LoRa(mode=LoRa.LORAWAN, adr=False, public=True, tx_retries=0)
        
        sb = 2 #Change to desired conduit frequency sub-band
        
        select_subband(lora,sb) 
        
        app_eui = binascii.unhexlify('00 00 00 00 00 00 00 00'.replace(' ',''))
        app_key = binascii.unhexlify('00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'.replace(' ',''))
        
        lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0) 
        
        while not lora.has_joined():
            time.sleep(5)
            print('Not yet joined on frequency sub-band '+str(sb)+'...')
            
        if(lora.has_joined()):print("Successful join on frequency sub-band "+str(sb)+"!")
        
        s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
        s.setblocking(False)
        s.setsockopt(socket.SOL_LORA, socket.SO_DR, 3)
        
        pressure = 1    
        
        while lora.has_joined():
            payload = '{"pressure":'+str(pressure)+',"tst":'+str(utime.time())+'}'
            print(payload)
            s.send(payload)
            time.sleep(6)
        
            pressure +=1
        
            if pressure > 100:
                pressure = 1
        
        J 1 Reply Last reply Reply Quote 0
        • J Offline
          johncaipa @dchappel
          last edited by

          @dchappel do you know if the error was already corrected in the new firmware (1.5.0.b2)?

          1 Reply Last reply Reply Quote 0
          • D Offline
            dchappel
            last edited by

            I don't know if this got fixed. Haven't gone back and checked.

            I 1 Reply Last reply Reply Quote 0
            • I Offline
              iannucci @dchappel
              last edited by

              @dchappel I built my own version of the firmware with this fix in it. But as this is the first time I've built ESP32 / LoPy firmware, I am having a small problem. The make process seems to work properly, and the flashing process seems to work. But when I remove the jumper wire and reboot the LoPy, it runs a different version of firmware, not the one I just flashed.

              I've tried the safe boot tricks to no avail.

              Any ideas how to get the LoPy to come up running the version of firmware just uploaded via make?

              I 1 Reply Last reply Reply Quote 0
              • I Offline
                iannucci @iannucci
                last edited by

                @iannucci Just re-tried this and was able to compile, flash and boot. Initial test indicates the issue is resolved, but I will do some additional testing.

                I 1 Reply Last reply Reply Quote 0
                • I Offline
                  iannucci @iannucci
                  last edited by

                  @iannucci Sadly, the fix does not work for me. Benefit: does not seem to hang. Downside: the first seven packets get through (according to the Loriot dashboard). After that, nothing.

                  C 1 Reply Last reply Reply Quote 0
                  • C Offline
                    cmsedore @iannucci
                    last edited by

                    @iannucci I just was back in the office today and ran some tests--I couldn't create a scenario where it did not work as expected (all packets went through). Do you have source you could share? Does it behave better if you reconfigure all the channels as @dchappel suggested? (the code is in the post below)

                    I 1 Reply Last reply Reply Quote 0
                    • I Offline
                      iannucci @cmsedore
                      last edited by

                      @cmsedore I just ran a test with @dchappel's code -- 4000+ messages and counting, no drops. Good news!

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        daniel
                        last edited by

                        @cmsedore Sorry for the delay in merging your code. I'm testing it now and everything looks solid. This will be on the next release. Thanks for your contribution!

                        Cheers,
                        Daniel

                        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
                        • 2
                        • 2 / 2
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom