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

    Sigfox RC4 Freezing after 1 msg

    Scheduled Pinned Locked Moved FiPy
    fipysigfoxsend datafreeze
    5 Posts 2 Posters 1.1k 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.
    • G Offline
      gsimenel
      last edited by

      Hi Forum !

      I encounter a problem when I try to send multiple Sigfox messages from my FiPy card on Sigfox network. After the first msg sent (and received) I must disconnect the kit to get it working again.

      The code is :

      from network import Sigfox
      import socket
      import binascii
      
      # init Sigfox for RCZ4
      sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ4)
      
      # create a Sigfox socket
      s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
      
      # make the socket blocking
      s.setblocking(True)
      s.settimeout(5.0)
      
      # configure it as uplink only
      s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False)
      
      #Print sigfox ID
      print(binascii.hexlify(sigfox.id()))
      
      for i in range(1,20):
          # send some bytes
          s.send(bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]))
          print("Message {} sent".format(i))
      

      When I change Sigfox.RCZ4 to Sigfox.RCZ1 it works perfectly...

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

        Thanks for reporting this @gsimenel, I'll look into it today.

        G 1 Reply Last reply Reply Quote 0
        • G Offline
          gsimenel @jmarcelino
          last edited by

          @jmarcelino Thanks a lot. Let me know if I can do anything to assist.

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

            Hi @gsimenel

            I found the problem in our code, it's related to how the socket layer reacts to the enforced wait time for Sigfox resets (necessary for RCZ2 and RCZ4).

            As the docs page explains for compliance reasons we must wait 20 seconds between consecutive sends. This wait should be handled automatically but that is causing some problems.

            For now the easiest solution is to add more time between your sends in your code - at least 20 seconds - for example simply adding a time.sleep(20) like this:

            from network import Sigfox
            import socket
            import binascii
            import time
            
            # init Sigfox for RCZ4
            sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ4)
            
            # create a Sigfox socket
            s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
            
            # make the socket blocking
            s.setblocking(True)
            s.settimeout(30)
            
            # configure it as uplink only
            s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False)
            
            #Print sigfox ID
            print(binascii.hexlify(sigfox.id()))
            
            for i in range(1,20):
                # send some bytes
                s.send(bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]))
                print("Message {} sent".format(i))
                time.sleep(20)
            

            Please remember that Sigfox has a 140 message/day limit so spacing out your sends is always a good policy.

            G 1 Reply Last reply Reply Quote 0
            • G Offline
              gsimenel @jmarcelino
              last edited by

              @jmarcelino said in Sigfox RC4 Freezing after 1 msg:

              time.sleep(20)

              Works like a charm. Thanks a lot.

              The documentation is a bit misguiding here, it says :

              "there must a minimum of a 20s delay after resetting to the default macro-channel. Our API takes care of this

              for i in range(1, 100):
                # send something
                s.send('Hello ' + str(i))
              

              There will be a 20 second delay after every 2 packets"

              In fact, there should be a delay added between 2 packets. Maybe a suggestion for modification of the doc.

              Anyway, thanks a lot for correcting me !
              All the best.

              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