2025-07-29 1:37 AM - edited 2025-07-29 2:23 AM
We have developed an IoT sensor using the STM32WLE5JC LoRa module. It is a device we expect to reboot a few times (when necessary). It was discovered that when a downlink command (to reboot the device) is sent, the device reboot, but then it hangs during the join process.
After much debugging, it looks like NVM context data is corrupted. Then I disabled context management by setting the flag CONTEXT_MANAGEMENT_ENABLED to 0. . After this, the device consistently joins after a reboot. We can also see that keys are cleared and the join process is fresh each time.
Additional context: According to lorawan_conf.h, where CONTEXT_MANAGEMENT_ENABLED is defined, the comments state that "context management must be enabled for LoRaWAN 1.0.4 or later ". We ar currently on LoRaWAN version 1.0.3 and don't expect that to change for the foreseeable future.
Question - Are there any critical concerns or downsides to disabling context management?
2025-09-10 7:41 AM
Hello @helixembedded
Context management allows storing the network context in SRAM with retention, enabling the device to resume operations without a full network join process. So, will context management be disabled, the device must rejoin the LoRaWAN network upon waking up.
For the comment indicating that context management must be enabled for LoRaWAN 1.0.4 or later, according to the LoraWAN v1.0.4 spec:
"DevNonce is a counter starting at 0 when the end-device is initially powered up and incremented with every Join-Request. A DevNonce value SHALL never be reused for a given JoinEUI value. If the end-device can be power-cycled, then DevNonce SHALL be persistent (e.g., stored in a non-volatile memory). Resetting DevNonce without changing JoinEUI will cause the Join Server to discard the Join-Requests of the end-device. For each end-device, the Join Server keeps track of the last DevNonce value used by the end-device and ignores Join-Requests if DevNonce is not incremented."
So, a proper v1.0.4 implementation would be for an end-node to increment this 2-byte value on each JoinRequest frame.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.