Good afternoon!
Lately I’ve been working on upgrading an air quality monitor to be compatible with V3 - before it used an Arduino Pro Mini with TinyLoRa.
In order to make the node capable of receiving MAC downlinks I am attempting to switch to LMIC. To do this I had to change to an STM32 blue pill MCU because the memory of the Pro Mini is too small.
I have wired the board up to an RFM95 and set it up as a device in the V3 console. I’m using the “ttn-abp” example supplied with the MCCI LMIC library with the keys from the console. My lmic_project_config.h file is as follows:
#define CFG_eu868 1
#define CFG_sx1276_radio 1
#define DISABLE_JOIN
When I program the STM32 I get some weird behaviour. At first the packets are received by my BasicStation gateway and forwarded to the application in TTN. However, every uplink that is received triggers a downlink:
I assume the repeated downlinks mean that the node is not reacting to the MAC packets correctly, causing the network to send them again, but I’m not sure.
After the first few uplinks the packets stop reaching the application with an error message Host `cluster` failed to handle message: Device not found
on the live gateway data page:
The device not found errors looks like this:
{
"name": "gs.up.drop",
"time": "2021-04-25T16:35:50.293348086Z",
"identifiers": [
{
"gateway_ids": {
"gateway_id": "csl-gateway-1",
"eui": "B827EBFFFE025D8F"
}
}
],
"data": {
"@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
"namespace": "pkg/gatewayserver",
"name": "host_handle",
"message_format": "host `{host}` failed to handle message",
"attributes": {
"host": "cluster"
},
"cause": {
"namespace": "pkg/networkserver",
"name": "device_not_found",
"message_format": "device not found",
"correlation_id": "9ca11e9a7bc0474faaf2bf693c858a31",
"code": 5
},
"code": 5
},
"correlation_ids": [
"gs:conn:01F44XVDCXD9K8Z4DV1FWYM3JB",
"gs:up:host:01F44XVDD3E5CHK4AK4X0D1YEV",
"gs:uplink:01F44Y67WH980JR7VJ4SW59JW5"
],
"origin": "ip-10-100-6-72.eu-west-1.compute.internal",
"context": {
"tenant-id": "CgN0dG4="
},
"visibility": {
"rights": [
"RIGHT_GATEWAY_TRAFFIC_READ"
]
},
"unique_id": "01F44Y67WNYN03NY97B99PJYK0"
}
We can also see that for every packet that did reach the application, a mysterious red error was triggered. When I click on one I see this:
{
"name": "gs.down.send",
"time": "2021-04-25T16:35:28.617285622Z",
"identifiers": [
{
"gateway_ids": {
"gateway_id": "csl-gateway-1",
"eui": "B827EBFFFE025D8F"
}
}
],
"data": {
"@type": "type.googleapis.com/ttn.lorawan.v3.DownlinkMessage",
"raw_payload": "YEJpCyaAAgAASYwafZjoc/DwJpHheVxcVQ03alDnqxysQuoCTmEd7Shdjqf67bfzYkyQ",
"request": {
"downlink_paths": [
{
"uplink_token": "ChsKGQoNY3NsLWdhdGV3YXktMRIIuCfr//4CXY8Qs8GbngEaCwjQtJaEBhCotZpjILj29obUCQ=="
}
],
"rx1_delay": 1,
"rx1_data_rate_index": 5,
"rx1_frequency": "868500000",
"rx2_frequency": "869525000",
"priority": "HIGHEST",
"frequency_plan_id": "EU_863_870_TTN"
},
"correlation_ids": [
"gs:conn:01F44XVDCXD9K8Z4DV1FWYM3JB",
"gs:up:host:01F44XVDD3E5CHK4AK4X0D1YEV",
"gs:uplink:01F44Y5JAGTYSSMSF182EQCDDM",
"ns:downlink:01F44Y5JQ8K4553BFQQC9X07C5",
"ns:uplink:01F44Y5JAH0ABXPXB92EYC7HCJ",
"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01F44Y5JAGXACKMPNJCVFEE3Y9",
"gs:conn:01F44XVDCXD9K8Z4DV1FWYM3JB",
"rpc:/ttn.lorawan.v3.NsGs/ScheduleDownlink:01F44Y5JQ9CB58BBWDX4TWX1TE"
]
},
"correlation_ids": [
"gs:conn:01F44XVDCXD9K8Z4DV1FWYM3JB",
"rpc:/ttn.lorawan.v3.NsGs/ScheduleDownlink:01F44Y5JQ9CB58BBWDX4TWX1TE"
],
"origin": "ip-10-100-6-72.eu-west-1.compute.internal",
"context": {
"tenant-id": "CgN0dG4="
},
"visibility": {
"rights": [
"RIGHT_GATEWAY_TRAFFIC_READ"
]
},
"unique_id": "01F44Y5JQ9PGXET6TKTMMHPXA9"
}
The BasicStation console shows that for the first few uplinks (the ones that reached the application) a downlink was sent in response, but afterwards no downlinks were sent:
2021-04-25 16:34:44.000 [S2E:VERB] RX 868.1MHz DR5 SF7/BW125 snr=9.2 rssi=-48 xtime=0x2300001124D02B - updf mhdr=40 DevAddr=260B6942 FCtrl=80 FCnt=0 FOpts=[] 019764CE..141F mic=1323094012 (26 bytes)
2021-04-25 16:34:44.438 [S2E:DEBU] ::0 diid=1019 [ant#0] - next TX start ahead by 557ms423us
INFO: tx_start_delay=1495 (1495.500000) - (1497, bw_delay=1.500000, notch_delay=0.000000)
2021-04-25 16:34:44.976 [S2E:VERB] ::0 diid=1019 [ant#0] - starting TX in 19ms914us
2021-04-25 16:34:45.001 [S2E:INFO] TX ::0 diid=1019 [ant#0] - on air: 868.1MHz 16.0dBm ant#0(0) DR5 SF7/BW125 frame=6042690B2680000000AAEBEB..88F8AAD4
2021-04-25 16:34:45.093 [S2E:DEBU] Tx done diid=1019
2021-04-25 16:34:46.469 [SYN:ERRO] Repeated excessive clock drifts between MCU/SX130X#0 (6 retries): -23.3ppm (threshold 11.0ppm)
2021-04-25 16:34:51.719 [SYN:INFO] Time sync qualities: min=41 q90=60 max=96 (previous q90=100)
2021-04-25 16:35:06.088 [S2E:VERB] RX 868.3MHz DR5 SF7/BW125 snr=10.0 rssi=-48 xtime=0x2300001275D86B - updf mhdr=40 DevAddr=260B6942 FCtrl=80 FCnt=1 FOpts=[] 01B6056E..5115 mic=895455691 (26 bytes)
2021-04-25 16:35:06.517 [S2E:DEBU] ::0 diid=1020 [ant#0] - next TX start ahead by 566ms343us
INFO: tx_start_delay=1495 (1495.500000) - (1497, bw_delay=1.500000, notch_delay=0.000000)
2021-04-25 16:35:07.063 [S2E:VERB] ::0 diid=1020 [ant#0] - starting TX in 19ms913us
2021-04-25 16:35:07.088 [S2E:INFO] TX ::0 diid=1020 [ant#0] - on air: 868.3MHz 16.0dBm ant#0(0) DR5 SF7/BW125 frame=6042690B26800100002EE405..2E22A3C3
2021-04-25 16:35:07.181 [S2E:DEBU] Tx done diid=1020
2021-04-25 16:35:16.921 [SYN:INFO] MCU/SX130X drift stats: min: -10.5ppm q50: -22.9ppm q80: -26.3ppm max: -31.9ppm - threshold q90: -27.3ppm
2021-04-25 16:35:16.921 [SYN:INFO] Mean MCU drift vs SX130X#0: -22.6ppm
2021-04-25 16:35:28.188 [S2E:VERB] RX 868.5MHz DR5 SF7/BW125 snr=7.0 rssi=-45 xtime=0x23000013C6E0B3 - updf mhdr=40 DevAddr=260B6942 FCtrl=80 FCnt=2 FOpts=[] 01744CD5..0B56 mic=661257186 (26 bytes)
2021-04-25 16:35:28.616 [S2E:DEBU] ::0 diid=1021 [ant#0] - next TX start ahead by 555ms366us
INFO: tx_start_delay=1495 (1495.500000) - (1497, bw_delay=1.500000, notch_delay=0.000000)
2021-04-25 16:35:29.151 [S2E:VERB] ::0 diid=1021 [ant#0] - starting TX in 19ms915us
2021-04-25 16:35:29.176 [S2E:INFO] TX ::0 diid=1021 [ant#0] - on air: 868.5MHz 16.0dBm ant#0(0) DR5 SF7/BW125 frame=6042690B2680020000498C1A..F3624C90
2021-04-25 16:35:29.269 [S2E:DEBU] Tx done diid=1021
2021-04-25 16:35:50.268 [S2E:VERB] RX 867.1MHz DR5 SF7/BW125 snr=9.0 rssi=-48 xtime=0x2300001517E8F3 - updf mhdr=40 DevAddr=260B6942 FCtrl=80 FCnt=3 FOpts=[] 01216001..9651 mic=280507219 (26 bytes)
2021-04-25 16:35:54.725 [SYN:INFO] Time sync qualities: min=39 q90=60 max=96 (previous q90=100)
2021-04-25 16:35:58.925 [SYN:INFO] MCU/SX130X drift stats: min: -8.1ppm q50: -18.1ppm q80: -19.5ppm max: -26.7ppm - threshold q90: -23.8ppm
2021-04-25 16:35:58.925 [SYN:INFO] Mean MCU drift vs SX130X#0: -18.4ppm
2021-04-25 16:36:12.349 [S2E:VERB] RX 867.3MHz DR5 SF7/BW125 snr=9.8 rssi=-49 xtime=0x2300001668F153 - updf mhdr=40 DevAddr=260B6942 FCtrl=80 FCnt=4 FOpts=[] 01D818C9..3AC0 mic=-1076758132 (26 bytes)
2021-04-25 16:36:40.929 [SYN:INFO] MCU/SX130X drift stats: min: -11.0ppm q50: -15.2ppm q80: -16.7ppm max: -19.0ppm - threshold q90: -16.7ppm
2021-04-25 16:36:40.929 [SYN:INFO] Mean MCU drift vs SX130X#0: -15.3ppm
2021-04-25 16:36:56.681 [SYN:INFO] Time sync qualities: min=37 q90=58 max=58 (previous q90=100)
My interpretation is that there seems to be two issues:
- Some uplinks are dropped before they reach the application
- All of the uplinks that do reach the application trigger a downlink, which is not sustainable
I’m at a loss as to what I’m doing wrong, so any help would be greatly appreciated
Thank you!