Devices suddenly ADR'ing to SF12

With my latest paxcounter v1.4.2.software i see a strange effect: after a while of operation nodes suddenly start stepwise climbing SF to 12.

I triple checked that ADR is off on the node. And it didn’t modify anything in the LoRa/Lmic part of the software for months, since it was running stable.

Any ideas here what’s going on here?

My suggestion would be that lmic is missing the downlink message after a linkcheck. I found that lmic can easily be broken so downlink is no longer working.

Thanks for the hint, sounds reasonable.
How can i check if linkcheck is on or off?
And should i switch it off?

You’re right. I printed out event messages from lmic and see “Link dead” and “rejoin failed”.
I think this must be a side effect of one of the last changes in my paxcounter software. I have now clue where to look :frowning:

[I][lorawan.cpp:214] onEvent(): EV_TX COMPLETE
135726748: engineUpdate, opmode=0x900
[I][cyclic.cpp:20] doHomework(): Measured Voltage: 4210mV
[I][cyclic.cpp:20] doHomework(): Measured Voltage: 4208mV
[I][senddata.cpp:18] SendData(): 4 bytes enqueued to send on LoRa
[I][senddata.cpp:24] SendData(): 4 bytes enqueued to send on SPI
[I][senddata.cpp:31] SendData(): Counter cleared
139359646: engineUpdate, opmode=0x908
139359657: Uplink data pending
139359660: Considering band 0, which is available at 135073657
139359691: Considering band 2, which is available at 1266243
139360027: Considering band 3, which is available at 0
139360332: No channel found in band 3
139360543: Considering band 0, which is available at 135073657
139360890: Considering band 2, which is available at 1266243
139361228: No channel found in band 2
139361438: Considering band 0, which is available at 135073657
139361785: Airtime available at 135073657 (channel duty limit)
139362132: Airtime available at 135963403 (global duty limit)
139362474: Ready for uplink
139362661: Updating info for TX at 139359657, airtime will be 3216. Setting available time for band 0 to 142575657
139363285: TXMODE, freq=867700000, len=17, SF=7, BW=125, CR=4/5, IH=0
[I][senddata.cpp:91] processSendBuffer(): 4 bytes sent to LORA
[I][senddata.cpp:99] processSendBuffer(): 4 bytes sent to SPI
139366518: irq: dio: 0x0 flags: 0x8
139366535: Scheduled job 0x3ffcdb48, cb 0x400d4f08 ASAP
139366580: Running job 0x3ffcdb48, cb 0x400d4f08, deadline 0
139366680: Scheduled job 0x3ffcdb48, cb 0x400d4d40 at 139428379
139428392: Running job 0x3ffcdb48, cb 0x400d4d40, deadline 139428379
139428506: RXMODE_SINGLE, freq=867700000, SF=7, BW=125, CR=4/5, IH=0
139430080: irq: dio: 0x1 flags: 0x80
139430093: Scheduled job 0x3ffcdb48, cb 0x400d5fcc ASAP
139430142: Running job 0x3ffcdb48, cb 0x400d5fcc, deadline 0
139430243: Scheduled job 0x3ffcdb48, cb 0x400d4d90 at 139490623
139490642: Running job 0x3ffcdb48, cb 0x400d4d90, deadline 139490623
139490749: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
139494392: irq: dio: 0x1 flags: 0x80
139494405: Scheduled job 0x3ffcdb48, cb 0x400d5ffc ASAP
139494455: Running job 0x3ffcdb48, cb 0x400d5ffc, deadline 0
[I][lorawan.cpp:214] onEvent(): EV_TX COMPLETE
139494811: engineUpdate, opmode=0x900
[I][lorawan.cpp:214] onEvent(): EV_LINK DEAD
139495271: engineUpdate, opmode=0x1920
139495494: Uplink join pending
139495668: Considering band 0, which is available at 142575657
139496015: Considering band 1, which is available at 135912132
139496362: Considering band 2, which is available at 1266243
139496698: Considering band 3, which is available at 0
139497003: No channel found in band 3
139497214: Considering band 0, which is available at 142575657
139497561: Considering band 1, which is available at 135912132
139497908: Considering band 2, which is available at 1266243
139498244: No channel found in band 2
139498456: Considering band 0, which is available at 142575657
139498803: Considering band 1, which is available at 135912132
139499151: Airtime available at 135912132 (channel duty limit)
139499498: Airtime available at 139804781 (global duty limit)
139499839: Uplink delayed until 139804781
139500073: Scheduled job 0x3ffcdb48, cb 0x400d5a34 at 139804656
139804705: Running job 0x3ffcdb48, cb 0x400d5a34, deadline 139804656
139804718: engineUpdate, opmode=0x1120
139804722: Uplink join pending
139804789: Airtime available at 135912132 (previously determined)
139805153: Airtime available at 139804781 (global duty limit)
139805495: Ready for uplink
139805684: Updating info for TX at 139804721, airtime will be 7072. Setting available time for band 1 to 140511921
139806306: TXMODE, freq=868100000, len=23, SF=8, BW=125, CR=4/5, IH=0
139813393: irq: dio: 0x0 flags: 0x8
139813410: Scheduled job 0x3ffcdb48, cb 0x400d4f24 ASAP
139813455: Running job 0x3ffcdb48, cb 0x400d4f24, deadline 0
139813554: Scheduled job 0x3ffcdb48, cb 0x400d4d4c at 140122886
140122892: Running job 0x3ffcdb48, cb 0x400d4d4c, deadline 140122886
140123013: RXMODE_SINGLE, freq=868100000, SF=8, BW=125, CR=4/5, IH=0
140129830: irq: dio: 0x1 flags: 0x80
140129843: Scheduled job 0x3ffcdb48, cb 0x400d59e8 ASAP
140129892: Running job 0x3ffcdb48, cb 0x400d59e8, deadline 0
140129994: Scheduled job 0x3ffcdb48, cb 0x400d4da0 at 140184938
140184955: Running job 0x3ffcdb48, cb 0x400d4da0, deadline 140184938
140185065: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
140193830: irq: dio: 0x1 flags: 0x80
140193843: Scheduled job 0x3ffcdb48, cb 0x400d5a10 ASAP
140193892: Running job 0x3ffcdb48, cb 0x400d5a10, deadline 0
[I][lorawan.cpp:214] onEvent(): EV_REJOIN FAILED
140194259: engineUpdate, opmode=0x1800
[I][cyclic.cpp:20] doHomework(): Measured Voltage: 4208mV
[I][cyclic.cpp:20] doHomework(): Measured Voltage: 4208mV
[I][senddata.cpp:18] SendData(): 4 bytes enqueued to send on LoRa
[I][senddata.cpp:24] SendData(): 4 bytes enqueued to send on SPI
[I][senddata.cpp:31] SendData(): Counter cleared
143117709: engineUpdate, opmode=0x1808
143117719: Uplink data pending
143117722: Considering band 0, which is available at 142575657
143117759: Considering band 1, which is available at 140511921
143118106: Considering band 2, which is available at 1266243
143118442: Considering band 3, which is available at 0
143118747: No channel found in band 3
143118958: Considering band 0, which is available at 142575657
143119305: Considering band 1, which is available at 140511921
143119652: Considering band 2, which is available at 1266243
143119988: No channel found in band 2
143120200: Considering band 0, which is available at 142575657
143120547: Considering band 1, which is available at 140511921
143120895: Airtime available at 140511921 (channel duty limit)
143121242: Ready for uplink
143121430: Updating info for TX at 143117719, airtime will be 5792. Setting available time for band 1 to 143696919
143122054: TXMODE, freq=868300000, len=17, SF=8, BW=125, CR=4/5, IH=0
[I][senddata.cpp:91] processSendBuffer(): 4 bytes sent to LORA
[I][senddata.cpp:99] processSendBuffer(): 4 bytes sent to SPI
143127893: irq: dio: 0x0 flags: 0x8
143127910: Scheduled job 0x3ffcdb48, cb 0x400d4f08 ASAP
143127955: Running job 0x3ffcdb48, cb 0x400d4f08, deadline 0
143128055: Scheduled job 0x3ffcdb48, cb 0x400d4d40 at 143189882
143189892: Running job 0x3ffcdb48, cb 0x400d4d40, deadline 143189882
143190009: RXMODE_SINGLE, freq=868300000, SF=8, BW=125, CR=4/5, IH=0
143191830: irq: dio: 0x1 flags: 0x80
143191842: Scheduled job 0x3ffcdb48, cb 0x400d5fcc ASAP
143191892: Running job 0x3ffcdb48, cb 0x400d5fcc, deadline 0
143191993: Scheduled job 0x3ffcdb48, cb 0x400d4d90 at 143251998
143252017: Running job 0x3ffcdb48, cb 0x400d4d90, deadline 143251998
143252125: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
143255768: irq: dio: 0x1 flags: 0x80
143255782: Scheduled job 0x3ffcdb48, cb 0x400d5ffc ASAP
143255830: Running job 0x3ffcdb48, cb 0x400d5ffc, deadline 0
[I][lorawan.cpp:214] onEvent(): EV_TX COMPLETE
143256187: engineUpdate, opmode=0x1900

Meanwhile i found out: The problem with “dead links” only occurs, if ADR is set to off.
I’m using the below code sequence, triggered by Lmic event “EV_JOINED”, is this the correct way? Or should i add a LMIC_setLinkCheckMode(0) if ADR is set to 0 = off?

  case EV_JOINED:

    strcpy_P(buff, PSTR("JOINED"));
    sprintf(display_line6, " "); // clear previous lmic status

    // set data rate adaptation
    LMIC_setAdrMode(cfg.adrmode);
    // Set data rate and transmit power (note: txpower seems to be ignored by
    // the library)
    switch_lora(cfg.lorasf, cfg.txpower);

    // show effective LoRa parameters after join
    ESP_LOGI(TAG, "ADR=%d, SF=%d, TXPOWER=%d", cfg.adrmode, cfg.lorasf,
             cfg.txpower);
    break;

Allright, here is what happenes here:
If ADR is set to on, there are cyclic downlinks from the network to the node, resetting the counter which LMIC uses to validate link.
If ADR is set to off, and there a no user downlinks, after a while LMIC link validate counter reaches “link dead” level. Then LMIC lowers datarate.

So if we use LMIC link check validation, we need continous cyclic downlinks.

Solution: disable lmic link check validation after join.

1 Like