Hi Will,
thanks for your speedy answer and sorry for my late response.
As for the crash, it has been a long time since I looked at the lora code.
Did you dump the contents of TxTimeoutTimer? Is the bsp_timer pointer set
to NULL in that struct? I guess I am wondering if the crash is caused by
the timer struct that gets passed into hal_timer_stop or that the timer is
not initialized properly.
Following the SX1276SetSleep calls by adding some console_printfs (due
to flash size limitation I had to reduce console output at some point)
to sx1276.c (used directly) and LoRaMac.c (called via Radio.Sleep) ...
Finally, my recollection of the multiple hal_timer_init() calls is that the
timer can be stopped and started to save power. This is called by
lora_enter_low_power() and low_exit_low_power(). You could see if turning
off low power mode temporarily fixes the issue (simply hack the code to do
nothing in the low power functions). In any event, you should keep the call
to hal_timer_init in the stm periph code since the timer should be
initialized by the creation code.
... as well as hacking the two functions to do nothing (despite
indicating its execution by a console_printf) as suggested, gives the
following output:
000031 LMI
000033 SX1276SetSleep
000037 RxTT:
000040 - bt: 0x20001084
000046 - cf: 0x0800c05d
000052 - ca: 0x00000000
000057 - exp: 0
000060 TxTT:
000063 - bt: 0x20001084
000069 - cf: 0x0800c05d
000075 - ca: 0x00000000
000080 - exp: 0
000084 GMote on ARM
000128 SX1276Random
000131 SX1276SetSleep
000135 RxTT:
000138 - bt: 0x20001084
000145 - cf: 0x0800c05d
000151 - ca: 0x00000000
000156 - exp: 0
000159 TxTT:
000162 - bt: 0x20001084
000169 - cf: 0x0800c05d
000175 - ca: 0x00000000
000180 - exp: 0
000201 Joining ...
001205 Hello World! 0
001683 Exit LP
001686 lmprt
001689 SX1276SetSleep
001693 RxTT:
001697 - bt: 0x20001084
001703 - cf: 0x000003e8
001709 - ca: 0x200010a4
001716 - exp: 1000
001720 TxTT:
001724 - bt: 0x20001084
001730 - cf: 0x0800c05d
001737 - ca: 0x00000000
001742 - exp: 3201450
001748 Unhandled interrupt (3), exception sp 0x20001518
001748 r0:0x20001f24 r1:0x20001084 r2:0x20001f87 r3:0x00000000
001748 r4:0x00000693 r5:0x00000000 r6:0x0800fd00 r7:0x0800fcf4
001748 r8:0x00000000 r9:0x08006019 r10:0xffffffff r11:0xffffffff
001748 r12:0x00000001 lr:0x08005755 pc:0x08003cd4 psr:0x21000000
001748 ICSR:0x0440f003
001748 task:loramac
001748 0x20001540: 0x0800fd00
001748 0x20001544: 0x08005755
001748 0x2000154c: 0x0800b42b
001748 0x20001550: 0x0800b3c9
001748 0x20001564: 0x08006c29
001748 0x20001568: 0x08000dfe
001748 0x20001574: 0x00000000
001748 0x2000157c: 0x080016c5
001748 0x20001580: 0x08006019
001748 0x20001594: 0x0800171b
001748 0x2000159c: 0x08006021
001748 0x200015a4: 0x08000dcd
After LoraMacInitialization (LMI) and SX1276Random (obtains dev_nonce
from RSSI values, how cool is that!) SX2176SetSleep is called again in
lora_mac_process_radio_tx (lmprt). Actually lora_exit_low_power would
have been called shortly before if it wasn't commented out (Exit LP).
The bsp_timer pointer (bt) is never NULL. The RxTimeoutTimer callback
(cf) in that last call is no longer 0x0800c05d (SX1276OnTimeoutIrq), it
changed to 0x000003e8. I am not sure whether that's okay or not.
And it's the same even without commenting out code in the
{exit,enter}_low_power functions. However, with the functions doing what
they are supposed to do, the bsp_timer pointer for the RxTimeoutTimer is
0x20 higher than the one from TxTimeoutTimer. But that might be okay,
isn't it?
I realize the above might not help all that much but I think once you
determine what is causing the crash (bad parameter to underlying timer not
initialized correctly) you should be able to determine root cause.
If you have further issues let me know and I can see if I can help more.
Thanks for that. Unfortunately I don't have a lot of time at the moment
but I am resuming problem search whenever possible!
Meanwhile, Jerzy pointed out a problem related to the stack. Just didn't
find enough time.
All the best,
Frank