Lora JOIN request fails & RX TIMEOUT

I’ve ported the Semtech LoRa Basic Modem library to Zephyr for my project. It works fine until I enable CONFIG_PM. Does anyone have any insight into what might be causing this issue? I understand that the LoRa Basic Modem library isn’t officially part of Zephyr yet, but perhaps someone has encountered a similar problem and has a solution or idea.

I can see that the join request from the chip successfully reaches the gateway, and the gateway accepts it, but the LoRa device immediately generates a fail event due to modem returns RX Timeout flags. There is no problem with dev eui and app_key. if I disable the configuration. a join request will will be ok.

Here are the gateway LoRaWAN frames:
image

zephyr version: v3.6-branch
sdk version: zephyr-sdk-0.16.6
MCU: STM32U575ZIQ
SHIELD: semtech_lr1121mb1xxs
Any workaround ideas? Can anyone shed some light on how to debug at least?

You’ll see from forum search that Zephyr & LBM isn’t a topic that comes up much.

I’d surmise that the very pro-active power management the CONFIG_PM instructs the kernel is sleeping whilst LBM is waiting for the Rx1 window.

Your frequency plan appears unusual so it’s not obvious that you are using TTN or a TTI instance.

@descartes acutally, i dont think its a kernel issue., The modem generates correct interrupts, for tx and rx for the app without pm, but for the fail app rx, it generates rx timeout within the same time window
Please look at the logs

One fail join attempt log:

INFO: Use soft secure element for cryptographic functionalities
stack_id 0
 DevNonce = 24
 JoinNonce = 0xff ff ff, NetID = 0xff ff ff
 Region = CN470_RP_1_0
255 smtc_modem.c
Modem event callback

Event received: RESET

2
INFO: smtc_modem_join_network
 Start a new join sequence now on stack 0
262 smtc_modem.c
313 main_periodical_uplink.c
318 main_periodical_uplink.c
Join is starting 

DevEUI - (8 bytes):
 66 30 31 34 63 36 39 65
JoinEUI - (8 bytes):
 00 00 00 00 00 00 00 00
DevNonce 0x19, stack_id 0
Send Payload  for stack_id = 0
1381 lr11_apps_common.c
ralstatus1:0 4194308 2
793 radio_planner.c update: 2
1381 lr11_apps_common.c
662 lr1_stack_mac_layer.c update: 3
749 lr1_stack_mac_layer.c update: 2
 TX DONE
radio_timestamp: 47934 time_off_ms: 0 jn stat:1
296 lr1mac_core.c wnds: 0 1
delay_ms 5000
rx_offset_ms:-2, rx_timeout_symb_in_ms:16, rx_window_symb: 8, board_delay_ms:2
freq rx1: 507500000
timeout prm: 3000
  RX1 LoRa at 52932 ms: freq:507500000, SF8, BW125, sync word = 0x34
  Timer will expire in 4975 ms
300 lr1mac_core.c past: 0 
1381 lr11_apps_common.c
ralstatus1:0 4195328 8
793 radio_planner.c update: 8
822 radio_planner.c update:
1381 lr11_apps_common.c
662 lr1_stack_mac_layer.c update: 5
749 lr1_stack_mac_layer.c update: 4
1RX1 Timeout for stack_id = 0

delay_ms 6000
rx_offset_ms:-2, rx_timeout_symb_in_ms:16, rx_window_symb: 8, board_delay_ms:2
freq rx2: 505300000
timeout prm: 3000
  RX2 LoRa at 53932 ms: freq:505300000, SF8, BW125, sync word = 0x34
  Timer will expire in 764 ms
1381 lr11_apps_common.c
ralstatus1:0 4195328 8
793 radio_planner.c update: 8
822 radio_planner.c update:
1381 lr11_apps_common.c
662 lr1_stack_mac_layer.c update: 5
749 lr1_stack_mac_layer.c update: 4
RX2 Timeout for stack_id = 0 Start a new join sequence in 14 seconds on stack 0
Modem event callback

Event received: JOINFAIL

one successful join request

