JackGruber / ESP32-LMIC-DeepSleep-example

31 stars 6 forks source link

Save keys to EEPROM once #8

Open Kevinvincentals opened 7 months ago

Kevinvincentals commented 7 months ago

Hi Jack! Thanks for sharing this. I've pulled my hair out for ages to have Lora working correctly with my ESP32 deep sleep. This fixed it!

I am however interested in saving the keys to EEPROM, and reading them from there. In your blog post, you wrote that is has a very limited lifespan - And I indeed understand that, so I am open for other ideas.

We are developing a edge device that will be set out in different areas. Battery life is VERY important for us, and thus if at any point the device should restart and do a join procedure, that would kill the battery completly.

I've tried different approaches to implement it, but I simply cannot get it working. Do you have an example or any other tips for how we can make it persistent with OTTA, and not use ABP?

cyberman54 commented 7 months ago

In my sleep mode application i don't rejoin after sleep, so no need to persist the keys. Saving last LMIC state to backep RTC RAM on ESP32. But may depend on sleep time and Lorawan Network Server Settings. Example (based on Jack's prior art): https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/lorawan.cpp#L515

Kevinvincentals commented 7 months ago

In my sleep mode application i don't rejoin after sleep, so no need to persist the keys. Saving last LMIC state to backep RTC RAM on ESP32. But may depend on sleep time and Lorawan Network Server Settings. Example (based on Jack's prior art): https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/lorawan.cpp#L515

So the issue is not reading from sleep. The issue is a hard reboot (where we take power from the ESP32). Does your example account for that?

cyberman54 commented 7 months ago

Not really. In my application the keys are compiled in the firmware and DEVEUI is derived of ESP32 MAC.