ESP32 + RFM95W + Deep Sleep

Hi everyone,

I’m trying to get a ESP32 with RFM95W working using Deep Sleep, but I’m not getting anywhere.

I found the following library https://github.com/ngraziano/lmicesp32 but even the examples are not working. Bellow the log:

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7944
entry 0x40080310
Starting
13164: Chip version : 0
13197: do job
13210: engineUpdate, opmode=0x808.
13220: Init Join loop : avail=13219 txend=22079
13227: Packet queued
13262: EV_JOINING
13541: engineUpdate, opmode=0xc.
21956: engineUpdate, opmode=0xc.
21973: Time on air : 61 ms
22002: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0

I never see the packet arriving on the gateway.

Does anyone here have a successful recipe on how to get the ESP32 + RFM95 in deep sleep and wake up periodically on Timer Wakeup?

Thanks in advance

Just a thought but is this to do with OTAA or ABP?

The ESP chips restart on wake up from sleep to the best of my knowledge. In the case of ABP you would have to stored the frame counter value in non-volatile memory to refresh your counter on reboot. With ABP the packet is ignored (possibly cloned) if the frame counter doesn’t increment with each TX.

This may not be the issue but then I am not a programmer or an expert by any stretch of one’s imagination!

G

Well, I don’t even get it to join with either OTAA or ABP.

Hi,

I am the person who make this modified version of LMIC. It is quite experimental but it is working for me.

The exemples directory need to be cleanup and adapt to my modification please take the src/main.cpp as base for your modification.

I see you get:

Starting
13164: Chip version : 0

The value version of “0” is not normal, it’s mean that the esp32 do not communicate with the sx127x, can you check the pin definition in main.cpp, in particular nss pin number.

// Pin mapping
const lmic_pinmap lmic_pins = {
    .nss = 18,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 14,
    .dio = {26, 33},
};

Hi,

I’m sure it’s not the pin mapping because i have another sketch (without deep sleep) with the exact same pin mapping and that works perfect.

And to be honestly, besides the keys, my sketch is 100% identical to the one in src/main.cpp

It has to be something else.

Eric,
I have just upload an update version with more log on “LMIC_DEBUG_LEVEL 2”, I also change LMIC.setClockError(MAX_CLOCK_ERROR * 50 / 100); in main.cpp because with all this log the timing is less accurate.

Can you give it a try and post logs. You should see on your gateway console the Join Request

I have test it and for reference I got the following logs.

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7944
entry 0x40080310
Starting
12839: Reg 1, Write 8, Read:f
12864: Chip version : 18
12874: Reg 1, Write 8, Read:8
12882: Reg 1, Write 8, Read:8
12890: Init Default Channel join?=1
12990: do job
13071: engineUpdate, opmode=0x8.
13241: Init Default Channel join?=1
13437: Init Join loop : avail=13435 txend=22009
13696: Scheduled job 0x3ffc278c ASAP

13902: Packet queued
14016: Running job 0x3ffc278c, deadline 0

14251: EV_JOINING
14531: engineUpdate, opmode=0xc.
14538: Uplink join pending
14672: Airtime available at 22009 (previously determined)
14988: Uplink delayed until 22009
15172: Scheduled job 0x3ffc278c, atRun 21884

21887: Running job 0x3ffc278c, deadline 21884

21892: engineUpdate, opmode=0xc.
21897: Uplink join pending
21901: Airtime available at 22009 (previously determined)
22090: Ready for uplink
22229: Time on air : 61 ms
22367: Updating info for TX at 21896, airtime will be 3856. Setting available ti                                                                             me for band 868300000 to 3877896
22983: Reg 1, Write 88, Read:88
23155: Reg 1, Write 89, Read:88
23329: Reg 1d, Write 72, Read:72
23507: Reg 1e, Write 74, Read:74
23686: Reg 26, Write 4, Read:4
23854: Reg 6, Write d9, Read:d9
24028: Reg 7, Write 13, Read:13
24201: Reg 8, Write 33, Read:33
24376: Reg a, Write 8, Read:8
24538: Reg 9, Write 8c, Read:8c
24712: Reg 4d, Write 84, Read:84
24890: Reg 39, Write 34, Read:34
25069: Reg 40, Write f0, Read:f0
25248: Reg 12, Write ff, Read:0
25423: Reg 11, Write f7, Read:f7
25601: Reg e, Write 0, Read:0
25764: Reg d, Write 0, Read:0
25927: Reg 22, Write 17, Read:17
26110: Reg 1, Write 8b, Read:89
26278: TXMODE, freq=868300000, len=23, SF=7, BW=125, CR=4/5, IH=0
29980: irq: dio: 0x0 flags: 0x8

29987: Reg 11, Write ff, Read:ff
29993: Reg 12, Write ff, Read:0
30000: Reg 1, Write 88, Read:88
30006: Scheduled job 0x3ffc278c ASAP

30199: Running job 0x3ffc278c, deadline 0

30434: SchedRx RX1/2.
30553: Rx delay : 4873 ms
30693: Scheduled job 0x3ffc278c, atRun 304471

304473: Running job 0x3ffc278c, deadline 304471

304479: Setup RX1 join accept.
304485: Reg 1, Write 88, Read:88
304492: Reg 1, Write 89, Read:88
304575: Reg 1d, Write 72, Read:72
304759: Reg 1e, Write 70, Read:70
304944: Reg 26, Write 4, Read:4
305117: Reg 6, Write d9, Read:d9
305297: Reg 7, Write 13, Read:13
305475: Reg 8, Write 33, Read:33
305654: Reg c, Write 21, Read:21
305833: Reg 23, Write 40, Read:40
306018: Reg 33, Write 67, Read:67
306202: Reg 1f, Write ff, Read:ff
306387: Reg 39, Write 34, Read:34
306571: Reg 40, Write c0, Read:c0
306756: Reg 12, Write ff, Read:0
306935: Reg 11, Write 3f, Read:3f
307121: Reg 1, Write 8e, Read:89
307297: RXMODE_SINGLE, freq=868300000, SF=7, BW=125, CR=4/5, IH=0
....

....
4359561: Running job 0x3ffc278c, deadline 0
4359805: Result RX1 join accept datalen=33.
4360044: Process join accept.
4360211: Init Default Channel join?=0
4360415: Setup channel, idx=3, freq=867100000
4360663: Setup channel, idx=4, freq=867300000
4360912: Setup channel, idx=5, freq=867500000
4361162: Setup channel, idx=6, freq=867700000
4361411: Setup channel, idx=7, freq=867900000
4361664: EV_JOINED
4361880: engineUpdate, opmode=0x808.
4361966: Uplink data pending
4362122: Band 0, available at 4360413 and last channel 2
4362431: Band 1, available at 4360413 and last channel 0
4362740: Band 2, available at 4360413 and last channel 7
4363050: Band 3, available at 0 and last channel 0
4363327: Considering band 0, which is available at 4360413
4363647: Considering band 3, which is available at 0
4363935: Considering channel 1 for band 3, set band = 1, drMap = 3f
4364303: Considering channel 2 for band 3, set band = 1, drMap = 3f
4364672: Considering channel 3 for band 3, set band = 0, drMap = 3f
4365041: Considering channel 4 for band 3, set band = 0, drMap = 3f
4365410: Considering channel 5 for band 3, set band = 0, drMap = 3f
4365779: Considering channel 6 for band 3, set band = 0, drMap = 3f
4366148: Considering channel 7 for band 3, set band = 0, drMap = 3f
4366517: Considering channel 0 for band 3, set band = 1, drMap = 3f
4366886: No channel found in band 3
4367081: Considering band 0, which is available at 4360413
4367401: Considering channel 3 for band 0, set band = 0, drMap = 3f
4367770: Airtime available at 4360413 (channel duty limit)
4368090: Ready for uplink
4368236: Time on air : 51 ms
4368389: Updating info for TX at 4361965, airtime will be 3216. Setting available time for band 867100000 to 7577965
4369026: Reg 1, Write 88, Read:88
4369209: Reg 1, Write 89, Read:88
4369394: Reg 1d, Write 72, Read:72
4369583: Reg 1e, Write 74, Read:74
4369773: Reg 26, Write 4, Read:4
4369952: Reg 6, Write d8, Read:d8
4370137: Reg 7, Write c6, Read:c6
4370321: Reg 8, Write 66, Read:66
4370506: Reg a, Write 8, Read:8
4370679: Reg 9, Write 8c, Read:8c
4370864: Reg 4d, Write 84, Read:84
4371053: Reg 39, Write 34, Read:34
4371243: Reg 40, Write f0, Read:f0
4371433: Reg 12, Write ff, Read:0
4371618: Reg 11, Write f7, Read:f7
4371807: Reg e, Write 0, Read:0
4371981: Reg d, Write 0, Read:0
4372155: Reg 22, Write 11, Read:11
4372348: Reg 1, Write 8b, Read:89
4372528: TXMODE, freq=867100000, len=17, SF=7, BW=125, CR=4/5, IH=0
4375575: Not using interupt trigger 0
4375581: irq: dio: 0x0 flags: 0x8

grazy,

here’s the log:

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7944 
entry 0x40080310
Starting
13167: Reg 1, Write 0, Read:0
13191: Chip version : 0
13200: Reg 1, Write 0, Read:0
13208: Reg 1, Write 0, Read:0
13216: Init Default Channel join?=1
13311: do job
13394: engineUpdate, opmode=0x8.
13563: Init Default Channel join?=1
13759: Init Join loop : avail=13757 txend=26518
14018: Scheduled job 0x3ffc278c ASAP

14224: Packet queued
14339: Running job 0x3ffc278c, deadline 0  

14573: EV_JOINING
14853: engineUpdate, opmode=0xc.
14860: Uplink join pending
14994: Airtime available at 26518 (previously determined)
15309: Uplink delayed until 26518
15494: Scheduled job 0x3ffc278c, atRun 26393

26394: Running job 0x3ffc278c, deadline 26393

26398: engineUpdate, opmode=0xc.
26404: Uplink join pending
26407: Airtime available at 26518 (previously determined)
26596: Ready for uplink
26736: Time on air : 61 ms
26874: Updating info for TX at 26402, airtime will be 3856. Setting available time for band 868500000 to 3882402
27489: Reg 1, Write 88, Read:0
27657: Reg 1, Write 1, Read:0
27819: Reg 1d, Write 72, Read:0
27992: Reg 1e, Write 74, Read:0
28166: Reg 26, Write 4, Read:0
28334: Reg 6, Write d9, Read:0
28502: Reg 7, Write 20, Read:0
28670: Reg 8, Write 0, Read:0
28834: Reg a, Write 8, Read:0
28996: Reg 9, Write 8c, Read:0
29165: Reg 4d, Write 4, Read:0
29332: Reg 39, Write 34, Read:0
29506: Reg 40, Write f0, Read:0
29679: Reg 12, Write ff, Read:0
29853: Reg 11, Write f7, Read:0
30026: Reg e, Write 0, Read:0
30189: Reg d, Write 0, Read:0
30352: Reg 22, Write 17, Read:0
30530: Reg 1, Write 3, Read:0
30687: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0

and here it stops, strange…

And just FYI, this is the ESP32 i’m using: https://www.aliexpress.com/item/Official-DOIT-ESP32-Development-Board-WiFi-Bluetooth-Ultra-Low-Power-Consumption-Dual-Core-ESP-32-ESP/32799253567.html?spm=a2g0s.9042311.0.0.27424c4d1q1AcS

Eric,

There is a problem with the communication with the RFM95W, all the value reread after write are 0.

It’s maybe due to the RST pin, in config.h file is CFG_sx1276_radio set to 1 ? (if not set to 1 the RST is inverted)
Or can you try to set RST pin to LMIC_UNUSED_PIN to disable hardware reset of RFM95.

The program stop because it wait for the RFM signal the finish of TX which never happen.

Is the other sketch which is working available online ?

Grazy,

the working code can be found here: https://pastebin.com/9dvnBa4i

Regarding your other questions, radio is set to 1 in config, for RST i tried both to no avail.

What I did notice is that at the very first beginning of the log right after “Starting” you are writing 3 times 8, reading back first f then 8. In my log in all tree writes it writes 0 and reads back 0, do not know if that has something to do with it.

See below for a part of the log of the working code:

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7944
entry 0x40080310
Starting...
RXMODE_RSSI
163154: engineUpdate, opmode=0x808
163181: Scheduled job 0x3ffc3a48, cb 0x400d35e4 ASAP
Sending uplink packet...
164456: Running job 0x3ffc3a48, cb 0x400d35e4, deadline 0
164467: EV_JOINING: -> Joining...
164757: engineUpdate, opmode=0xc
164766: Uplink join pending
164770: Airtime available at 230657 (previously determined)
164952: Uplink delayed until 230657
165153: Scheduled job 0x3ffc3a48, cb 0x400d35f0 at 230532
230532: Running job 0x3ffc3a48, cb 0x400d35f0, deadline 230532
230539: engineUpdate, opmode=0xc
230543: Uplink join pending
230547: Airtime available at 230657 (previously determined)
230861: Ready for uplink
231018: Updating info for TX at 230543, airtime will be 3856. Setting available time for band 0 to 4086543
231611: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0
235478: irq: dio: 0x0 flags: 0x8
235489: Scheduled job 0x3ffc3a48, cb 0x400d2260 ASAP
235496: Running job 0x3ffc3a48, cb 0x400d2260, deadline 0
235587: Scheduled job 0x3ffc3a48, cb 0x400d1f58 at 544843
544843: Running job 0x3ffc3a48, cb 0x400d1f58, deadline 544843
544970: RXMODE_SINGLE, freq=868500000, SF=7, BW=125, CR=4/5, IH=0
552514: irq: dio: 0x0 flags: 0x40
552533: Scheduled job 0x3ffc3a48, cb 0x400d3598 ASAP
552540: Running job 0x3ffc3a48, cb 0x400d3598, deadline 0
552648: Setup channel, idx=3, freq=867100000
552875: Setup channel, idx=4, freq=867300000
553124: Setup channel, idx=5, freq=867500000
553374: Setup channel, idx=6, freq=867700000
553624: Setup channel, idx=7, freq=867900000
553881: EV_JOINED
555211: engineUpdate, opmode=0x808
555220: Uplink data pending

Hi,
Yes the problem is with the reading of 0 instead of the actual value written. The firsts write to reg 1 is to put chip in sleep mode after init (it only modify the lowest bit of register). And when it write 8x to reg 1, it is to put it in LORA mode, it shou

I add more logs to try to understand the problem. And you can add more by un commenting the following code in hal.cpp (you can do it also in the original LMIC library to compare it is same)

In function hal_pin_nss enable the log:

Serial.println(val?">>":"<<");

In function hal_spi enable the log


      Serial.print(">");
      Serial.print(out, HEX);
      Serial.print("<");
      Serial.println(res, HEX);
      

I got the following logs :

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7944
entry 0x40080310
Starting
168697: Set reset pin 14 to 0
168786: Set reset pin 14 to float
<<
>1<0
>0<F
169113: Reg 1, Read:f
>>
<<
>81<0
>8<9
>>
<<
>1<0
>0<8
169134: Reg 1, Write 8, Readback:8
>>
<<
>42<0
>0<12
169247: Reg 42, Read:12
>>
169399: Chip version : 12
<<
>1<0
>0<8
169627: Reg 1, Read:8
>>
<<
>81<0
>8<8
>>
<<
>1<0
>0<8
169968: Reg 1, Write 8, Readback:8
>>
<<
>42<0
>0<12
>>
Manual read of chip version (should be 18) = 18<<
>1<0
>0<8
326799: Reg 1, Read:8
>>
<<
>81<0
>8<8
>>
<<
>1<0
>0<8
326816: Reg 1, Write 8, Readback:8
>>
326824: Init Default Channel join?=1
326943: do job
327031: engineUpdate, opmode=0x8.
327206: Init Default Channel join?=1
327407: Init Join loop : avail=327405 txend=358003
327682: Scheduled job 0x3ffc27a8 ASAP

You should get something similar.

I add the code to test communication, you can try the same code in working sketch in setup().

    // read chip version at init 
    hal_pin_nss(0);
    hal_spi(0x42);
    uint8_t val = hal_spi(0x00);
    hal_pin_nss(1);
    Serial.print("Manual read of chip version (should be 18) = ");
    Serial.print(val);

Grazy,

first of all thank you for your patience and collaboration, really appreciated.

