zephyr: LoRaWAN US915 NRF52840DK+sx1262 unable to TTN join

Describe the bug

When using US915 LoRaWAN class_a sample we’re unable to join on TTN

First to mention, there is no subband (FSB) selection possible under kconfig (see FSB usage explanation) so as US915 has 64 channels and our gateway has only 8 channels, we miss about lot of joins request that are not in our subband (just as a reminder, not related to our issue)

Using NRF52840 + semtech_sx1262mb2das shield, tried also with RAK4631 same issue

To Reproduce

We changed main.c to loop for join to better track of this issue

	ret = -1;
	while (ret < 0) {
    	        // tried this one also just in case without any better success
        	// join_cfg.otaa.dev_nonce = (uint16_t)sys_rand32_get();

		LOG_INF("Joining network over OTAA with devnonce %d", join_cfg.otaa.dev_nonce);
		ret = lorawan_join(&join_cfg);
		if (ret < 0) {
			LOG_ERR("lorawan_join_network failed: %d", ret);
			k_sleep(K_MSEC(1000));
		}
	}

west build -p -b nrf52840dk_nrf52840 ./zephyr/samples/subsys/lorawan/class_a/ -- -DSHIELD=semtech_sx1262mb2da

Expected behavior

Device to join LoRaWAN .

Impact

LoRaWAN not working US915 on TTN in our config (not sure on others LNS)

Logs and console output

*** Booting nRF Connect SDK v3.5.99-ncs1 ***
[00:00:00.339,813] <dbg> lorawan: lorawan_start: LoRaMAC Initialized
[00:00:00.339,965] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:00:00.357,421] <dbg> lorawan: lorawan_join: Network join request sent!
[00:00:06.906,372] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:00:06.906,402] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:00:06.908,508] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:00:07.908,599] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:00:07.923,858] <dbg> lorawan: lorawan_join: Network join request sent!
[00:00:14.471,710] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:00:14.471,740] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:00:14.473,846] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:00:15.473,937] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:00:15.489,196] <dbg> lorawan: lorawan_join: Network join request sent!
[00:00:22.038,055] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:00:22.038,085] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:00:22.040,191] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:00:23.040,283] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:00:23.055,572] <dbg> lorawan: lorawan_join: Network join request sent!
[00:00:29.604,522] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:00:29.604,553] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:00:29.606,658] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:00:30.606,750] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:00:30.622,009] <dbg> lorawan: lorawan_join: Network join request sent!
[00:00:37.152,587] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:00:37.152,618] <err> lorawan: MlmeConfirm failed : Rx 1 timeout
[00:00:37.152,648] <dbg> lorawan: mcps_indication_handler: Received McpsIndication 0
[00:00:37.152,679] <err> lorawan: McpsIndication failed : Error
[00:00:37.154,754] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:00:38.154,876] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:00:38.170,135] <dbg> lorawan: lorawan_join: Network join request sent!
[00:00:44.676,788] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:00:44.676,818] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:00:44.678,924] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:00:45.679,016] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:00:45.694,274] <dbg> lorawan: lorawan_join: Network join request sent!
[00:00:52.243,133] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:00:52.243,164] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:00:52.245,269] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:00:53.245,361] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:00:53.260,620] <dbg> lorawan: lorawan_join: Network join request sent!
[00:00:59.809,448] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:00:59.809,478] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:00:59.811,584] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:01:00.811,676] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:01:00.826,904] <dbg> lorawan: lorawan_join: Network join request sent!
[00:01:07.033,355] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:01:07.033,386] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:01:07.035,491] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:01:08.035,583] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:01:08.050,842] <dbg> lorawan: lorawan_join: Network join request sent!
[00:01:14.599,670] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:01:14.599,700] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:01:14.601,806] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:01:15.601,898] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:01:15.617,156] <dbg> lorawan: lorawan_join: Network join request sent!
[00:01:22.165,985] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:01:22.166,015] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:01:22.168,121] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:01:23.168,212] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:01:23.183,471] <dbg> lorawan: lorawan_join: Network join request sent!
[00:01:29.732,330] <dbg> lorawan: mlme_confirm_handler: Received MlmeConfirm (for MlmeRequest 1)
[00:01:29.732,360] <err> lorawan: MlmeConfirm failed : Rx 2 timeout
[00:01:29.734,466] <err> lorawan_class_a: lorawan_join_network failed: -116
[00:01:30.734,558] <inf> lorawan_class_a: Joining network over OTAA with devnonce 0
[00:01:30.749,816] <dbg> lorawan: lorawan_join: Network join request sent!

