@bns I tested the updated code today but the problem persists. The device sends data once when I play the code onto the device, then it (seemingly) enters deep sleep, and does not send any data anymore after (it still prints them out to the serial monitor, they just do not appear in the live data of my application).
Looking at the serial monitor though, the device prints out data, goes to sleep for 30 seconds (as defined), and then wakes up to send data again, before going back to sleep again. Below you can see what the serial monitor prints out.
15:54:41.779 -> going to sleep
15:55:11.754 -> ESP-ROM:esp32s3-20210327
15:55:11.754 -> Build:Mar 27 2021
15:55:11.754 -> rst:0x5 (DSLEEP),boot:0x29 (SPI_FAST_FLASH_BOOT)
15:55:11.754 -> pro cpu reset by JTAG
15:55:11.754 -> SPIWP:0xee
15:55:11.754 -> mode:DIO, clock div:1
15:55:11.754 -> load:0x3fce3808,len:0x43c
15:55:11.786 -> load:0x403c9700,len:0xbec
15:55:11.786 -> load:0x403cc700,len:0x2a3c
15:55:11.786 -> SHA-256 comparison failed:
15:55:11.786 -> Calculated: dcde8d8a4817d9bf5d5d69a7247667264e4e10ac7493514868b61f5aa6146539
15:55:11.786 -> Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
15:55:11.786 -> Attempting to boot anyway...
15:55:11.786 -> entry 0x403c98d8
15:55:12.215 -> temperature: 22.55 | humidity: 72.50
15:55:12.215 -> confirmed uplink sending ...
15:55:12.248 -> sent data
15:55:12.248 -> enter sleep state. zzz
15:55:12.248 -> going to sleep
However, in TTN, I cannot see the new data. There, I only get data once (when the code is played to the device or when I hit the reset button), and then never again.
I tried adding a delay before changing to the sleep state in case the time is too short for sending, but that does not work. Going into light sleep instead of deep sleep does not fix the issue either. What I did notice though is that, as of right now, I only set the boolean for the sent message to true just like that, instead of checking if LoRaWAN.send() was actually successful or not. Also, I feel that something in the LoRaWAN_APP.h library bites itself with the esp_ commands.
Below is what I found regarding ESP in the LoRaWAN library:
For void LoRaWanClass::generateDeveuiByChipID()
(line 483), there is
#if defined(ESP_PLATFORM)
uint64_t id = getID();
uniqueId[0]=(uint32_t)(id>>32);
uniqueId[1]=(uint32_t)id;
#endif
In line 678, there is #ifndef ESP_PLATFORM
, which apparently skips join when the saved network info is okay. The header file for the library also calls the libraries ESP32_Mcu.h
and ESP32_LoRaWan_102.h
. There is a cross-call to the esp_sleep.h
library, but there I do not find anything that could cause issues with LoRaWAN.
Do you have any idea why this happens and how I could fix this issue?
Thank you in advance for your reply!