-
Notifications
You must be signed in to change notification settings - Fork 212
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
LoRa STD (SF7BW250) channel frequency incorrect #343
Comments
Thanks for this report @jpmeijers . This is interesting, because according to the regional parameters in LoRaWAN Regional Parameters 1.0.3, section 2.3, the only standard channels are 0, 1, and 2, at 868.10, 868.30 and 868.50. and all three are 125 kHz. So we can probably conclude that TTN has sent additional channel parameter configuration information in the JoinAccept, including whatever value we're using for channel 3. I'll come back with suggested debug prints to show the channel map. I think there might be an additional bug in the handling of 250 kHz channels -- I don't yet see how the code takes into account the wider channel width (250 kHz uses, essentially, two adjacent 125 kHz channels). Note to future readers: One confusing thing about the LMIC is that the use of DRs doesn't quite match the LoRaWAN terminology as adopted. The DR for 250 kHz in the spec is DR6; DR7 is FSK. However, I'm continuing to research, will update this comment as I get more facts. |
Just a note from my side after some more experimentation. If you force the FSK datarate, there is firstly an assertion error, but ignoring that assert one gets the following:
As can be seen here the FSK channel is also on 867.1MHz rather than the 868.8MHz. But as has been stated in the main readme there is a couple of issues with FSK that needs to be looked at at some point. |
According to section 2.2.4 of the regional spec, the JoinAccept CFList doesn't provide any channels that are safe for 250 kHz comms. Starting at line 356:
From this, I conclude that 250 kHz operation is already somewhat operator specific. It seems that it can be enabled via a LinkAdr request, more in next note. |
LinkAdr requests for enabling 250 kHz are defined in two places. See section 5.2 of LoRaWAN 1.0.3 for the first part, and 2.2.5 of the regional spec for the second part. To enable DR6 (== EU868_DR_7B), the network must prepare a LinkAdr request with the following contents:
The core spec says that the channel mask can "be used to globally turn on or off all channels using specific modulation" (line 694). But that's region specific, and the EU868 doesn't indicate that this is supported. |
For debugging, we need to see what's in the channel map. For that, the following code should be added in a convenient place. I'll use Arduino prints, but of course this is easier to do if there's a printf handy. Serial.print("Channel enable mask: 0x"); Serial.println(LMIC.channelMap, HEX);
for (unsigned i = 0; i < MAX_CHANNELS; ++i) {
Serial.print("Ch "); Serial.print(i);
Serial.print(": Freq="); Serial.print(LMIC.channelFreq[i]);
Serial.print(" DrMap=0x"); Serial.println(LMIC.channelDrMap[i], HEX);
} This should be printed after join, and after each time you call |
Looking at the code, the only way to enable a channel for 250 kHz or FSK is to enable it as part of device initialization. The LMIC never updates So there's a bug in how 250kHz and FSK are handled; if you select 250 kHz or FSK, but you have no channel enabled, the LMIC will blindly transmit on the previously-selected channel. This is true for all EU-related bandplans. @jpmeijers does your code have any calls to |
My code did not have any calls to
For the 250kHz SF7 channel this works correctly and the data is received on TTN. For the FSK channel nothing is received, even though the debug prints state that we are transmitting on the correct frequency.
But as stated before FSK might be due to something else. From what we found, is this still considered an LMIC bug? Or is this an issue with TTN? In the latter case we can close this ticket. |
So.. the original bug report was, roughly "I request 250 kHz, and LMIC transmits on channel 3". That's still a bug, because TTN doesn't send any info about 250 kHz or FSK, and this then triggers #345. We can close this now, or close it when we close #345. Up to you, @jpmeijers. There are some LMIC issues anyway, Your bug #344 is a problem. Also, we need an (architectural) way to put in network specific knowledge like your two calls: LMIC_setupChannel(1, 868300000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI); // g-band
LMIC_setupChannel(8, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI); (I'll file an issue) Also, if you use ch1 at 250 kHz, there's no accounting that prevents using ch0/ch2 at 125 kHz "soon thereafter" -- but ch1 definitely leaks into ch0/ch2 bandwidth, so we need to be updating their usage/duty cycle counters. (I'll file an issue.) And I have no idea about the regulatory reqts for FSK vs the overlapped channels. |
Offline, @jpmeijers sent me this trace of a normal channel setup after join. TTN only sets up DR0..DR5. It looks like it doesn't try to set up DR6 or DR7. This plus bug #345 caused the spurious transmit on channel 3 that triggered this bug report.
|
Closing this now. See other FSK bugs that arose from this. |
My frequency plan is set to
#define CFG_eu868 1
inlmic_project_config.h
. After doing a OTAA join, then forcing the DR to use the STD channel usingLMIC_setDrTxpow(DR_SF7B,14)
, lmic transmits packets on 867.1MHz.The LoRa STD channel in EU is 868.3MHz.
See: https://github.com/TheThingsNetwork/gateway-conf/blob/master/EU-global_conf.json
and: https://www.thethingsnetwork.org/docs/lorawan/frequency-plans.html
The text was updated successfully, but these errors were encountered: