How to Restore frame count after reset Lorawan context?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-04-12 1:31 AM
I have developed a device that joins lorawan in OTAA mode. I am testing the device and i am having some problems with conectivity.
Device joined succesfully to Lorawan Network Server, i saved the NVM Lorawan context and i reset the device, after reset NVM Lorawan context is restored, but when i send a uplink message it is ignored by Network Server because the Device frame count is less than Network server frame count.
My question is is there a way to save frame count in ROM memory and restore it in the LmHandler?
Thanks in advance
- Labels:
-
Flash
-
LoRa
-
STM32WL series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-04-17 2:24 AM
I have found response to my own answer, Frame counter was included in NVM Lorawan context. The problem was that it was not saved properly, I included a function to save it every time that the device send an uplink.
LoRaMacNvmData_t Struct contains several structs with lora data, in LoRaMacCryptoNvmData_t struct have:
LrWanVersion, DevNonce, JoinNonce, FCntList, LastDownFCnt, Crc32.
FCntList contains
- FCntUp: Uplink frame counter which is incremented with each uplink
- NFCntDown: Network downlink frame counter which is incremented with each downlink on FPort 0
- AFCntDown: Application downlink frame counter which is incremented with each downlink
- FCntDown: In case if the device is connected to a LoRaWAN 1.0 Server this counter is used for every kind of downlink frame. (old usage)
- McFCntDown: Multicast downlink counters
- RJcount1: RJcount1 is a counter incremented with every Rejoin request
