11 years, 9 months ago.

Is a watchdog-reset different to a hardware-reset?

Hi all!

I've connected a RFM22 http://mbed.org/users/charly/notebook/rfm22/ module to my mbed to receive and display messages sent from another mbed. Works, but after some time (hours) the receiver stops and doesn't display new messages. Until I find the reason for the problem I added a watchdog to reset the mbed and start over again, if it doesn't receive a message within 5 minutes.

Now I observe following strange behavior:

When I do a hard-reset with the reset-button of the mbed it receives for minimum an hour or two without triggering the watchdog.

After the watchdog fires the first time, only some 3 to 10 messages are received and then it stops again. And so on: WD-Reset, max. 10 messages, WD-Reset, max. 10 Messages,....

It seems that the watchdog-reset does something different than the hard-reset. Is this true? What do I have to do to initialize everything like after a hard-reset?

I use this Watchdog-Library: http://mbed.org/users/WiredHome/code/Watchdog/

Here is a part of the log:

log

....
got message:13.03.2013 21:39 >Nr:33220: 10.8 11.3 23.9 22.6<
got message:13.03.2013 21:39 >Nr:33221: 10.8 11.3 23.9 22.6<
got message:13.03.2013 21:39 >Nr:33222: 10.8 11.3 23.9 22.7<
got message:13.03.2013 21:40 >Nr:33225: 10.8 11.3 23.9 22.6<
got message:13.03.2013 21:40 >Nr:33226: 10.9 11.3 23.9 22.6<
got message:13.03.2013 21:40 >Nr:33227: 10.9 11.4 23.9 22.6<
got message:13.03.2013 21:41 >Nr:33228: 10.9 11.4 23.9 22.6<
got message:13.03.2013 21:41 >Nr:33229: 10.9 11.4 23.9 22.6<
got message:13.03.2013 21:41 >Nr:33230: 10.9 11.4 23.9 22.6<
got message:13.03.2013 21:41 >Nr:33231: 10.9 11.4 23.9 22.6<
got message:13.03.2013 21:41 >Nr:33232: 10.9 11.4 23.9 22.6<
got message:13.03.2013 21:41 >Nr:33233: 10.9 11.4 23.9 22.6<
got message:13.03.2013 21:42 >Nr:33234: 10.9 11.4 23.9 22.6<
got message:13.03.2013 21:42 >Nr:33235: 10.9 11.4 23.9 22.6<
got message:13.03.2013 21:42 >Nr:33236: 11.0 11.4 23.9 22.6<
got message:13.03.2013 21:42 >Nr:33237: 11.0 11.4 23.9 22.6<
got message:13.03.2013 21:42 >Nr:33238: 11.0 11.4 23.9 22.6<
got message:13.03.2013 21:43 >Nr:33239: 11.0 11.4 23.9 22.6<
got message:13.03.2013 21:43 >Nr:33240: 11.0 11.4 23.9 22.6<
got message:13.03.2013 21:43 >Nr:33241: 11.1 11.4 23.9 22.6<
got message:13.03.2013 21:43 >Nr:33242: 11.1 11.4 23.9 22.6<
got message:13.03.2013 21:43 >Nr:33243: 11.1 11.4 23.9 22.6<
got message:13.03.2013 21:43 >Nr:33244: 11.1 11.5 23.9 22.6<
got message:13.03.2013 21:44 >Nr:33245: 11.1 11.5 23.8 22.6<
got message:13.03.2013 21:44 >Nr:33246: 11.1 11.5 23.8 22.6<
got message:13.03.2013 21:44 >Nr:33247: 11.1 11.5 23.8 22.6<
got message:13.03.2013 21:44 >Nr:33248: 11.1 11.5 23.8 22.6<
got message:13.03.2013 21:44 >Nr:33249: 11.1 11.5 23.8 22.6<
got message:13.03.2013 21:45 >Nr:33250: 11.1 11.6 23.8 22.6<
got message:13.03.2013 21:45 >Nr:33251: 11.1 11.5 23.8 22.6<
got message:13.03.2013 21:45 >Nr:33252: 11.1 11.6 23.8 22.5<
got message:13.03.2013 21:45 >Nr:33253: 11.1 11.6 23.8 22.5<
got message:13.03.2013 21:45 >Nr:33254: 11.2 11.6 23.8 22.5<
got message:13.03.2013 21:45 >Nr:33255: 11.2 11.6 23.8 22.5<
got message:13.03.2013 21:46 >Nr:33256: 11.2 11.6 23.8 22.5<
got message:13.03.2013 21:46 >Nr:33257: 11.2 11.6 23.8 22.5<
got message:13.03.2013 21:46 >Nr:33258: 11.2 11.6 23.8 22.5<
got message:13.03.2013 21:46 >Nr:33259: 11.2 11.6 23.8 22.5<

Connected to mbed
RF22-Receive-V3.2
I am receiving with address 2  ...

