-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
My device work perfectly with Class A and class B mode when it join with OTTA, But it can not switched to Class B when it joined with ABP, I had to debug my code, found the bug in LoRaMac-node.
function LoRaMacInitialization in LoRaMac.c. here is the code:
ResetMacParameters( false );
Nvm.MacGroup2.PublicNetwork = true;
MacCtx.MacPrimitives = primitives;
MacCtx.MacCallbacks = callbacks;
MacCtx.MacFlags.Value = 0;
when call ResetMacParameters, the MacCtx..MacCallbacks not initial, so it's NULL, thus ResetMacParameters do not initial class b's callbacks, like this:
if( MacCtx.MacCallbacks != NULL )
{
classBCallbacks.GetTemperatureLevel = MacCtx.MacCallbacks->GetTemperatureLevel;
classBCallbacks.MacProcessNotify = MacCtx.MacCallbacks->MacProcessNotify;
}
The ResetMacParameters function is called again when join with OTTA node, so classBCallbacks is initialed and work perfectly. so I had to change the code to thus:
...
MacCtx.MacCallbacks = callbacks;
ResetMacParameters( false );
...