LoRaWAN context management issue
I run a LoRaWAN End Node application on the custom board based on STM32WLCCU6 MCU. Application has enabled contex management to store LoRaWAN data and be able to resume communication after power loss without rejoining to the network. NVM memory is updated every uplink. It generally works well but sometimes (usually after reset) it doesn't manage to restore data. My first idea was that issue is caused by cutting off the power while device is manging the flash so I created another backup flash region to restore data from there in case of an issue. Apparently it was not it. Data is acctually stored in flash but restoring data process fails because CRC32 values don't match and RestoreNvmData function returns LORAMAC_STATUS_NVM_DATA_INCONSISTENT (screenshot below).
Has anybody faced similar problem? How to overcome it and what can I do to make context management more secure and stable?
