HI,
I'm trying to recognize the reason cause reboot with Watchdog in Linux. In details, I use iMX8MM and Yocto OS image.
It's have a watchdog hardware(and a watchdog SW) and it's working good. Now, I wanna know the reason of the last reboot. I use WIOF_GETBOOTSTATUE flag to read state. This is a statement:
if (ioctl(fd, WDIOC_GETBOOTSTATUS , &bootstatus) == 0) {
fprintf(stdout, "Last boot is caused by : %s\n",
(bootstatus != 0) ? "Watchdog" : "Power-On-Reset");
But with any case, I still receive one result: Power-On-Reset
Case 1: I wrote a application. In the first 5 sec, It will send a ping message to watchdog. From there, It's will no longer send anything. After 60s, my device is reboot. But then, I check WDIOC_GETBOOTSTATUS flag, I still receive: Power-On-Reset --> It should be Watchdog, right ?
Case 2: I unplug the power cable and plug it in again. And I get : Power-On-Reset --> Correctly.
Did I do the right thing? If not, what should I do ?
Thank you so much,
Toan