How to know if the board rebooted because of watchdog

I was able to write a small application for triggering the watchdog (from user-space), following one of the examples here in the forum. The board rebooted as expected. I’m going to run some software which could eventually cause the watchdog to trigger if something goes wrong. These software would run for long time, even during night. I’m wondering now if there is a way to know if the board rebooted because of the watchdog, for example reading some registers (or file). What I would like to do would be to run a script at reboot that checks if the last reboot was caused by the watchdog. Do you know if it is possible to do something like this?

Thank you.

Someone else will have to fill in details, but it is probably possible. This file will provide some abbreviated reason for the reboot:


You can also “cat” that file, it is human readable.

Btw, the file path may differ, I looked at that one on a TX2. I found it via:
find /sys -name reason

Thank you for your answer. I have tried to trigger the watchdog and then looking into the files you mentioned, after the reboot. Unfortunately nothing was there.

I do not know enough about the internal workings of the “/sys” “reason” file, but someone familiar with this can probably provide a way to find out what caused a watchdog reboot.

Should be able find some message from next boot log.

[0000.629] Reset reason: watchdog timeout