LoraWAN frames counter does not work after deepsleep if socket is set to non-blocking
-
My code on the lopy4 basically does the following after wake-up:
- check wake up reason
- restore lora from nvram (or rejoin if wake up reason is power on wakeup)
- create socket (nonblocking)
- make measurement
- send data to TTN
- store lora configuration in nvram
- receive downlink (if there is one)
- 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.
-
@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).
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