Gateway Logs

As you can see only 2 of the 14 joins are seen, it’s because of FSB mentioned above.

image

** TN LOG**

image

Additional context

We have some RAK3172 (STM32WL5) we are using with mbed for long time and we tried on this one to check our infrastructure and also tried with EU868

  • MBED + RAK3172 + US915 -> Works
  • MBED + RAK3172 (LP Version) + EU868 -> Works
  • Zephyr + NRF52840 + semtech_sx1262mb2das shield + EU868 -> Works
  • Zephyr + NRF52840 + semtech_sx1262mb2das shield + US915 -> Not working
  • Zephyr + RAK4630 + EU868 -> Works
  • Zephyr + RAK4630 + US915 -> Not working

As you can see the issue is only happening on US915 with Zephyr.

We also tried to increase RX error from 20 to 100 just in case with CONFIG_LORAWAN_SYSTEM_MAX_RX_ERROR=100 not solving the issue.

Any help would be greatly appreciated @mluis1 @martinjaeger @carlescufi , FTI we already made some first investigations with @kartben

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 40 (17 by maintainers)

Most upvoted comments

Hey thanks for the quick answer I’m too in EU developing US and AU product. I’ve faced the same issue on stm32wleX, I’ve managed to join the network by using a mask that fit my gateway FSB. I know this is not compliant with the lorawan alliance but it works for now. The only things is that I’m struggling sending confirmed message as I get the Rx2 timeout error. Messages seems to be received by the server. I’ve done those tests in a hurry, I’ll investigate further next week and keep you updated.

reduce the spi frequency to a value lesser than 8Mhz using a overlay and then the lorawan join procedure will be successful. it atleast worked for me for all nrf52840dk, nrf5340dk and nrf54l15dk

Coincidentally I found the same issue testing base LoRa and made a PR an hour ago to reduce the frequency #89235.

After tweekings some clocks parameters I’m now able to comunicate with any datarate.

Awesome, do you think it’s possible to summarize changes made to fix this issue?

Also add to MIN_RX_SYMBOLS to Kconfig https://github.com/zephyrproject-rtos/zephyr/blob/ee8266797c176b67867c1012d441141885bc9e4c/subsys/lorawan/Kconfig

config LORAWAN_SYSTEM_MIN_RX_SYMBOLS
	int "LoRaWAN System Min Rx Symbols"
	default 6
	help
	  System Min Rx symbols error value in ms to be used by LoRaWAN stack
	  for calculating the RX1/RX2 window timeout.

Depending on your system clock the RX windows may not be opening at the correct times.

I have had success modifying the following parameters in the board config to open RX windows earlier and keep open longer than the defaults that are set for very precise timing of the host MCU.

CONFIG_LORAWAN_SYSTEM_MAX_RX_ERROR=30 CONFIG_LORAWAN_SYSTEM_MIN_RX_SYMBOLS=10

LoRaMac-node has details of how these parameters affect the RX window timing. https://github.com/Lora-net/LoRaMac-node/blob/dcbcfb329b4a343ab007bc19ac43a8dc952b3354/src/mac/region/Region.h#L966

lorawan_start configures MAX_RX_ERROR in mainline. https://github.com/zephyrproject-rtos/zephyr/blob/ee8266797c176b67867c1012d441141885bc9e4c/subsys/lorawan/lorawan.c#L770

I added handling for MIN_RX_SYMBOLS in my testing.

mib_req.Type = MIB_MIN_RX_SYMBOLS;
mib_req.Param.MinRxSymbols = CONFIG_LORAWAN_SYSTEM_MIN_RX_SYMBOLS;
LoRaMacMibSetRequestConfirm(&mib_req);

@Martdur, interesting how did you set FSB on zephyr? Do you hard code frequencies or use an hidden API call? Anyway, thanks for follow up

My gateway only support the first frequency bands so I use :

    uint16_t channelMask[6]={0};
    channelMask[0]=0xffff;
    lorawan.SetLorawanChannelMask(
        channelMask, 6);

There is a lot of magic number but it’s just for the sake of testing.

@martinjaeger thanks for your prompt answer, I’m living also in EU but got some US testing infrastructure so I can help to figure this out but I don’t have sufficient Zephyr LoRaWAN stack skills (and time to dig into mostly). Anyway I may switch back to this project sooner or later so I can ping a dev team so we can work together to fix it. Just let me know

I’m facing the same issue here do you managed to make it works @hallard ?