got message:13.03.2013 22:03 >Nr:33350: 11.9 12.4 23.4 22.2<
got message:13.03.2013 22:03 >Nr:33351: 12.0 12.4 23.4 22.2<
got message:13.03.2013 22:03 >Nr:33352: 12.0 12.4 23.4 22.2<
got message:13.03.2013 22:03 >Nr:33353: 12.0 12.4 23.4 22.2<
got message:13.03.2013 22:03 >Nr:33354: 12.0 12.4 23.4 22.2<
got message:13.03.2013 22:04 >Nr:33355: 12.0 12.4 23.4 22.2<
got message:13.03.2013 22:04 >Nr:33356: 12.0 12.4 23.4 22.1<
got message:13.03.2013 22:04 >Nr:33357: 12.0 12.4 23.4 22.2<
got message:13.03.2013 22:04 >Nr:33358: 12.1 12.4 23.4 22.2<
got message:13.03.2013 22:04 >Nr:33359: 12.1 12.4 23.4 22.2<
got message:13.03.2013 22:04 >Nr:33360: 12.1 12.4 23.4 22.1<
got message:13.03.2013 22:05 >Nr:33361: 12.1 12.5 23.4 22.2<
got message:13.03.2013 22:05 >Nr:33362: 12.1 12.5 23.4 22.2<

Connected to mbed
RF22-Receive-V3.2
Watchdog caused reset.
I am receiving with address 2  ...
got message:13.03.2013 22:10 >Nr:33391: 12.2 12.7 23.2 22.1<
got message:13.03.2013 22:10 >Nr:33392: 12.2 12.8 23.2 22.1<
got message:13.03.2013 22:10 >Nr:33393: 12.2 12.8 23.2 22.1<
got message:13.03.2013 22:11 >Nr:33394: 12.2 12.8 23.2 22.1<

Connected to mbed
RF22-Receive-V3.2
Watchdog caused reset.
I am receiving with address 2  ...
got message:13.03.2013 22:16 >Nr:33423: 12.4 13.0 23.2 22.0<
got message:13.03.2013 22:16 >Nr:33424: 12.4 13.0 23.2 21.9<
got message:13.03.2013 22:16 >Nr:33425: 12.4 13.0 23.2 21.9<
got message:13.03.2013 22:16 >Nr:33426: 12.4 13.0 23.1 22.0<

Connected to mbed
RF22-Receive-V3.2
Watchdog caused reset.
I am receiving with address 2  ...
got message:13.03.2013 22:22 >Nr:33455: 12.6 13.2 23.1 21.9<
got message:13.03.2013 22:22 >Nr:33456: 12.6 13.2 23.1 21.9<
got message:13.03.2013 22:22 >Nr:33457: 12.6 13.2 23.1 21.9<
got message:13.03.2013 22:22 >Nr:33458: 12.6 13.2 23.1 21.9<

Connected to mbed
RF22-Receive-V3.2
Watchdog caused reset.
I am receiving with address 2  ...
got message:13.03.2013 22:27 >Nr:33487: 12.8 13.4 22.9 21.8<
got message:13.03.2013 22:28 >Nr:33488: 12.8 13.4 22.9 21.8<
got message:13.03.2013 22:28 >Nr:33489: 12.8 13.4 22.9 21.8<
got message:13.03.2013 22:28 >Nr:33490: 12.8 13.5 22.9 21.8<

2 Answers

11 years, 9 months ago.

Watchdog resets only the target chip (e.g. LPC1768), while the reset button resets also the mbed interface chip and causes it to rescan the flash drive for new images. If you call mbed_reset() on WDT timeout, it might work better.

Accepted Answer

Hi Igor! I tried adding a mbed_reset() to the watchdog-reset, but then it resets forever as soon as the watchdog fires the first time!

code-snipet

    ...
    if (wd.WatchdogCausedReset()) {
        pc.printf("Watchdog caused reset.\r\n");
        lcd.setLine(1,"Watchdog fired!");
        mbed_reset(); 
    }
    wd.Configure(5*60);       // sets the watchdog timeout interval in seconds
    ...

It seems that I have to manually delete a register after the watchdog-reset. I have to search the documentation....

Charly

posted by Karl Zweimüller 16 Mar 2013

Yes, you must clear the flag manually. From the UM:

Quote:

The Watchdog time-out flag (WDTOF) can be examined to determine if the Watchdog has caused the reset condition. The WDTOF flag must be cleared by software.

The following should be enough:

// clear WDTOF flag (bit 2)
LPC_WDT->WDMOD &= ~(1<<2);
posted by Igor Skochinsky 16 Mar 2013

Another possibility is to set up WTD to fire an interrupt instead of reset, and call mbed_reset() in the handler.

posted by Igor Skochinsky 16 Mar 2013

Hi Igor!

Thanks for the info! Now it seems that the watchdog does the same as the normal reset! And now I can search for the reason, why my device stops receiving after some time....

Thanks - Charly

posted by Karl Zweimüller 18 Mar 2013
11 years, 9 months ago.

Karl,

I've noted a difference. If you but in a new binary file, a mbed reset (hardware or software) will load the new image whereas the Watchdog timeout will not.

...kevin

Hi Kevin! Thank's for this information. I didn't know that. But in my case it is ok, that no new file is loaded, as it should always run the same program. Charly

posted by Karl Zweimüller 16 Mar 2013