For the US, which uses 64 channels while gateways might only use 8 (or one, for a single-channel gateway), the following from April 2016 might be relevant:
Huh, turns out the lmic.cpp LMIC_disableChannel(u1_t channel) for CFG_us915 I got from LoRa-Thing/libraries/lmic-v1.5 at master · things4u/LoRa-Thing · GitHub is broken - for
struct lmic_t {
#elif defined(CFG_us915)
u2_t channelMap[(72+MAX_XCHANNELS+15)/16]; // enabled bits
that should be an array of 5 16 bit values (80 bits, to cover 74 total channels), which when initialized is:
LMIC.channelMap[0] = 0xFFFF 16
LMIC.channelMap[1] = 0xFFFF 32
LMIC.channelMap[2] = 0xFFFF 48
LMIC.channelMap[3] = 0xFFFF 64
LMIC.channelMap[4] = 0x00FF 72 bits
However, LMIC_disableChannel() for CFG_us915 is modulo 4???
LMIC.channelMap[channel/4] &= ~(1<<(channel&0xF));
should be 16. As it is, when you disable channel 4, you actually get 20!
4: channelMap[0]: ffff
channelMap[1]: ffef 1110 1111 wtf??
LMIC_disableChannel(8) turns off the bit for 40, etc. Changed it to:
LMIC.channelMap[channel/16] &= ~(1<<(channel&0xF));
And:
I’ve not validated, but someone might want to create a pull request if this bug is currently still in the code
3 Likes