logo elektroda
logo elektroda
X
logo elektroda

Saving sensitive data before soft reset with OTA update for ESP32/ESP8266

Slawek K. 603 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20262329
    Slawek K.
    Level 35  
    Hi,

    I need to save in flash or eeprom some sensitive data necessary for the operation of the device after resuming operation after a reset. Unfortunately, the frequency of changing the values of the variables during operation does not allow me to use flash or eeprom on the fly because they would run out very quickly due to the limit of writes.
    Is it possible to monitor some kind of flag that would allow to dump data before soft reset ? this only applies to the situation when restarting after a firmware update via OTA, it does not apply to power off as the chip is powered from batteries.

    Best regards
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #3 20262443
    Slawek K.
    Level 35  
    Thanks for the idea. I don't want to extend the controller with more circuits. I want to use the capabilities of esp32 (if it has them) to detect the state before soft reset and save the data, the data is not much because it is just 3 variables of 4 bytes.

    Greetings
  • ADVERTISEMENT
  • Helpful post
    #4 20262487
    khoam
    Level 42  
    Slawek K. wrote:
    Is it possible to monitor some flag that would allow to dump data before soft reset ?
    .
    There is a function in the ESP32 esp_register_shutdown_handler () with which you can "plug in" your own function that will execute before the soft reset of the chip.
    Link .
  • #5 20266576
    Slawek K.
    Level 35  
    @khoam , thanks :) .

    Greetings
ADVERTISEMENT