imx6ul watchdog not stopping
Hi all,
I am using imx6ul and I am trying to use the watchdog.
I have used in my board's .h file
#define CONFIG_IMX_WATCHDOG
to enable the watchdog.
Then I go to /uboot_folder/drivers/watchdog/imx_watchdog.c and check what is done:
#ifdef CONFIG_IMX_WATCHDOG
void hw_watchdog_reset(void)
{
struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
writew(0x5555, &wdog->wsr);
writew(0xaaaa, &wdog->wsr);
}
void hw_watchdog_init(void)
{
struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
u16 timeout;
/*
* The timer watchdog can be set between
* 0.5 and 128 Seconds. If not defined
* in configuration file, sets 128 Seconds
*/
#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS
#define CONFIG_WATCHDOG_TIMEOUT_MSECS 128000
#endif
timeout = (CONFIG_WATCHDOG_TIMEOUT_MSECS / 500) - 1;
writew(WCR_WDZST | WCR_WDBG | WCR_WDE | WCR_WDT | WCR_SRS |
SET_WCR_WT(timeout), &wdog->wcr);
hw_watchdog_reset();
}
#endif
I then start my board which runs embedded linux, the board actually restarts after 128 seconds.
However, I try to kick the watchdog by using the following script:
while [ 1 ] ; do sleep 1; echo x > /dev/watchdog; done
I run this script, the watchdog replies
root@ccimx6ulstarter:~# ./script
watchdog watchdog0: watchdog did not stop!
watchdog watchdog0: watchdog did not stop!
......
......
......
watchdog watchdog0: watchdog did not stop!
watchdog watchdog0: watchdog did not stop!
U-Boot dub-2015.04-r5.4+ga397dea (Jan 13 2017 - 15:09:55)
CPU: Freescale i.MX6UL rev1.1 528 MHz (running at 396 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 40C
Reset cause: WDOG
I2C: ready
DRAM: 256 MiB
......
......
......
So despite the fact that I am kicking the watchdog, the watchdog restarts.
The same happens when I use command
watchdog -t 10 /dev/watchdog
The only way of making the system work is not using the WCR_WDE flag. When I do this, the watchdog does not start automatically, but I can start it with
echo V > /dev/watchdog
Then the watchdog starts and with my script I can kick it and when the script ends it restarts. However, I want the watchdog to start automatically with WCR_WDE flag.
How can I solve this problem?
Thanks
Hi Haris
WCR_WDE is a write one once only bit as described in
sect.57.7.1 Watchdog Control Register (WDOGx_WCR) i.MX6UL Reference Manual
http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6ULRM.pdf
So if it is set in uboot, it can not be changed in linux.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks for the reply,
however, if I do not enable the watchdog in the uboot, then if an error occurs during booting, the system won't restart. But if I do set it in uboot, then I can't stop it by kicking it. What should I do?
Hi,
Thanks for the quick reply.
I can enable it in linux by writing V to /dev/watchdog. This starts it.
However, if I don't enable it in uboot, then if the system fails during boot time, the watchdog doesn't restart the system. I do over the air updates and usually the root file system does not get updated correctly and so I need to start the watchdog in the bootloader. But I want to start it in the bootloader and be able to kick it from linux. How can I do that?
Thanks
Any news on that ? I'm also having the same issue...