https://raspberrypi.github.io/pico-sdk- ... chdog.html
Code: Select all
watchdog_caused_reboot(void)
https://docs.micropython.org/en/v1.19/l ... e.WDT.html
Unless there's a memory location I can write data into that will survive a WDT reset, the only option I think I have left is to attempt to use a power supply sense input I have going into one of the ADC's.
Sounds good, but, the transient response looks something like this:
On a WDT reboot this input will retain its voltage. You'd think you could use this to distinguish between a normal power-up reset and a WDT reset. Not so simple.
The problem is that this circuit, while having a capacitor, was not designed for this purpose. It comes-up very quickly from zero. This gives me about less than 4 ms on power-up to understand that this is a power-up reset vs. a WDT event. Much beyond that point and everything looks the same.
This is complicated by the fact that I need to have a delay on initialization in order to allow for MicroPython to set things up properly. Not sure I can actually do anything (or enough) within 4 ms of power-up.
And then there's the scenario of when my code actually resets the board (firmware update). Once again, using this power sense input isn't likely to give me enough time to sort things out.
I am about to experiment with the idea of placing a value in, perhaps, the I2C or SPI registers and seeing what might survive reset (if anything). I am not using those ports at the moment (although I will have to on this board at some point).
I have another pin connected to a thermistor with a resistor in series (divider) into an ADC. No capacitor. We could manually add a small capacitor I suppose. Doing that to 1000 boards isn't something anyone would look forward to at all, particularly when there are no pads for the cap to solder to.
A software solution would definitely be best. The C API seems to be there. Any quick hacks to access it? At this stage getting into recompiling MicroPython becomes risky (almost anything is when you are talking about 1000 boards).
Thanks.