New log:

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
Falling back to built-in command interpreter.
OK
>ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7944
entry 0x40080310
Starting
1337: Set reset pin 21 to 0
1427: Set reset pin 21 to float
<<
>1<0
>0<0
1754: Reg 1, Read:0
>>
<<
>81<0
>0<0
>>
<<
>1<0
>0<0
1774: Reg 1, Write 0, Readback:0
>>
<<
>42<0
>0<0
1849: Reg 42, Read:0
>>
1985: Chip version : 0
<<
>1<0
>0<0
2196: Reg 1, Read:0
>>
<<
>81<0
>0<0
>>
<<
>1<0
>0<0
2527: Reg 1, Write 0, Readback:0
>>
<<
>1<0
>0<0
2814: Reg 1, Read:0
>>
<<
>81<0
>0<0
>>
<<
>1<0
>0<0
3146: Reg 1, Write 0, Readback:0
>>
3348: Init Default Channel join?=1
3541: do job
3618: engineUpdate, opmode=0x8.
3782: Init Default Channel join?=1
3972: Init Join loop : avail=3970 txend=7754
4215: Scheduled job 0x3ffc247c ASAP
4410: Packet queued
4519: Running job 0x3ffc247c, deadline 0
4742: EV_JOINING
4833: engineUpdate, opmode=0xc.
5008: Uplink join pending
5148: Airtime available at 7754 (previously determined)
5452: Uplink delayed until 7754
5625: Scheduled job 0x3ffc247c, atRun 7629
7630: Running job 0x3ffc247c, deadline 7629
7635: engineUpdate, opmode=0xc.
7640: Uplink join pending
7643: Airtime available at 7754 (previously determined)
7795: Ready for uplink
7928: Time on air : 61 ms
8061: Updating info for TX at 7638, airtime will be 3856. Setting available time for band 868500000 to 3863638
<<
>81<0
>88<0
>>
<<
>1<0
>0<0
8869: Reg 1, Write 88, Readback:0
>>
<<
>1<0
>0<0
9162: Reg 1, Read:0
>>
<<
>81<0
>1<0
>>
<<
>1<0
>0<0
9493: Reg 1, Write 1, Readback:0
>>
<<
>9D<0
>72<0
>>
<<
>1D<0
>0<0
9905: Reg 1d, Write 72, Readback:0
>>
<<
>9E<0
>74<0
>>
<<
>1E<0
>0<0
10328: Reg 1e, Write 74, Readback:0
>>
<<
>A6<0
>4<0
>>
<<
>26<0
>0<0
10751: Reg 26, Write 4, Readback:0
>>
<<
>86<0
>D9<0
>>
<<
>6<0
>0<0
11169: Reg 6, Write d9, Readback:0
>>
<<
>87<0
>20<0
>>
<<
>7<0
>0<0
11587: Reg 7, Write 20, Readback:0
>>
<<
>88<0
>0<0
>>
<<
>8<0
>0<0
11999: Reg 8, Write 0, Readback:0
>>
<<
>A<0
>0<0
12293: Reg a, Read:0
>>
<<
>8A<0
>8<0
>>
<<
>A<0
>0<0
12628: Reg a, Write 8, Readback:0
>>
<<
>89<0
>8C<0
>>
<<
>9<0
>0<0
13041: Reg 9, Write 8c, Readback:0
>>
<<
>4D<0
>0<0
13345: Reg 4d, Read:0
>>
<<
>CD<0
>4<0
>>
<<
>4D<0
>0<0
13692: Reg 4d, Write 4, Readback:0
>>
<<
>B9<0
>34<0
>>
<<
>39<0
>0<0
14115: Reg 39, Write 34, Readback:0
>>
<<
>C0<0
>F0<0
>>
<<
>40<0
>0<0
14544: Reg 40, Write f0, Readback:0
>>
<<
>92<0
>FF<0
>>
<<
>12<0
>0<0
14972: Reg 12, Write ff, Readback:0
>>
<<
>91<0
>F7<0
>>
<<
>11<0
>0<0
15401: Reg 11, Write f7, Readback:0
>>
<<
>8E<0
>0<0
>>
<<
>E<0
>0<0
15819: Reg e, Write 0, Readback:0
>>
<<
>8D<0
>0<0
>>
<<
>D<0
>0<0
16226: Reg d, Write 0, Readback:0
>>
<<
>A2<0
>17<0
>>
<<
>22<0
>0<0
16643: Reg 22, Write 17, Readback:0
>>
<<
>80<0
>0<0
>BA<0
>1B<0
>1<0
>D0<0
>7E<0
>D5<0
>B3<0
>70<0
>65<0
>F4<0
>A9<0
>61<0
>8A<0
>59<0
>33<0
>0<0
>57<0
>C4<0
>80<0
>38<0
>CB<0
>D<0
>>
<<
>1<0
>0<0
17880: Reg 1, Read:0
>>
<<
>81<0
>3<0
>>
<<
>1<0
>0<0
18216: Reg 1, Write 3, Readback:0
>>
18423: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0

