Lora-net / LoRaMac-node

Reference implementation and documentation of a LoRa network node.
Other
1.88k stars 1.09k forks source link

Can't use a certain Channel Mask #535

Closed Gecko05 closed 6 years ago

Gecko05 commented 6 years ago

I'm currently using a Class A OTAA LoRaMac-node in a L152RE and having some issues with the node, the first one happens when I manually set the channel mask, in this case 0xFF00, 0x0000, 0x0000, 0x0000, 0x0000 in Region US915. When I use the mentioned mask the MCU appears to get a HardFault produced at the ComputeNext125kHzJoinChannel function, specifically when trying to get findAvailableChannelsIndex . Seems like the channel mask I'm trying to use wasn't contemplated to work with the current firmware, what should I do?

ConnyBusy commented 6 years ago

Hi Gecko05, from your channel mask you have disabled all channels (both 500kHz & 125KHz). I guess you intended to set the mask to 0x0000, 0x0000, 0x0000, 0x0000, 0x00FF which should enable only the first 8 125kHz channels

Gecko05 commented 6 years ago

@ConnyBusy Thanks, I'm not sure if that's the correct order for the channel mask, I tried using your suggestion but the problem appears again, also this snippet of code suggests that the first elements of the mask correspond to the 125kHz channels

if( linkAdrParams.ChMaskCtrl == 6 )
        {
            // Enable all 125 kHz channels
            channelsMask[0] = 0xFFFF;
            channelsMask[1] = 0xFFFF;
            channelsMask[2] = 0xFFFF;
            channelsMask[3] = 0xFFFF;
            // Apply chMask to channels 64 to 71
            channelsMask[4] = linkAdrParams.ChMask;
        }

It seems like I need to enable one 500 kHz channel corresponding to the 125kHz band I'm trying to use, which sets the mask to 0xFF00, 0x0000, 0x0000, 0x0000, 0x0002 , however setting the mask like the one ADR assigns doesn't seem to solve my problem. I used to manually set the mask in older versions of LoRaWan, maybe the new ones are designed to work exclusively under ADR? I might need to stick to ADR.

ConnyBusy commented 6 years ago

@Gecko05 Please note that the behavior for the join request have been changed from LoRaWAN version 1.0.3 onwards for the US915/AU915 regions. This might be causing the issue you are seeing.

image It makes difficult to use hybrid mode as with the previous specifications. A channel is selected from each block of eight channels i.e. Block 0, Block 1 etc..

Gecko05 commented 6 years ago

@ConnyBusy Thanks for the information, I checked up the specification yesterday but failed to notice this, now I think I get why it randomly fails during the Join when I'm using a specific channel mask.