INFO: Use soft secure element for cryptographic functionalities
stack_id 0
 DevNonce = 46
 JoinNonce = 0x21 00 00, NetID = 0x00 00 00
 Region = CN470_RP_1_0
Modem event callback

Event received: RESET

2
INFO: smtc_modem_join_network
 Start a new join sequence now on stack 0
Join is starting 

DevEUI - (8 bytes):
 66 30 31 34 63 36 39 65
JoinEUI - (8 bytes):
 00 00 00 00 00 00 00 00
DevNonce 0x2f, stack_id 0
Send Payload  for stack_id = 0
1446 lr11_apps_common.c
1446 lr11_apps_common.c
662 lr1_stack_mac_layer.c update: 3
749 lr1_stack_mac_layer.c update: 2
 TX DONE
radio_timestamp: 13408 time_off_ms: 0 jn stat:1
297 lr1mac_core.c wnds: 0 1
delay_ms 5000
rx_offset_ms:-2, rx_timeout_symb_in_ms:16, rx_window_symb: 8, board_delay_ms:2
freq rx1: 506700000
timeout prm: 3000
  RX1 LoRa at 18406 ms: freq:506700000, SF8, BW125, sync word = 0x34
  Timer will expire in 4980 ms
301 lr1mac_core.c past: 0 
1446 lr11_apps_common.c
1446 lr11_apps_common.c
662 lr1_stack_mac_layer.c update: 4
749 lr1_stack_mac_layer.c update: 4
1Receive a Valid downlink RX1 for stack_id = 0 update join procedure
 DevAddr= ba9a01
 MacRx1DataRateOffset= 0
 MacRx2DataRate= 0
 MacRx1Delay= 1
Modem event callback

Event received: JOINED

Modem is now joined 

Joined

How am I supposed to see this in the logs? I don’t see any timestamps, I have no clue what you are referring to. Can you turn on timestamps in your terminal/device console?

What frequency band are you using? CN470? How is your device configured regarding LW version and RP version? May sound useless to you, but details like these make us get a tiny bit of feeling for what is going on - besides Zephyr being completely outside expertise of almost everyone here including me.

Without timestamps we can’t really move forward. Some debug messages on the interrupts would help. You could also put in a breakpoint just before the sleep to check the pin configuration is setup OK.

As you are geolocated in Ireland, why the CN470 channel plan?

sorry I didnt notice time stamps is not included

SUCCESFULL JOIN LOGS

INFO: Use soft secure element for cryptographic functionalities
[00:00:36.403,000] <dbg> lora_mac_layer: lr1_stack_mac_region_config: smtc_real_init done

[00:00:36.403,000] <dbg> lr1mac_core: lr1mac_core_init: stack_id 0

[00:00:36.403,000] <dbg> lr1mac_core: lr1mac_core_init:  DevNonce = 708

[00:00:36.403,000] <dbg> lr1mac_core: lr1mac_core_init:  JoinNonce = 0x0d 02 00, NetID = 0x00 00 00

[00:00:36.403,000] <dbg> lr1mac_core: lr1mac_core_init:  Region = CN470_RP_1_0

[00:00:36.404,000] <dbg> lora_radio_planner: rp_task_abort: RP: rp_task_abort #1

[00:00:36.404,000] <dbg> lora_mac_layer: lr1_stack_mac_region_config: smtc_real_init done

[00:00:36.404,000] <dbg> lora_certification: lorawan_certification_services_init: LoRaWAN Certification is disabled on stack 0

[00:00:36.404,000] <inf> lora_periodic: Modem event callback

[00:00:36.404,000] <inf> lora_periodic: Event received: RESET

2
[00:00:36.404,000] <dbg> lora_mac_layer: lr1_stack_mac_region_config: smtc_real_init done

INFO: smtc_modem_join_network
 Start a new join sequence now on stack 0
[00:00:36.404,000] <dbg> lora_module: lora_callback_handler: SMTC_MODEM_EVENT_RESET
[00:00:36.404,000] <inf> lora_periodic: Join is starting 