And the output with the extra added log to the working sketch:

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7944
entry 0x40080310
Starting...
Manual read of chip version (should be 18) = 0
RXMODE_RSSI
163136: engineUpdate, opmode=0x808
163162: Scheduled job 0x3ffc3a48, cb 0x400d3870 ASAP
Sending uplink packet...
164430: Running job 0x3ffc3a48, cb 0x400d3870, deadline 0
164440: EV_JOINING: -> Joining...
164727: engineUpdate, opmode=0xc
164735: Uplink join pending
164738: Airtime available at 350203 (previously determined)
164924: Uplink delayed until 350203
165125: Scheduled job 0x3ffc3a48, cb 0x400d387c at 350078
350078: Running job 0x3ffc3a48, cb 0x400d387c, deadline 350078
350082: engineUpdate, opmode=0xc
350086: Uplink join pending
350089: Airtime available at 350203 (previously determined)
350404: Ready for uplink
350561: Updating info for TX at 350086, airtime will be 3856. Setting available time for band 0 to 4206086
351154: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0
355021: irq: dio: 0x0 flags: 0x8
355030: Scheduled job 0x3ffc3a48, cb 0x400d24ec ASAP
355035: Running job 0x3ffc3a48, cb 0x400d24ec, deadline 0
355129: Scheduled job 0x3ffc3a48, cb 0x400d21e4 at 664386
664386: Running job 0x3ffc3a48, cb 0x400d21e4, deadline 664386
664512: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
672057: irq: dio: 0x0 flags: 0x40
672073: Scheduled job 0x3ffc3a48, cb 0x400d3824 ASAP
672078: Running job 0x3ffc3a48, cb 0x400d3824, deadline 0
672190: Setup channel, idx=3, freq=867100000
672417: Setup channel, idx=4, freq=867300000
672666: Setup channel, idx=5, freq=867500000
672915: Setup channel, idx=6, freq=867700000
673165: Setup channel, idx=7, freq=867900000
673422: EV_JOINED
674743: engineUpdate, opmode=0x808
674751: Uplink data pending
674755: Considering band 0, which is available at 672188
674760: Considering band 3, which is available at 0
675009: No channel found in band 3
675204: Considering band 0, which is available at 672188
675518: Airtime available at 672188 (channel duty limit)
675833: Ready for uplink
675994: Updating info for TX at 674751, airtime will be 2896. Setting available time for band 0 to 3570751
676580: TXMODE, freq=867100000, len=14, SF=7, BW=125, CR=4/5, IH=0
679487: irq: dio: 0x0 flags: 0x8
679496: Scheduled job 0x3ffc3a48, cb 0x400d24d0 ASAP
679501: Running job 0x3ffc3a48, cb 0x400d24d0, deadline 0
679593: Scheduled job 0x3ffc3a48, cb 0x400d21d8 at 741348
741348: Running job 0x3ffc3a48, cb 0x400d21d8, deadline 741348
741474: RXMODE_SINGLE, freq=867100000, SF=7, BW=125, CR=4/5, IH=0
743030: irq: dio: 0x1 flags: 0x80
743038: Scheduled job 0x3ffc3a48, cb 0x400d39fc ASAP
743042: Running job 0x3ffc3a48, cb 0x400d39fc, deadline 0
743141: Scheduled job 0x3ffc3a48, cb 0x400d2228 at 803592
803592: Running job 0x3ffc3a48, cb 0x400d2228, deadline 803592
803718: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
807322: irq: dio: 0x1 flags: 0x80
807330: Scheduled job 0x3ffc3a48, cb 0x400d3a2c ASAP
807334: Running job 0x3ffc3a48, cb 0x400d3a2c, deadline 0
807434: EV_TXCOMPLETE (includes waiting for RX windows)
807822: Scheduled job 0x3ffc247c, cb 0x400d1040 at 2682822
809054: engineUpdate, opmode=0x900
2682822: Running job 0x3ffc247c, cb 0x400d1040, deadline 2682822
2682828: engineUpdate, opmode=0x908
2682831: Uplink data pending
2682850: Considering band 0, which is available at 3570751
2683176: Considering band 1, which is available at 672188
2683496: Considering band 3, which is available at 0
2683789: No channel found in band 3
2683990: Considering band 0, which is available at 3570751
2684315: Considering band 1, which is available at 672188
2684635: Airtime available at 672188 (channel duty limit)
2684955: Airtime available at 1019268 (global duty limit)
2685276: Ready for uplink
2685438: Updating info for TX at 2682831, airtime will be 2896. Setting available time for band 1 to 2972431
2686039: TXMODE, freq=868100000, len=14, SF=7, BW=125, CR=4/5, IH=0
Sending uplink packet...
2688945: irq: dio: 0x0 flags: 0x8
2688958: Scheduled job 0x3ffc3a48, cb 0x400d24d0 ASAP
2688963: Running job 0x3ffc3a48, cb 0x400d24d0, deadline 0
2689071: Scheduled job 0x3ffc3a48, cb 0x400d21d8 at 2750806
2750806: Running job 0x3ffc3a48, cb 0x400d21d8, deadline 2750806
2750933: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
2752488: irq: dio: 0x1 flags: 0x80
2752496: Scheduled job 0x3ffc3a48, cb 0x400d39fc ASAP
2752500: Running job 0x3ffc3a48, cb 0x400d39fc, deadline 0
2752615: Scheduled job 0x3ffc3a48, cb 0x400d2228 at 2813050
2813050: Running job 0x3ffc3a48, cb 0x400d2228, deadline 2813050
2813176: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
2816780: irq: dio: 0x1 flags: 0x80
2816788: Scheduled job 0x3ffc3a48, cb 0x400d3a2c ASAP
2816792: Running job 0x3ffc3a48, cb 0x400d3a2c, deadline 0
2816908: EV_TXCOMPLETE (includes waiting for RX windows)
2817300: Scheduled job 0x3ffc247c, cb 0x400d1040 at 4692300
2818848: engineUpdate, opmode=0x900
4692300: Running job 0x3ffc247c, cb 0x400d1040, deadline 4692300
4692306: engineUpdate, opmode=0x908
4692309: Uplink data pending
4692328: Considering band 0, which is available at 3570751
4692654: Considering band 1, which is available at 2972431
4692980: Considering band 2, which is available at 672188
4693300: Considering band 3, which is available at 0
4693593: No channel found in band 3
4693793: Considering band 0, which is available at 3570751
4694119: Considering band 1, which is available at 2972431
4694444: Considering band 2, which is available at 672188
4694765: No channel found in band 2
4694965: Considering band 0, which is available at 3570751
4695291: Considering band 1, which is available at 2972431
4695616: Airtime available at 2972431 (channel duty limit)
4695942: Airtime available at 3037929 (global duty limit)
4696262: Ready for uplink
4696424: Updating info for TX at 4692309, airtime will be 2896. Setting available time for band 1 to 4981909
4697025: TXMODE, freq=868300000, len=14, SF=7, BW=125, CR=4/5, IH=0
Sending uplink packet...
4699931: irq: dio: 0x0 flags: 0x8
4699944: Scheduled job 0x3ffc3a48, cb 0x400d24d0 ASAP
4699949: Running job 0x3ffc3a48, cb 0x400d24d0, deadline 0
4700057: Scheduled job 0x3ffc3a48, cb 0x400d21d8 at 4761792
4761792: Running job 0x3ffc3a48, cb 0x400d21d8, deadline 4761792
4761918: RXMODE_SINGLE, freq=868300000, SF=7, BW=125, CR=4/5, IH=0
4763474: irq: dio: 0x1 flags: 0x80
4763482: Scheduled job 0x3ffc3a48, cb 0x400d39fc ASAP
4763486: Running job 0x3ffc3a48, cb 0x400d39fc, deadline 0
4763600: Scheduled job 0x3ffc3a48, cb 0x400d2228 at 4824036
4824036: Running job 0x3ffc3a48, cb 0x400d2228, deadline 4824036
4824162: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
4827766: irq: dio: 0x1 flags: 0x80
4827773: Scheduled job 0x3ffc3a48, cb 0x400d3a2c ASAP
4827778: Running job 0x3ffc3a48, cb 0x400d3a2c, deadline 0
4827897: EV_TXCOMPLETE (includes waiting for RX windows)
4828286: Scheduled job 0x3ffc247c, cb 0x400d1040 at 6703286
4829846: engineUpdate, opmode=0x900
6703286: Running job 0x3ffc247c, cb 0x400d1040, deadline 6703286
6703292: engineUpdate, opmode=0x908
6703296: Uplink data pending
6703315: Considering band 0, which is available at 3570751
6703640: Considering band 2, which is available at 672188
6703960: Considering band 3, which is available at 0
6704253: No channel found in band 3
6704454: Considering band 0, which is available at 3570751
6704780: Considering band 2, which is available at 672188
6705100: No channel found in band 2
6705300: Considering band 0, which is available at 3570751
6705626: Airtime available at 3570751 (channel duty limit)
6705951: Airtime available at 5110149 (global duty limit)
6706271: Ready for uplink
6706434: Updating info for TX at 6703296, airtime will be 2896. Setting available time for band 0 to 9599296
6707035: TXMODE, freq=867300000, len=14, SF=7, BW=125, CR=4/5, IH=0
Sending uplink packet...
6709941: irq: dio: 0x0 flags: 0x8
6709954: Scheduled job 0x3ffc3a48, cb 0x400d24d0 ASAP
6709959: Running job 0x3ffc3a48, cb 0x400d24d0, deadline 0
6710067: Scheduled job 0x3ffc3a48, cb 0x400d21d8 at 6771802
6771802: Running job 0x3ffc3a48, cb 0x400d21d8, deadline 6771802
6771928: RXMODE_SINGLE, freq=867300000, SF=7, BW=125, CR=4/5, IH=0
6773484: irq: dio: 0x1 flags: 0x80
6773492: Scheduled job 0x3ffc3a48, cb 0x400d39fc ASAP
6773496: Running job 0x3ffc3a48, cb 0x400d39fc, deadline 0
6773611: Scheduled job 0x3ffc3a48, cb 0x400d2228 at 6834046
6834046: Running job 0x3ffc3a48, cb 0x400d2228, deadline 6834046
6834172: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
6837776: irq: dio: 0x1 flags: 0x80
6837784: Scheduled job 0x3ffc3a48, cb 0x400d3a2c ASAP
6837789: Running job 0x3ffc3a48, cb 0x400d3a2c, deadline 0
6837903: EV_TXCOMPLETE (includes waiting for RX windows)
6838296: Scheduled job 0x3ffc247c, cb 0x400d1040 at 8713296
6839846: engineUpdate, opmode=0x900
8713296: Running job 0x3ffc247c, cb 0x400d1040, deadline 8713296
8713302: engineUpdate, opmode=0x908
8713305: Uplink data pending
8713324: Considering band 0, which is available at 9599296
8713650: Considering band 1, which is available at 4981909
8713976: Considering band 2, which is available at 672188
8714296: Considering band 3, which is available at 0
8714589: No channel found in band 3
8714789: Considering band 0, which is available at 9599296
8715115: Considering band 1, which is available at 4981909
8715440: Considering band 2, which is available at 672188
8715761: No channel found in band 2
8715961: Considering band 0, which is available at 9599296
8716287: Considering band 1, which is available at 4981909
8716612: Airtime available at 4981909 (channel duty limit)
8716938: Airtime available at 7063581 (global duty limit)
8717258: Ready for uplink
8717421: Updating info for TX at 8713305, airtime will be 2896. Setting available time for band 1 to 9002905
8718021: TXMODE, freq=868500000, len=14, SF=7, BW=125, CR=4/5, IH=0
Sending uplink packet...
8720927: irq: dio: 0x0 flags: 0x8
8720940: Scheduled job 0x3ffc3a48, cb 0x400d24d0 ASAP
8720945: Running job 0x3ffc3a48, cb 0x400d24d0, deadline 0
8721053: Scheduled job 0x3ffc3a48, cb 0x400d21d8 at 8782788
8782788: Running job 0x3ffc3a48, cb 0x400d21d8, deadline 8782788
8782914: RXMODE_SINGLE, freq=868500000, SF=7, BW=125, CR=4/5, IH=0
8784470: irq: dio: 0x1 flags: 0x80
8784478: Scheduled job 0x3ffc3a48, cb 0x400d39fc ASAP
8784482: Running job 0x3ffc3a48, cb 0x400d39fc, deadline 0
8784597: Scheduled job 0x3ffc3a48, cb 0x400d2228 at 8845032
8845032: Running job 0x3ffc3a48, cb 0x400d2228, deadline 8845032
8845159: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
8848762: irq: dio: 0x1 flags: 0x80
8848770: Scheduled job 0x3ffc3a48, cb 0x400d3a2c ASAP
8848774: Running job 0x3ffc3a48, cb 0x400d3a2c, deadline 0
8848890: EV_TXCOMPLETE (includes waiting for RX windows)
8849283: Scheduled job 0x3ffc247c, cb 0x400d1040 at 10724282
8850846: engineUpdate, opmode=0x900
10724282: Running job 0x3ffc247c, cb 0x400d1040, deadline 10724282
10724288: engineUpdate, opmode=0x908
10724292: Uplink data pending
10724333: Considering band 0, which is available at 9599296
10724664: Considering band 1, which is available at 9002905
10724995: Considering band 2, which is available at 672188
10725320: Considering band 3, which is available at 0
10725619: No channel found in band 3
10725825: Considering band 0, which is available at 9599296
10726156: Considering band 1, which is available at 9002905
10726487: Considering band 2, which is available at 672188
10726812: No channel found in band 2
10727018: Considering band 0, which is available at 9599296
10727349: Considering band 1, which is available at 9002905
10727680: Airtime available at 9002905 (channel duty limit)
10728011: Airtime available at 9105630 (global duty limit)
10728337: Ready for uplink
10728505: Updating info for TX at 10724292, airtime will be 2896. Setting available time for band 1 to 11013892
10729121: TXMODE, freq=868100000, len=14, SF=7, BW=125, CR=4/5, IH=0
Sending uplink packet...
10732028: irq: dio: 0x0 flags: 0x8
10732041: Scheduled job 0x3ffc3a48, cb 0x400d24d0 ASAP
10732046: Running job 0x3ffc3a48, cb 0x400d24d0, deadline 0
10732170: Scheduled job 0x3ffc3a48, cb 0x400d21d8 at 10793889
10793889: Running job 0x3ffc3a48, cb 0x400d21d8, deadline 10793889
10794015: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
10795570: irq: dio: 0x1 flags: 0x80
10795579: Scheduled job 0x3ffc3a48, cb 0x400d39fc ASAP
10795583: Running job 0x3ffc3a48, cb 0x400d39fc, deadline 0
10795714: Scheduled job 0x3ffc3a48, cb 0x400d2228 at 10856133
10856133: Running job 0x3ffc3a48, cb 0x400d2228, deadline 10856133
10856259: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
10859863: irq: dio: 0x1 flags: 0x80
10859871: Scheduled job 0x3ffc3a48, cb 0x400d3a2c ASAP
10859875: Running job 0x3ffc3a48, cb 0x400d3a2c, deadline 0
10860007: EV_TXCOMPLETE (includes waiting for RX windows)
10860405: Scheduled job 0x3ffc247c, cb 0x400d1040 at 12735405
10861970: engineUpdate, opmode=0x900

