2020-02-14 04:11 PM
Hello everybody.
I am using B-L072Z-LRWAN1 to create a LoraWAN node class C. I am using the software STM32CubeExpansion_LRWAN_V1.3.1 . The compiler is Eclipse with the plugin SW4STM32. the version of eclipse is 4.14.0
the LoRaWAN region I am using is US915. the project I am testing is "End_Node"
I am able to get and receive data from the board. The
Since I know the channels I want to use (The channels configure in the Gateway), I want to limit the channels in the End_Node. In this case, allow the board to use only 6 through 23. In the file RegionsUS915.c, in the line 523, is the setting of the default mask. If I set these values:
NvmCtx.ChannelsDefaultMask[0] = 0x0000;
NvmCtx.ChannelsDefaultMask[1] = 0x00FF;
NvmCtx.ChannelsDefaultMask[2] = 0x0000;
NvmCtx.ChannelsDefaultMask[3] = 0x0000;
NvmCtx.ChannelsDefaultMask[4] = 0x00FF;
NvmCtx.ChannelsDefaultMask[5] = 0x0000;
I can seee the board only perform a join request in the desire range. But after the join, to send data, 90% of the time use channels between 8 and 15, wich one are not availables. actually, if I leave the original values (0xFFFF), 90% of the time use channles of the second group.
In the program I am printing the value of NvmCtx.ChannelsDefaultMask[0] , and after the Join, change from 0000 to 0xFF00. I have been checking the flow of the software, And I dont see where is the problem. is possible to achieve that goal? I mean, allow the board to use only channel 6 through 23?
Thanks for the help in this issue.
2020-02-25 09:13 PM
To change the default channel mask:
MibRequestConfirm_t mibReq;
uint16_t ChannelsMask[6] = { 0xffff, 0xffff, 0xffff, 0xffff, 0x00ff, 0x0000 };
mibReq.Type = MIB_CHANNELS_DEFAULT_MASK;
mibReq.Param.ChannelsMask = ChannelsMask;
LoRaMacMibSetRequestConfirm( &mibReq );
To change the current channel mask, alter the code to:
mibReq.Type = MIB_CHANNELS_MASK;
Once an OTAA JOIN has been completed, the network server sends the correct channel mask for the network to the device. Enabling channels outside of what the network has given you is a bad idea as packets sent on those channels will be ignored (no gateway listening).
So, you should do a LoRaMacMibGetRequestConfirm with MIB_CHANNELS_MASK to get the current channels and then turn off those you don't want to use.
I note in your question that you have all 8 of the 500kHz channels enabled. This is probably not what you want to do as a garden-variety gateway will listen on 8 x 125kHz channels and only one 500Khz channel that is in the same subband. As you have it, 7 of the 8 enabled 500Khz channels will probably go nowhere.
I only muck with the channels mask (a) during development, and (b) only prior to doing a JOIN, in order to speed up the JOIN process. Managing the channels after JOIN should properly be done through the LoRaWAN network server and the gateway config (which have to match up with each other).
For deployment, it is best to leave the mask alone as forcing a device to only JOIN on a particular subband means that you lose the ability to centrally manage the channel allocation: a firmware update is required to change subbands.