[00:00:36.405,000] <dbg> lora_mac_layer: lr1_stack_mac_region_config: smtc_real_init done

[00:00:36.405,000] <dbg> lora_radio_planner: rp_task_enqueue: RP: Task #2 enqueue with #7 priority

[00:00:36.405,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_task_enqueue and priority-task #2, timer hook #0, delay 2448, now 36405
                        
[00:00:36.405,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: High priority task is in the future

[00:00:36.413,000] <inf> modem_hl7812: RTC string: '"00/00/00,00:00:00-00"'
[00:00:38.846,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_timer_irq and priority-task #2, timer hook #2, delay 7, now 38846
                  
[00:00:38.846,000] <dbg> lora_radio_planner: rp_task_launch_current:  RP: Launch task #2 and start radio state 2, type 12

[00:00:38.846,000] <dbg> lora_radio_planner: rp_task_print: 
                                                            RP- INFO - Radio task #2  running - Timer task #2 running  - Hook ID #2 -
[00:00:38.846,000] <dbg> lora_radio_planner: rp_task_print:  TASK_ERROR 
[00:00:38.846,000] <dbg> lora_radio_planner: rp_task_print:  - start time @38853 - priority #7

[00:00:38.855,000] <dbg> lora_radio_planner: rp_callback:  RP: INFO - Radio IRQ received for hook #2

DevEUI - (8 bytes):
 66 30 31 34 63 33 65 39
JoinEUI - (8 bytes):
 00 00 00 00 00 00 00 00
[00:00:38.855,000] <dbg> lora_mac_layer: lr1_stack_mac_join_request_build: DevNonce 0x2c5, stack_id 0

[00:00:38.856,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: No more active tasks

[00:00:38.856,000] <dbg> lr1mac_core: lr1mac_core_process: Send Payload  for stack_id = 0

[00:00:38.856,000] <dbg> lr1mac_core: lr1mac_core_process:   Tx  LoRa at 38855 ms: freq:487500000, SF8, BW125, len 23 bytes 14 dBm, fcnt_up 0, toa = 114

[00:00:38.856,000] <dbg> lora_radio_planner: rp_task_enqueue: RP: Task #1 enqueue with #6 priority

[00:00:38.856,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_task_enqueue and priority-task #1, timer hook #2, delay 7, now 38856
                     
[00:00:38.856,000] <dbg> lora_radio_planner: rp_task_launch_current:  RP: Launch task #1 and start radio state 2, type 2

[00:00:38.856,000] <dbg> lora_radio_planner: rp_task_print: 
                                                            RP- INFO - Radio task #1  running - Timer task #2 running  - Hook ID #1 -
[00:00:38.856,000] <dbg> lora_radio_planner: rp_task_print:  TASK_TX_LORA 
[00:00:38.856,000] <dbg> lora_radio_planner: rp_task_print:  - start time @38866 - priority #6

[00:00:38.979,000] <dbg> lora_app_common: radio_on_dio_irq: 1446 lr11_apps_common.c

[00:00:38.980,000] <dbg> lora_radio_planner: rp_callback:  RP: INFO - Radio IRQ received for hook #1

[00:00:38.981,000] <dbg> lora_app_common: radio_on_dio_irq: 1446 lr11_apps_common.c

[00:00:38.981,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: 662 lr1_stack_mac_layer.c update: 3

[00:00:38.981,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: 749 lr1_stack_mac_layer.c update: 2

[00:00:38.981,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: No more active tasks

[00:00:38.981,000] <dbg> lr1mac_core: lr1mac_core_process:  TX DONE

[00:00:38.981,000] <dbg> lr1mac_core: lr1mac_core_process: radio_timestamp: 38979 time_off_ms: 0 jn stat:1

[00:00:38.983,000] <dbg> lr1mac_core: lr1mac_core_process: 297 lr1mac_core.c wnds: 0 1

[00:00:38.983,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_timer_configure: delay_ms 5000

[00:00:38.983,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_timer_configure: rx_offset_ms:-2, rx_timeout_symb_in_ms:16, rx_window_symb: 8, board_delay_ms:2

[00:00:38.983,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_radio_start: freq rx1: 507900000

[00:00:38.983,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_radio_start: timeout prm: 3000

[00:00:38.983,000] <dbg> lora_radio_planner: rp_task_enqueue: RP: Task #1 enqueue with #1 priority

[00:00:38.983,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_task_enqueue and priority-task #1, timer hook #2, delay 4994, now 38983
                        
[00:00:38.983,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: High priority task is in the future

[00:00:38.983,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_radio_start:   RX1 LoRa at 43977 ms: freq:507900000, SF8, BW125, sync word = 0x34

[00:00:38.983,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_timer_configure:   Timer will expire in 4994 ms

[00:00:38.983,000] <dbg> lr1mac_core: lr1mac_core_process: 301 lr1mac_core.c past: 0 

[00:00:43.970,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_timer_irq and priority-task #1, timer hook #1, delay 7, now 43970
                  
[00:00:43.970,000] <dbg> lora_radio_planner: rp_task_launch_current:  RP: Launch task #1 and start radio state 2, type 0

[00:00:43.970,000] <dbg> lora_radio_planner: rp_task_print: 
                                                            RP- INFO - Radio task #1  running - Timer task #1 running  - Hook ID #1 -
[00:00:43.970,000] <dbg> lora_radio_planner: rp_task_print:  TASK_RX_LORA 
[00:00:43.970,000] <dbg> lora_radio_planner: rp_task_print:  - start time @43977 - priority #1

[00:00:44.068,000] <dbg> lora_app_common: radio_on_dio_irq: 1446 lr11_apps_common.c

[00:00:44.068,000] <dbg> lora_radio_planner: rp_callback:  RP: INFO - Radio IRQ received for hook #1

[00:00:44.069,000] <dbg> lora_app_common: radio_on_dio_irq: 1446 lr11_apps_common.c

[00:00:44.070,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: 662 lr1_stack_mac_layer.c update: 4

[00:00:44.070,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: payload size receive = 17, snr = 12 , rssi = -72

[00:00:44.070,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: 749 lr1_stack_mac_layer.c update: 4

[00:00:44.070,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: No more active tasks

[00:00:44.070,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_frame_decode:  rx_packet_type = 4

[00:00:44.070,000] <dbg> lr1mac_core: lr1mac_core_process: 1Receive a Valid downlink RX1 for stack_id = 0
[00:00:44.070,000] <dbg> lr1mac_core: lr1mac_mac_update:  update join procedure

[00:00:44.070,000] <dbg> lora_mac_layer: lr1_stack_mac_join_accept:  DevAddr= 1e11adc

[00:00:44.070,000] <dbg> lora_mac_layer: lr1_stack_mac_join_accept:  MacRx1DataRateOffset= 0

[00:00:44.070,000] <dbg> lora_mac_layer: lr1_stack_mac_join_accept:  MacRx2DataRate= 0

[00:00:44.070,000] <dbg> lora_mac_layer: lr1_stack_mac_join_accept:  MacRx1Delay= 1

[00:00:44.072,000] <inf> lora_periodic: Modem event callback

[00:00:44.072,000] <inf> lora_periodic: Event received: JOINED

[00:00:44.072,000] <inf> lora_periodic: Modem is now joined

JOIN REQUEST FAILS LOG

INFO: Use soft secure element for cryptographic functionalities
[00:00:37.762,000] <dbg> lora_mac_layer: lr1_stack_mac_region_config: smtc_real_init done

[00:00:37.762,000] <dbg> lr1mac_core: lr1mac_core_init: stack_id 0

[00:00:37.762,000] <dbg> lr1mac_core: lr1mac_core_init:  DevNonce = 709

[00:00:37.762,000] <dbg> lr1mac_core: lr1mac_core_init:  JoinNonce = 0x0e 02 00, NetID = 0x00 00 00

[00:00:37.762,000] <dbg> lr1mac_core: lr1mac_core_init:  Region = CN470_RP_1_0

[00:00:37.764,000] <dbg> lora_radio_planner: rp_task_abort: RP: rp_task_abort #1

[00:00:37.764,000] <dbg> lora_mac_layer: lr1_stack_mac_region_config: smtc_real_init done

[00:00:37.764,000] <dbg> lora_certification: lorawan_certification_services_init: LoRaWAN Certification is disabled on stack 0

[00:00:37.764,000] <inf> lora_periodic: Modem event callback

[00:00:37.764,000] <inf> lora_periodic: Event received: RESET

2
[00:00:37.764,000] <dbg> lora_mac_layer: lr1_stack_mac_region_config: smtc_real_init done

INFO: smtc_modem_join_network
 Start a new join sequence now on stack 0
[00:00:37.764,000] <dbg> lora_module: lora_callback_handler: SMTC_MODEM_EVENT_RESET
[00:00:37.764,000] <inf> lora_periodic: Join is starting 

[00:00:37.765,000] <dbg> lora_mac_layer: lr1_stack_mac_region_config: smtc_real_init done

[00:00:37.765,000] <dbg> lora_radio_planner: rp_task_enqueue: RP: Task #2 enqueue with #7 priority

[00:00:37.765,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_task_enqueue and priority-task #2, timer hook #0, delay 2944, now 37765
                        
[00:00:37.765,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: High priority task is in the future
[00:00:40.702,000] <dbg> lora_radio_planner: rp_task_launch_current:  RP: Launch task #2 and start radio state 2, type 12

[00:00:40.702,000] <dbg> lora_radio_planner: rp_task_print: 
                                                            RP- INFO - Radio task #2  running - Timer task #2 running  - Hook ID #2 -
[00:00:40.702,000] <dbg> lora_radio_planner: rp_task_print:  TASK_ERROR 
[00:00:40.702,000] <dbg> lora_radio_planner: rp_task_print:  - start time @40709 - priority #7

[00:00:40.712,000] <dbg> lora_radio_planner: rp_callback:  RP: INFO - Radio IRQ received for hook #2

DevEUI - (8 bytes):
 66 30 31 34 63 33 65 39
JoinEUI - (8 bytes):
 00 00 00 00 00 00 00 00
[00:00:40.713,000] <dbg> lora_mac_layer: lr1_stack_mac_join_request_build: DevNonce 0x2c6, stack_id 0

[00:00:40.713,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: No more active tasks

[00:00:40.713,000] <dbg> lr1mac_core: lr1mac_core_process: Send Payload  for stack_id = 0

[00:00:40.713,000] <dbg> lr1mac_core: lr1mac_core_process:   Tx  LoRa at 40713 ms: freq:487500000, SF8, BW125, len 23 bytes 14 dBm, fcnt_up 0, toa = 114

[00:00:40.713,000] <dbg> lora_radio_planner: rp_task_enqueue: RP: Task #1 enqueue with #6 priority

[00:00:40.713,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_task_enqueue and priority-task #1, timer hook #2, delay 7, now 40713
                     
[00:00:40.713,000] <dbg> lora_radio_planner: rp_task_launch_current:  RP: Launch task #1 and start radio state 2, type 2

[00:00:40.713,000] <dbg> lora_radio_planner: rp_task_print: 
                                                            RP- INFO - Radio task #1  running - Timer task #2 running  - Hook ID #1 -
[00:00:40.713,000] <dbg> lora_radio_planner: rp_task_print:  TASK_TX_LORA 
[00:00:40.713,000] <dbg> lora_radio_planner: rp_task_print:  - start time @40713 - priority #6

[00:00:40.807,000] <dbg> lora_app_common: radio_on_dio_irq: 1446 lr11_apps_common.c

[00:00:40.807,000] <dbg> lora_radio_planner: rp_callback:  RP: INFO - Radio IRQ received for hook #1

[00:00:40.807,000] <dbg> lora_app_common: radio_on_dio_irq: 1446 lr11_apps_common.c

[00:00:40.808,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: 662 lr1_stack_mac_layer.c update: 3

[00:00:40.808,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: 749 lr1_stack_mac_layer.c update: 2

[00:00:40.808,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: No more active tasks

[00:00:40.808,000] <dbg> lr1mac_core: lr1mac_core_process:  TX DONE

[00:00:40.808,000] <dbg> lr1mac_core: lr1mac_core_process: radio_timestamp: 40807 time_off_ms: 0 jn stat:1

[00:00:40.810,000] <dbg> lr1mac_core: lr1mac_core_process: 297 lr1mac_core.c wnds: 0 1

[00:00:40.810,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_timer_configure: delay_ms 5000

[00:00:40.810,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_timer_configure: rx_offset_ms:-2, rx_timeout_symb_in_ms:16, rx_window_symb: 8, board_delay_ms:2

[00:00:40.810,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_radio_start: freq rx1: 507900000

[00:00:40.810,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_radio_start: timeout prm: 3000

[00:00:40.810,000] <dbg> lora_radio_planner: rp_task_enqueue: RP: Task #1 enqueue with #1 priority

[00:00:40.810,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_task_enqueue and priority-task #1, timer hook #2, delay 4995, now 40810
                        
[00:00:40.810,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: High priority task is in the future

[00:00:40.810,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_radio_start:   RX1 LoRa at 45805 ms: freq:507900000, SF8, BW125, sync word = 0x34

[00:00:40.810,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_timer_configure:   Timer will expire in 4995 ms

[00:00:40.810,000] <dbg> lr1mac_core: lr1mac_core_process: 301 lr1mac_core.c past: 0 

[00:00:45.798,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_timer_irq and priority-task #1, timer hook #1, delay 7, now 45798
                  
[00:00:45.798,000] <dbg> lora_radio_planner: rp_task_launch_current:  RP: Launch task #1 and start radio state 2, type 0

[00:00:45.798,000] <dbg> lora_radio_planner: rp_task_print: 
                                                            RP- INFO - Radio task #1  running - Timer task #1 running  - Hook ID #1 -
[00:00:45.798,000] <dbg> lora_radio_planner: rp_task_print:  TASK_RX_LORA 
[00:00:45.798,000] <dbg> lora_radio_planner: rp_task_print:  - start time @45805 - priority #1

[00:00:45.818,000] <dbg> lora_app_common: radio_on_dio_irq: 1446 lr11_apps_common.c

[00:00:45.820,000] <dbg> lora_radio_planner: rp_callback:  RP: INFO - Radio IRQ received for hook #1

[00:00:45.820,000] <dbg> lora_app_common: radio_on_dio_irq: 1446 lr11_apps_common.c

[00:00:45.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: 662 lr1_stack_mac_layer.c update: 5

[00:00:45.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: DR4 Fine tune correction (ms) = 0, error fine tune (ms) = -5, lr1_mac->rx_offset_ms = -2

[00:00:45.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: 749 lr1_stack_mac_layer.c update: 4

[00:00:45.821,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: No more active tasks

[00:00:45.821,000] <dbg> lr1mac_core: lr1mac_core_process: 1RX1 Timeout for stack_id = 0


[00:00:45.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_timer_configure: delay_ms 6000

[00:00:45.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_timer_configure: rx_offset_ms:-2, rx_timeout_symb_in_ms:16, rx_window_symb: 8, board_delay_ms:2

[00:00:45.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_radio_start: freq rx2: 505300000

[00:00:45.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_radio_start: timeout prm: 3000

[00:00:45.821,000] <dbg> lora_radio_planner: rp_task_enqueue: RP: Task #1 enqueue with #1 priority

[00:00:45.821,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_task_enqueue and priority-task #1, timer hook #1, delay 984, now 45821
                       
[00:00:45.821,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: High priority task is in the future

[00:00:45.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_radio_start:   RX2 LoRa at 46805 ms: freq:505300000, SF8, BW125, sync word = 0x34

[00:00:45.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rx_timer_configure:   Timer will expire in 984 ms

[00:00:46.798,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: Arbiter has been called by rp_timer_irq and priority-task #1, timer hook #1, delay 7, now 46798
                  
[00:00:46.798,000] <dbg> lora_radio_planner: rp_task_launch_current:  RP: Launch task #1 and start radio state 2, type 0

[00:00:46.798,000] <dbg> lora_radio_planner: rp_task_print: 
                                                            RP- INFO - Radio task #1  running - Timer task #1 running  - Hook ID #1 -
[00:00:46.798,000] <dbg> lora_radio_planner: rp_task_print:  TASK_RX_LORA 
[00:00:46.798,000] <dbg> lora_radio_planner: rp_task_print:  - start time @46805 - priority #1

[00:00:46.818,000] <dbg> lora_app_common: radio_on_dio_irq: 1446 lr11_apps_common.c

[00:00:46.820,000] <dbg> lora_radio_planner: rp_callback:  RP: INFO - Radio IRQ received for hook #1

[00:00:46.820,000] <dbg> lora_app_common: radio_on_dio_irq: 1446 lr11_apps_common.c

[00:00:46.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: 662 lr1_stack_mac_layer.c update: 5

[00:00:46.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: DR0 Fine tune correction (ms) = 0, error fine tune (ms) = -5, lr1_mac->rx_offset_ms = -2

[00:00:46.821,000] <dbg> lora_mac_layer: lr1_stack_mac_rp_callback: 749 lr1_stack_mac_layer.c update: 4

[00:00:46.821,000] <dbg> lora_radio_planner: rp_task_arbiter:  RP: No more active tasks

[00:00:46.821,000] <dbg> lr1mac_core: lr1mac_core_process: RX2 Timeout for stack_id = 0
 Start a new join sequence in 14 seconds on stack 0
[00:00:46.821,000] <inf> lora_periodic: Modem event callback

[00:00:46.821,000] <inf> lora_periodic: Event received: JOINFAIL

[00:00:46.821,000] <dbg> lora_module: lora_callback_handler: SMTC_MODEM_EVENT_JOINFAIL

Lorawan cn470 lw:1.0 rp:1
As this is the only cn470 tested on lora basic modem

I just shared the logs with timestamps.

You could also put in a breakpoint just before the sleep to check the pin configuration is setup OK.

There is no sleep during the boot-up and join request, and the device is fully functional/operational. The configurations is the same for both w/o pm. I am putting the device in sleep mode after sending all data.

The main thing that I observe is this: note the time difference between the Rx1 window opening and the IRQ received.

Successful join:

Failed join:

In case of the failed join, there is only a 20ms Rx1 window apparently! That is quite a stretch… I’m not completely up to date on the conditions to stay in Rx mode for the LR11xx series, but 20ms is really optimistic as far as I’m concerned.

Apparently they are optimistic and apparently it is possible to catch a downlink with that, but if the timing is only very slightly off, that’s game over. So my guess is the PM thingamajig is throwing that off.

@stevencellist @descartes Ive just come across another issue that lr1121 modem does not have any more successful join requests, even though I am using the test software I always have successful join request.; it always returns rx_timeout for some reason. Is it possible that the device get corrupted?

Nope.

Have you checked for errors in the TTN application console? Does TTN show success for the join request or does it drop it because of something it considers an invalid condition?

Yes, it shows that join requests always reach the network and are accepted. I cant see any error there

If I tell you that the PM = Power Manager and that that flags tells Zephyr to go in to the lowest sleep state it can if there is nothing doing - particularly including a busy-wait - does that help?

I’d surmise that the IRQ fires and by the time everything is put back in place to continue running, particularly as Zephyr is a pre-emptive OS with all that is involved with context switching, the moment appears to have passed according to LBM.

The Semtech implementations and indeed almost every other stack don’t sleep in the Rx1 wait and the forum is littered with attempts by people to optimise that, only a handful successful.

I’d suggest turning off sleep whilst doing a send-receive. Not sure how as usually I’m trying to get things to go low power but there is the rather brutal CONFIG_SYS_POWER_DEEP_SLEEP_STATES=n which will stop k_sleep() from doing anything other than a delay with yield. There may be some hints on how this is handled in the Zephyr LoRaMac-node implementation.