In your log it says :

It should be pin 14 like it is define in your working sketch (https://pastebin.com/9dvnBa4i)
Can you check again this pin number and if is not define in two place.
And can you verify it is not modified with some trace in setup at different point like this:

Serial.print("RST pin: ");
Serial.println(lmic_pins.rst, DEC);

And for the working sketch, can you move

 // read chip version at init 
    hal_pin_nss(0);
    hal_spi(0x42);
...

after

// LMIC init
os_init();

because we get 0 and it is not normal.

Result of the changes to the working sketch, now the chip version returns 18:

rst:0x10 (RTCWDT_RTC_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7944
entry 0x40080310
Starting...
RXMODE_RSSI
Manual read of chip version (should be 18) = 18
163159: engineUpdate, opmode=0x808
163185: Scheduled job 0x3ffc3a48, cb 0x400d3870 ASAP
Sending uplink packet...
164597: Running job 0x3ffc3a48, cb 0x400d3870, deadline 0
164606: EV_JOINING: -> Joining...
164894: engineUpdate, opmode=0xc
164902: Uplink join pending
164905: Airtime available at 644459 (previously determined)
165091: Uplink delayed until 644459
165292: Scheduled job 0x3ffc3a48, cb 0x400d387c at 644334
644334: Running job 0x3ffc3a48, cb 0x400d387c, deadline 644334
644338: engineUpdate, opmode=0xc
644342: Uplink join pending
644345: Airtime available at 644459 (previously determined)
644660: Ready for uplink
644817: Updating info for TX at 644342, airtime will be 3856. Setting available time for band 0 to 4500342
645410: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0
649277: irq: dio: 0x0 flags: 0x8
649287: Scheduled job 0x3ffc3a48, cb 0x400d24ec ASAP
649292: Running job 0x3ffc3a48, cb 0x400d24ec, deadline 0
649386: Scheduled job 0x3ffc3a48, cb 0x400d21e4 at 958642
958642: Running job 0x3ffc3a48, cb 0x400d21e4, deadline 958642
958769: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
966311: irq: dio: 0x0 flags: 0x40
966328: Scheduled job 0x3ffc3a48, cb 0x400d3824 ASAP
966333: Running job 0x3ffc3a48, cb 0x400d3824, deadline 0
966444: Setup channel, idx=3, freq=867100000
966672: Setup channel, idx=4, freq=867300000
966921: Setup channel, idx=5, freq=867500000
967170: Setup channel, idx=6, freq=867700000
967420: Setup channel, idx=7, freq=867900000
967677: EV_JOINED
969004: engineUpdate, opmode=0x808
969012: Uplink data pending
969016: Considering band 0, which is available at 966443
969021: Considering band 3, which is available at 0
969270: No channel found in band 3
969465: Considering band 0, which is available at 966443
969779: Airtime available at 966443 (channel duty limit)
970094: Ready for uplink
970255: Updating info for TX at 969012, airtime will be 2896. Setting available time for band 0 to 3865012
970841: TXMODE, freq=867100000, len=14, SF=7, BW=125, CR=4/5, IH=0
973748: irq: dio: 0x0 flags: 0x8
973757: Scheduled job 0x3ffc3a48, cb 0x400d24d0 ASAP
973762: Running job 0x3ffc3a48, cb 0x400d24d0, deadline 0
973854: Scheduled job 0x3ffc3a48, cb 0x400d21d8 at 1035609
1035609: Running job 0x3ffc3a48, cb 0x400d21d8, deadline 1035609
1035735: RXMODE_SINGLE, freq=867100000, SF=7, BW=125, CR=4/5, IH=0
1037291: irq: dio: 0x1 flags: 0x80
1037299: Scheduled job 0x3ffc3a48, cb 0x400d39fc ASAP
1037303: Running job 0x3ffc3a48, cb 0x400d39fc, deadline 0
1037418: Scheduled job 0x3ffc3a48, cb 0x400d2228 at 1097853
1097853: Running job 0x3ffc3a48, cb 0x400d2228, deadline 1097853
1097980: RXMODE_SINGLE, freq=869525000, SF=9, BW=125, CR=4/5, IH=0
1101583: irq: dio: 0x1 flags: 0x80
1101591: Scheduled job 0x3ffc3a48, cb 0x400d3a2c ASAP
1101596: Running job 0x3ffc3a48, cb 0x400d3a2c, deadline 0
1101712: EV_TXCOMPLETE (includes waiting for RX windows)
1102106: Scheduled job 0x3ffc247c, cb 0x400d1040 at 2977105
1103346: engineUpdate, opmode=0x900

And here with your requested changes, reset pin stays all the time 14 (sorry for the 21, i tried another pin just to ensure 14 was not the cause, changed it bak to 14 now).
Chip version read in setup still returns 0 though as opposite to the working sketch where it returns 18:

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7944
entry 0x40080310
Starting
RST pin at begin Setup: 14
1341: Set reset pin 14 to 0
1432: Set reset pin 14 to float
<<
>1<0
>0<0
1760: Reg 1, Read:0
>>
<<
>81<0
>0<0
>>
<<
>1<0
>0<0
1781: Reg 1, Write 0, Readback:0
>>
<<
>42<0
>0<0
1863: Reg 42, Read:0
>>
1999: Chip version : 0
<<
>1<0
>0<0
2210: Reg 1, Read:0
>>
<<
>81<0
>0<0
>>
<<
>1<0
>0<0
2541: Reg 1, Write 0, Readback:0
>>
RST pin after os_init(): 14
<<
>42<0
>0<0
>>
Manual read of chip version (should be 18) = 0<<
>1<0
>0<0
3350: Reg 1, Read:0
>>
<<
>81<0
>0<0
>>
<<
>1<0
>0<0
3680: Reg 1, Write 0, Readback:0
>>
3884: Init Default Channel join?=1
RST pin after LMIC.reset(): 14
4247: do job
4326: engineUpdate, opmode=0x8.
4490: Init Default Channel join?=1
4680: Init Join loop : avail=4679 txend=12837
4929: Scheduled job 0x3ffc2498 ASAP
5124: Packet queued
5234: Running job 0x3ffc2498, deadline 0
5456: EV_JOINING
5547: engineUpdate, opmode=0xc.
5722: Uplink join pending
5862: Airtime available at 12837 (previously determined)
6172: Uplink delayed until 12837
6351: Scheduled job 0x3ffc2498, atRun 12712
12713: Running job 0x3ffc2498, deadline 12712
12719: engineUpdate, opmode=0xc.
12724: Uplink join pending
12728: Airtime available at 12837 (previously determined)
12911: Ready for uplink
13051: Time on air : 61 ms
13189: Updating info for TX at 12723, airtime will be 3856. Setting available time for band 868500000 to 3868723
<<
>81<0
>88<0
>>
<<
>1<0
>0<0
14007: Reg 1, Write 88, Readback:0
>>
<<
>1<0
>0<0
14305: Reg 1, Read:0
>>
<<
>81<0
>1<0
>>
<<
>1<0
>0<0
14642: Reg 1, Write 1, Readback:0
>>
<<
>9D<0
>72<0
>>
<<
>1D<0
>0<0
15059: Reg 1d, Write 72, Readback:0
>>
<<
>9E<0
>74<0
>>
<<
>1E<0
>0<0
15488: Reg 1e, Write 74, Readback:0
>>
<<
>A6<0
>4<0
>>
<<
>26<0
>0<0
15911: Reg 26, Write 4, Readback:0
>>
<<
>86<0
>D9<0
>>
<<
>6<0
>0<0
16329: Reg 6, Write d9, Readback:0
>>
<<
>87<0
>20<0
>>
<<
>7<0
>0<0
16747: Reg 7, Write 20, Readback:0
>>
<<
>88<0
>0<0
>>
<<
>8<0
>0<0
17159: Reg 8, Write 0, Readback:0
>>
<<
>A<0
>0<0
17452: Reg a, Read:0
>>
<<
>8A<0
>8<0
>>
<<
>A<0
>0<0
17788: Reg a, Write 8, Readback:0
>>
<<
>89<0
>8C<0
>>
<<
>9<0
>0<0
18201: Reg 9, Write 8c, Readback:0
>>
<<
>4D<0
>0<0
18504: Reg 4d, Read:0
>>
<<
>CD<0
>4<0
>>
<<
>4D<0
>0<0
18852: Reg 4d, Write 4, Readback:0
>>
<<
>B9<0
>34<0
>>
<<
>39<0
>0<0
19275: Reg 39, Write 34, Readback:0
>>
<<
>C0<0
>F0<0
>>
<<
>40<0
>0<0
19703: Reg 40, Write f0, Readback:0
>>
<<
>92<0
>FF<0
>>
<<
>12<0
>0<0
20132: Reg 12, Write ff, Readback:0
>>
<<
>91<0
>F7<0
>>
<<
>11<0
>0<0
20561: Reg 11, Write f7, Readback:0
>>
<<
>8E<0
>0<0
>>
<<
>E<0
>0<0
20978: Reg e, Write 0, Readback:0
>>
<<
>8D<0
>0<0
>>
<<
>D<0
>0<0
21385: Reg d, Write 0, Readback:0
>>
<<
>A2<0
>17<0
>>
<<
>22<0
>0<0
21803: Reg 22, Write 17, Readback:0
>>
<<
>80<0
>0<0
>BA<0
>1B<0
>1<0
>D0<0
>7E<0
>D5<0
>B3<0
>70<0
>65<0
>F4<0
>A9<0
>61<0
>8A<0
>59<0
>33<0
>0<0
>D6<0
>48<0
>12<0
>CB<0
>D3<0
>92<0
>>
<<
>1<0
>0<0
23046: Reg 1, Read:0
>>
<<
>81<0
>3<0
>>
<<
>1<0
>0<0
23382: Reg 1, Write 3, Readback:0
>>
23588: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0

Grazy,

i think i have found the problem, i included the library SSD1306 in platformio for the oled, once i removed that, it started working… Unbelievable

I will do some more testing…

Eric,

Good news because I had no more idea.
The library SSD1306 may mess with SPI.

I advise you to reduce the log level (comment the print of spi communication) and change LMIC_DEBUG_LEVEL to 1, it works better.

@grazy are you using your library in production?

I get random results.
The ESP32 stops waking up after a random number of sleepcycles.
I googled high and low, and most of the problems seems to be related to Rev 0 boards, though my ESP32 is Rev 1.

The longest i got it running was 1048 sleep cycles, then it stopped, only a hard reset gets it going again.

Any ideas on how to troubleshoot this?

Kind regards and a happy New Year,

Eric

Hi @EricVdB,

Sorry i am just using lora as a hobbyist. And my ESP32 consume too much in sleep state so I go back to arduino mini and rfm95 and i do not have active device with an esp32.

But for your problem maybe there is a bug in the calculation of the duty cycle (problem with signed and unsigned int). Do you try to wait for something like 19 hours (it is the time for OsTime type to overflow and go back to zero) ? If it is reworking after 19 hours or half of 19 hours, it is a problem with duty cycle calculation.

Did it stop in sleep ?
Can you make a debug version with activate wifi in main loop and try to send a signal to see if it is sleeping.
Or plug serial and add some log in main loop.

Oh, ok, I’ll try to get more logging.

The sleep time is 5 minutes.

Btw, during sleep with a BME280 sensor attached the consumption is 28µA
(I use a bare ESP32)

Greetz,
Eric

Ok bare ESP32 is the secret for low consumption :smiley:

1048 * 5 min is about 3 day … If i have time tomorrow, I can make a try with my heltec board and print some information on the LCD but it may be long to find the bug.