Is there a way to persist an application reset reset through esp_restart?
Posted: Wed Oct 30, 2019 11:56 am
My application is deeply embedded and so I have a 'fault' mechanism that performs esp_restart if unusual conditions are detected. I would like to persist the reason for the fault (e.g. "too many connection attempts") through the restart so that it can be written to the flash filing system then uploaded on a future connection attempt. The reason not to write it to the FFS immediately is that some of the potentials faults themselves indicate potential problems with the file structure.
I've tried storing the fault code in the RTC RAM but it appears that esp_restart clears this area although fortunately it leaves the time untouched.
Is there any way to pass a value through esp_restart which can then be read back? I've considered writing to NVRAM but that's still a little heavyweight. It's _probably_ safe but I really don't want to rely on the state of the device at the point of the fault to be sufficient to do much more than write to a RAM/register location and then restart.
Any ideas? Thanks in advance.
I've tried storing the fault code in the RTC RAM but it appears that esp_restart clears this area although fortunately it leaves the time untouched.
Is there any way to pass a value through esp_restart which can then be read back? I've considered writing to NVRAM but that's still a little heavyweight. It's _probably_ safe but I really don't want to rely on the state of the device at the point of the fault to be sufficient to do much more than write to a RAM/register location and then restart.
Any ideas? Thanks in advance.