Knowledge Base
HOME » KNOWLEDGE BASE » FORUM

LoRaWAN stack CalcBackOff problems

Hi,

I am implementing the latest LoRaWAN endnode from github: LoRaMac-node-4.4.3

The MAC is failing to transmit and looking at the code the following routine does not make sense to me.

RegionEU868.c

void RegionEU868CalcBackOff( CalcBackOffParams_t* calcBackOff )
{
RegionCommonCalcBackOffParams_t calcBackOffParams;

calcBackOffParams.Channels = NvmCtx.Channels;
calcBackOffParams.Bands = NvmCtx.Bands;
calcBackOffParams.LastTxIsJoinRequest = calcBackOff->LastTxIsJoinRequest;
calcBackOffParams.Joined = calcBackOff->Joined;
calcBackOffParams.DutyCycleEnabled = calcBackOff->DutyCycleEnabled;
calcBackOffParams.Channel = calcBackOff->Channel;
calcBackOffParams.ElapsedTime = calcBackOff->ElapsedTime;
calcBackOffParams.TxTimeOnAir = calcBackOff->TxTimeOnAir;

RegionCommonCalcBackOff( &calcBackOffParams; );
}


The structure calcBackOffParams is a local copy which is thrown away when this routine returns. So the Timeoff period calculated by RegionCommonCalcBackOff() for the Bands is never updated.

Anyone any ideas?

Thanks,

MPC.
Solved.

I realised the local structure has a pointer to the top level band structure.

Thanks.