Skip to content
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

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

Open
skyarm opened this issue Nov 29, 2024 · 0 comments
Open

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

skyarm opened this issue Nov 29, 2024 · 0 comments

Comments

@skyarm
Copy link

skyarm commented Nov 29, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant