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