To my understanding, the end device keeps track of FCntup and FCntdown values while the network server only keeps track of the FCntup value in order to generate a new FCntdown (please correct me if I am wrong). When retrieving end device uplink messages at the network server I am getting a FCnt decimal value (i.e. 4587). Does the FCnt value from the uplink message refer to the FCntup? If not, how would I obtain the FCntup value from the FCnt value.
while the network server only keeps track of the FCntup value in order to generate a new FCntdown (please correct me if I am wrong)
Also the network-server keeps track of both counters as both counters are fully independent (you can’t derive one from an other).
LoRa Server provides an API to retrieve the frame-counter to use for the next downlink frame (used by an application-server to schedule the next downlink payload):
https://github.com/brocaar/loraserver/blob/master/api/ns/ns.proto#L80
To get the current frame-counters, please see this API method:
https://github.com/brocaar/loraserver/blob/master/api/ns/ns.proto#L68
Note for LoRaWAN 1.1 there are three frame-counters:
- FCntUp - used by the device for every uplink
- NFCntDown - used by the network-server for downlink frames using fPort = 0
- AFCntDown - used by the application-server for downlink frames using fPort != 0