-
I'm trying out activation by personalization but the first thing the LoRa stack does is reset the frame counter by calling this function: ResetFCnts |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
At stack initialization everything is reset to defaults and this is normal. After the stack initialization one must restore the previous context from a non volatile memory. LmHandlerErrorStatus_t LmHandlerInit( LmHandlerCallbacks_t *handlerCallbacks,
LmHandlerParams_t *handlerParams )
{
//
uint16_t nbNvmData = 0;
MibRequestConfirm_t mibReq;
LmHandlerParams = handlerParams;
LmHandlerCallbacks = handlerCallbacks;
LoRaMacPrimitives.MacMcpsConfirm = McpsConfirm;
LoRaMacPrimitives.MacMcpsIndication = McpsIndication;
LoRaMacPrimitives.MacMlmeConfirm = MlmeConfirm;
LoRaMacPrimitives.MacMlmeIndication = MlmeIndication;
LoRaMacCallbacks.GetBatteryLevel = LmHandlerCallbacks->GetBatteryLevel;
LoRaMacCallbacks.GetTemperatureLevel = LmHandlerCallbacks->GetTemperature;
LoRaMacCallbacks.NvmDataChange = NvmDataMgmtEvent;
LoRaMacCallbacks.MacProcessNotify = LmHandlerCallbacks->OnMacProcess;
IsClassBSwitchPending = false;
IsUplinkTxPending = false;
if( LoRaMacInitialization( &LoRaMacPrimitives, &LoRaMacCallbacks, LmHandlerParams->Region ) != LORAMAC_STATUS_OK )
{
return LORAMAC_HANDLER_ERROR;
}
// Restore data if required
nbNvmData = NvmDataMgmtRestore( );
// Try to restore from NVM and query the mac if possible.
if( nbNvmData > 0 )
{
LmHandlerCallbacks->OnNvmDataChange( LORAMAC_HANDLER_NVM_RESTORE, nbNvmData );
}
else
{
...
} In the future it would be nice if you could post this kind of questions on the project Discussions tab. It is a better place to engage discussions and then we can agree if it is an issue or not. |
Beta Was this translation helpful? Give feedback.
At stack initialization everything is reset to defaults and this is normal.
After the stack initialization one must restore the previous context from a non volatile memory.
As you can see in below code excerpt the stack is initialized by calling
LoRaMacInitialization
and then the NVM context is restored by callingNvmDataMgmtRestore
.It is to be noted that in case the restore function didn't succeed then the stack behaves like if it was the first time it was run.