-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Nvm CTX to restore session between power cycles #678
Comments
Hi @BenAtPip, We don't know which modifications have been done in the stm32cube-lrwan by ST or by you ("using firmware heavily based ..."). This makes it very hard to help you. To have better support on this we would recommend that you contact the ST support. That said, making an end-device operate as you described should be possible using the NvmCtxMgmt.c/h module. Currently, we are validating that this module works as expected and so far it looks to be working well. |
One question springs to mind - how long are the devices expected to last, seeing that FLASH ls usually limited to 10000 writes ? With one uplink every 1 minutes for example, that would be one week (10 weeks if using EEPROM). Is the NvmCtxMgmt module doing wear leveling or something the like ? |
NvmCtxMgmt is not doing wear leveling. As such you are right the MCU FLASH memory can become unusable. Our recommendation would be to use an external NVM memory that supports a higher level of write cycles. Another thing that could be done is to not save to the flash every time the MAC layer notifies to do so but, maybe every few up links or few minutes. |
I am using an external memory source - an active microcontroller in my application. So NVM wear is not an issue in this instance. As for the modifications - this is simply loading and unloading of NVM context via UART using modified AT commands to obtain and restore the context. I use the following function to load context from the loaded memory
I also invoke LoRaMacStart(); following this to ensure the radio is not in stop mode. Looking at the ST project it appears not to be upto date with the NvmCtxMgmt module, but I can use that as a jumping point |
Found the root issue here: The issue I was experiencing was due to the fact that the network I was connecting to was operating on Ver 1.1. The network join procedure indicates to the device which version of the standard to use. In LoRaMaxCrypto module this information is not stored in the LoRaMaxCryptoNvmCtx_t type, but rather in the LoRaMaxCryptoCtx_t. As a result the MIC for frames sent by the device when the context was restored were incorrect, as they were being transmitted with the 1.0 MIC calculation method on the 1.1 network. I propose the fix for this is to simply move the LrWanVersion field into the LoRaMaxCryptoNvmCtx_t type and change all references to this to reflect the change. I've been able to retain join sessions as a result of this change: Changed type definition /*
/*
` And refactor all references to version within the module from
|
Hi BenAtPip, thanks for the change request. I think your proposition is valid. We will provide a fix here. |
…tx_t` to non volatile `LoRaMacCryptoNvmCtx_t`.
Hi all,
Does anyone have experience power cycling their LoRaMac-node device and restoring the context in order to retain a join? The hope is to use a LoRa module as a stand alone radio for a main microprocessor. In order to reduce sleep current I want to be able to completely cut power from the LoRa radio module
I can successfully restore context without power cycling my end device (i.e I can see a repeated frame with a restored NvmCtx structure) but following a soft reset the restoration fails, and no frame is seen by the back end. Is there another process which is required to be carried out for the device to resume it's session?
I am using firmware heavily based off of the STM cube LRWAN release (1.2.1). Any insight would be appreciated
The text was updated successfully, but these errors were encountered: