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
Hi Toan,
try with:
memtool -16 3039005c 1
I have the same need as you. In my case the result is always POR
Hi Toan
reset reason (source) can be found using SRC_SRSR register described in
sect.6.5.5.13 SRC Reset Status Register (SRC_SRSR)
i.MX 8M Mini Applications Processor Reference Manual
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi igorpadykov,
Thank you for your reply. As follow your guide, I'm trying to read SRSR which has address is
3039_0000h base + 5Ch offset = 3039_005Ch
This is my program:
#include <stdio.h>
int main(){
char ptr = *(char*)0x3039005C;
printf("%c\n", ptr);
return 0;
}
But I got:
Segmentation fault (core dumped)
Do you have any way to read it ?
Have a nice day !
for register read example one can look at memtool
memtool\test - imx-test - i.MX Driver Test Application Software
Best regards
igor
Hi igorpadykov,
I switched to iMX8MQ board. Then I execute:
$ ./memtool WDOG1.SRC_SRSR.*
SOC: i.MX8MQ
WDOG1 Addr:0x30280000
As you can see, It's only show address.
Hi igorpadykov,
I found memtool application in /units_test directory. Then I run:
$ ./memtool SRC_SRSR.*
SOC: i.MX8MM
Unknown SOC
Did I do the right way ?
As source code above, I guess that memtool supports imx8mq only.