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

    How do I know whether a LoRa packet was successfoully sent?

    Scheduled Pinned Locked Moved LoPy
    lorapacket acklora socketerror handlingsocket.timeout
    5 Posts 3 Posters 1.3k Views 3 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.
    • S Offline
      sriboli
      last edited by

      Hi all!

      I'm working on a project based on a LoPy module.
      I'm able to join a network and send data trought a gateway (ABP authentication) without any problem.

      But if I try to send data without any gateway near my device, socket.send always return ok, even if
      the packet didn't reach any gateway.

      # init Lora, join, create socket, ecc above here
      
      while (True):
      
          pycom.rgbled(0x007f00)
          time.sleep(1)
          pycom.rgbled(0x000000)
      
          try:
      
              # send some data
              s.send(bytes([0x01, 0x02, 0x03]))
      
              print("Send ok")
      
              pycom.rgbled(0x00007f)
      
          except socket.timeout:
              # even without any active gateway, I never get any timeout. Why?
              print("Timeout send socket")
              pycom.rgbled(0x7f0000)
      
          except socket.error:
              # even without any active gateway, I never get any error. Why?
              print("Error send socket")
              pycom.rgbled(0x7f0000)
      
          time.sleep(1)
      

      How do I know if the packet was correctly sent to the LoRa network?
      Is there any way to know this? Or maybe LoRa doesn't provide any ack information
      about sent packets?

      Thanks.

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron @sriboli
        last edited by

        @sriboli For unconfirmed frames, you have no idea if it got to the destination.

        For confirmed frames, the device will wait for an ACK, and will eventually retry several times.

        Note however that the ACK from the gateway to the devices will be counted in the duty cycle limitations for the gateway, so depending on your number of devices and traffic, you could very quickly reach the allowed limits. That's the reason most frames are sent unconfirmed. Depending on your region, the frequencies used, number of devices, traffic patterns, this may or may not be an issue for you.

        bmarkusB 1 Reply Last reply Reply Quote 0
        • S Offline
          sriboli
          last edited by

          Thankyou jcaron!
          I found this:

          https://forum.pycom.io/topic/2375/how-to-send-confirmed-data-pycom

          It should be the right way!

          Regards.

          1 Reply Last reply Reply Quote 0
          • bmarkusB Offline
            bmarkus @jcaron
            last edited by

            @jcaron said in How do I know whether a LoRa packet was successfoully sent?:

            @sriboli For unconfirmed frames, you have no idea if it got to the destination.

            For confirmed frames, the device will wait for an ACK, and will eventually retry several times.

            Note however that the ACK from the gateway to the devices will be counted in the duty cycle limitations for the gateway, so depending on your number of devices and traffic, you could very quickly reach the allowed limits. That's the reason most frames are sent unconfirmed. Depending on your region, the frequencies used, number of devices, traffic patterns, this may or may not be an issue for you.

            Well, generating heavy downlink traffic with ACK's is mainly not an issue for you bur for others.

            J 1 Reply Last reply Reply Quote 0
            • J Offline
              jcaron @bmarkus
              last edited by

              @bmarkus If you exceed duty cycle limitations in your region, it's mainly illegal...

              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