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

LmHandlerInit causing some current leakage till the first tx #1594

Open
AD-NCD opened this issue Jan 9, 2024 · 3 comments
Open

LmHandlerInit causing some current leakage till the first tx #1594

AD-NCD opened this issue Jan 9, 2024 · 3 comments

Comments

@AD-NCD
Copy link

AD-NCD commented Jan 9, 2024

Hello,
i was making power profiling and i found there is always a leakage before first Transmission "doesn't matter it's a join or anything else".
After first transmission everything turns to be fine. I am using LmHandlerInit to init mac, i found that after setting public network param leakage occurs which seems to be writing on radio and radio doesn't go to sleep after it when i removed this part issue solved.
.
Here's the code line 328:

mibReq.Type = MIB_PUBLIC_NETWORK;
mibReq.Param.EnablePublicNetwork = LmHandlerParams->PublicNetworkEnable;
LoRaMacMibSetRequestConfirm(&mibReq);

I think the solution is to sleep radio at the end of LmHandlerInit.
2 images attached for the power profiling. Power seems to be higher than usual because i am having some extra hw connected

lorawan after first tx
Lorawan before first tx

@AD-NCD
Copy link
Author

AD-NCD commented Jan 10, 2024

After tracing. In loramac.c file line 4686:
case MIB_PUBLIC_NETWORK:
{
Nvm.MacGroup2.PublicNetwork = mibSet->Param.EnablePublicNetwork;
Radio.SetPublicNetwork( Nvm.MacGroup2.PublicNetwork );
break;
}
setting this command in radio wakes it up so we should be sleeping radio after this
Same on Restoring NVM line 3512:
// The public/private network flag may change upon reloading MacGroup2
// from NVM and we thus need to synchronize the radio. The same function
// is invoked in LoRaMacInitialization.
Radio.SetPublicNetwork( Nvm.MacGroup2.PublicNetwork );
If i added Radio.sleep()
Everything works fine

@lff5
Copy link

lff5 commented Jun 13, 2024

I have the same issue with Restoring from NVM. Radio.sleep() must be called afterwards.

@AD-NCD
Copy link
Author

AD-NCD commented Jul 8, 2024

Still not solved!

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

2 participants