Skip to content

Abp Join can't switch to Class B, is it a bug?  #1625

@skyarm

Description

@skyarm

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 );
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions