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

    LoraWAN frames counter does not work after deepsleep if socket is set to non-blocking

    Scheduled Pinned Locked Moved Issues & Bugs
    bugslopy nvramlora socketdeepsleeplopy4
    2 Posts 2 Posters 582 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.
    • T Offline
      Tom
      last edited by

      My code on the lopy4 basically does the following after wake-up:

      1. check wake up reason
      2. restore lora from nvram (or rejoin if wake up reason is power on wakeup)
      3. create socket (nonblocking)
      4. make measurement
      5. send data to TTN
      6. store lora configuration in nvram
      7. receive downlink (if there is one)
      8. deepsleep

      If the socket is set to non-blocking the counter does not work (stays 0) if I change this option to blocking the counter works again. Is there any reason for this behaviour?

      I want the socket to be non-blocking because of the downlink message which is send sometimes.

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

        @tom You should probably instead do the following

        • set socket to blocking
        • send
        • set socket to non-blocking
        • receive
        • save config

        Otherwise you actually try to receive, save, and deep sleep before the packet has actually been (completely) sent.

        An alternative is to add a manual sleep, but remember that the time between send and receive is variable (the network can change the RxDelay).

        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