Things Network Frame Counter
/I'm getting the hang of Lora networks. And by that I mean "Spending quite a lot of time figuring out why things don't work when they really should".
Today I found out about Frame Counter Checks. Each Lora packet contains a frame counter value. This is set by the node when the packet is sent into the network. The Things Network likes it if the frame counters in packets always get bigger. This makes it slightly more difficult for someone to spoof messages into the network.
Trouble is, if you're using a very simple node you'll find that the frame counter is reset to zero by the software each time you start the device. Which means that The Things Network will reject packets from the device until it seems a frame counter bigger than the one it's seen so far.
Unless you know this, you'll spend ages trying to figure out why something that worked yesterday has suddenly failed.
There's an option for the device settings for your application in the Things Network which turns off Frame Counter checks, which you can see above.
In a proper application you'd either save the frame counter in eeprom each time you've used it, or do something clever with the date and time to generate a frame counter value which is always bigger than the last one.