Closed FRASTM closed 10 months ago
Problem found with STM32duinoLoRaWAN/examples/Basic cannot connect. The RTC is running but the Lorawan started timers expires with an ALARM B interrupt
11:12:42.246 -> Start
11:12:42.547 -> Setting TX Config: modem=MODEM_LORA, power=13, fdev=0, bandwidth=0, datarate=8, coderate=1 preambleLen=8, fixLen=0, crcOn=1, freqHopOn=0, hopPeriod=0, iqInverted=0, timeout=4000
11:12:42.568 -> TX on freq 868300000 Hz at DR 4
11:12:42.568 -> TX: 00 01 01 01 01 01 01 01 01 b4 da 00 05 15 e1 80 00 4a 52 31 88 d9 b9
11:12:42.696 -> MAC txDone
11:13:02.664 -> RX_1 on freq 868300000 Hz at DR 4
11:13:02.695 -> IRQ_RX_TX_TIMEOUT
11:13:02.695 -> MAC rxTimeOut
11:13:06.803 -> RX_2 on freq 869525000 Hz at DR 0
11:13:06.995 -> IRQ_RX_TX_TIMEOUT
11:13:06.995 -> MAC rxTimeOut
11:13:07.027 -> MlmeConfirm: req=MLME_JOIN, status=LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT, airtime=114, margin=0, gateways=0
11:13:07.027 -> Setting TX Config: modem=MODEM_LORA, power=13, fdev=0, bandwidth=0, datarate=8, coderate=1 preambleLen=8, fixLen=0, crcOn=1, freqHopOn=0, hopPeriod=0, iqInverted=0, timeout=4000
11:13:07.059 -> TX on freq 868100000 Hz at DR 4
11:13:07.059 -> TX: 00 01 01 01 01 01 01 01 01 b4 da 00 05 15 e1 80 00 6e c9 6f cc f4 ec
11:13:07.188 -> MAC txDone
11:13:27.142 -> RX_1 on freq 868100000 Hz at DR 4
11:13:27.173 -> IRQ_RX_TX_TIMEOUT
11:13:27.173 -> MAC rxTimeOut
11:13:31.315 -> RX_2 on freq 869525000 Hz at DR 0
11:13:31.509 -> IRQ_RX_TX_TIMEOUT
11:13:31.509 -> MAC rxTimeOut
11:13:31.509 -> MlmeConfirm: req=MLME_JOIN, status=LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT, airtime=114, margin=0, gateways=0
11:13:31.551 -> Setting TX Config: modem=MODEM_LORA, power=13, fdev=0, bandwidth=0, datarate=8, coderate=1 preambleLen=8, fixLen=0, crcOn=1, freqHopOn=0, hopPeriod=0, iqInverted=0, timeout=4000
11:13:31.551 -> TX on freq 868100000 Hz at DR 4
11:13:31.551 -> TX: 00 01 01 01 01 01 01 01 01 b4 da 00 05 15 e1 80 00 aa b5 27 2f 2a 90
11:13:31.670 -> MAC txDone
11:13:51.635 -> RX_1 on freq 868100000 Hz at DR 4
11:13:51.667 -> IRQ_RX_TX_TIMEOUT
11:13:51.667 -> MAC rxTimeOut
11:13:55.778 -> RX_2 on freq 869525000 Hz at DR 0
11:13:56.003 -> IRQ_RX_TX_TIMEOUT
11:13:56.003 -> MAC rxTimeOut
11:13:56.003 -> MlmeConfirm: req=MLME_JOIN, status=LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT, airtime=114, margin=0, gateways=0
11:13:56.003 -> Join failed
Adjusting the conversion formula to change ticks in ms and ms to ticks. With the RTC clocked by the LSE (32768Hz) in the MIX mode, the SubSecond SSR register is counting ticks on a freq equal to RTCCLK / (PREDIV_A + 1) = 32768 / (0x7F +1) = 256Hz. That means one tick unit = 3.9ms (cannot define timeout lower than 3.9 ms)
Running the STM32duinoLoRaWAN/examples/Basic on the nucleo_wl55jc
13:28:42.040 -> Start
13:28:42.041 -> Setting TX Config: modem=MODEM_LORA, power=13, fdev=0, bandwidth=0, datarate=8, coderate=1 preambleLen=8, fixLen=0, crcOn=1, freqHopOn=0, hopPeriod=0, iqInverted=0, timeout=4000
13:28:42.041 -> TX on freq 868100000 Hz at DR 4
13:28:42.041 -> TX: 00 01 01 01 01 01 01 01 01 89 dd 00 05 15 e1 80 00 4a a9 3b 24 c0 de
13:28:42.107 -> MAC txDone
13:28:47.118 -> RX_1 on freq 868100000 Hz at DR 4
13:28:47.150 -> IRQ_RX_TX_TIMEOUT
13:28:47.150 -> MAC rxTimeOut
13:28:48.145 -> RX_2 on freq 869525000 Hz at DR 0
13:28:49.942 -> MAC rxDone
13:28:49.974 -> RX: 2008caff22d905b7d069dd0c7dfeb2b89c05c073422dae781024e2482236a0f38c
13:28:49.974 -> MlmeConfirm: req=MLME_JOIN, status=LORAMAC_EVENT_INFO_STATUS_OK, airtime=114, margin=0, gateways=0
13:28:49.974 -> Joined
13:28:49.974 -> Setting TX Config: modem=MODEM_LORA, power=13, fdev=0, bandwidth=0, datarate=8, coderate=1 preambleLen=8, fixLen=0, crcOn=1, freqHopOn=0, hopPeriod=0, iqInverted=0, timeout=4000
13:28:50.007 -> TX on freq 868500000 Hz at DR 4
13:28:50.007 -> TX: 40 c4 8b 4a 1f 80 01 00 0a b9 51 24 49 b8 c3 b8 93
13:28:50.102 -> MAC txDone
13:28:55.114 -> RX_1 on freq 868500000 Hz at DR 2
13:28:55.179 -> IRQ_RX_TX_TIMEOUT
13:28:55.179 -> MAC rxTimeOut
13:28:56.142 -> RX_2 on freq 869525000 Hz at DR 0
13:28:56.335 -> IRQ_RX_TX_TIMEOUT
13:28:56.335 -> MAC rxTimeOut
13:28:56.335 -> McpsConfirm: req=MCPS_UNCONFIRMED, status=LORAMAC_EVENT_INFO_STATUS_OK, datarate=4, power=0, ack=0, retries=0, airtime=93, upcnt=1, channel=2
13:28:56.367 -> Sent packet
...
now replaced by the https://github.com/stm32duino/STM32LoRaWAN/pull/25
Configure the RTC in mix mode and use the ALARM B of the stm32WL55 device for the LoraWan purpose.
This requires the https://github.com/stm32duino/STM32RTC/pull/93
The MIX mode of the RTC allows the Lorawan to use the subsecond and alarm (B) in binary mode and the RTC to be also used in BCD calendar mode.