Unable to start WatchDog Timer in HCS08

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to start WatchDog Timer in HCS08

Jump to solution
3,401 Views
AshishM
Contributor I

We are working on freescale SRB boards, which contain Microcontroller MC13213 (RF + MCU (HCS08 series) in single chip). We are using GenericApp of freescale's beekit version 1.0.3 for End Device. In this we are unable to start watchdog timer.

Our program also goes in deep sleep i.e. STOP 3 mode and be there for long duration.

 

We also set SIMOPT= 0xF3; Cop enable, long timeout, STOP mode enabled, background debug enable during initialization.

Afterwards we write some value in this register so that watchdog timer gets reset. But our device gets reset instead of watchdog timer.

 

Please help me out from this problem

 

Ashish

Labels (1)
0 Kudos
1 Solution
973 Views
Mads
Contributor V
Ashish M,
 
First of all you should go download the latest version of beekit, as the current Beestack is now version 1.0.5 and not 1.0.3
 
the SIMOPT is write-once register and it is already initialized in crt0.c, so you need to modify the code in this file.
 
Br,
Mads

View solution in original post

0 Kudos
8 Replies
974 Views
Mads
Contributor V
Ashish M,
 
First of all you should go download the latest version of beekit, as the current Beestack is now version 1.0.5 and not 1.0.3
 
the SIMOPT is write-once register and it is already initialized in crt0.c, so you need to modify the code in this file.
 
Br,
Mads
0 Kudos
973 Views
AshishM
Contributor I

Mads,

We downloaded version 1.0.5 and put watchdog on it. We change SIMOPT with 0xF3 value in crt0.c file (i.e. SIMOPT = 0xF3; line 312). We also put SIMRS=0x20; (any value) at so many places in code to reset watchdog timer. Also we put (SIMRS=0x20:smileywink: in for loop of Task_Scheduler function in TS_kernel.c file. But it will reset Freescale's SRB Boards after some time delay (say approximately 1 second)

Regards,

Ashish M
0 Kudos
973 Views
Bosso
Contributor I
Any solution to this issue yet?

Just had a look into this because I want to enable watchdog for some beestack units.
For units that are designed to be installed and work for years without human interaction such as power cycling etc I think a watchdog function is common sense to have.
It's impossible to get code without bugs, but a watchdog will at least reboot if anything else fails.
I'm a bit surprised beestack do not use this feature by default, but I guess the use of it is different for different applications.

Enabling the watchdog with long timeout period, the watchdog time will still be very short.
at a BUSCLK of 8MHz the timeout will be about 3ms.
Maybe this explains the problems you've seen.
3ms is not a very long time, so it is not unlikely there can be a delay or something longer than that somewhere in the code (yours or freescales).

So, anyone else has implemented a watchdog solution for the beestack running on HCS08?




0 Kudos
973 Views
JimDon
Senior Contributor III

I think that you are giving a watch dog timer more value that it deserves. My experience has been they cause more bugs (because if your code does not reset it in time) than they solve. I would never use one myself, as I really do not care the have they system just reset. In many case just resetting is no solution anyway.

Whats more, once it is reset, you have not idea why. At least if it hangs, you can connect with the debugger and maybe find out why (and you notice it).

If you do have a bug, the timer is not going to fix it, it will just hide it.

As for writing code that runs forever, it's done all the time.

0 Kudos
973 Views
Bosso
Contributor I
Well, the watchdog will not solve all my problems, but it is at least a last resort if anything else fails. I'll know if the watchdog was the cause of the last reset by reading the reset status register.
If the code has a good structure, and the watchdog timeout is reasonable (seconds), usually the watchdog reset only need to be put into one place of the code.
My concern about code that runs forever lies in that the zigbee stack we're using (beestack) is out of our control. We're depending on code written by others...


0 Kudos
973 Views
AshishM
Contributor I

As I wrote earlier we are working on BeeStack 1.0.5, and in this we are unable to implement watchdog. Also I reset watchdog timer (SIMRS=0x20) after every 10-12 instructions. My current observation is that it requests for match found and after some time device gets reset.

0 Kudos
973 Views
tobogan
Contributor I
Hi, let me tell us how I programed a manual watchdog...
I'm working with smac for wireless and 3ms is too small as a watchdog timer.
I programed something like a manual watchdog.
In my periodic interruptcion service routine I check a flag that is refreshed in the main application.
If the main program looses, I reset manually with an illegal opcode the uC, after some interruptions... This works fine if only the main program crashes and the timer interrupt still generating...
0 Kudos
973 Views
AshishM
Contributor I

Mads,

We downloaded version 1.0.5 and test it, this version has some problem related to network formation and hence we didn’t test watchdog on it.

 

Yes SIMOPT is write-once register, we changed its value in crt0.c file (i.e. SIMOPT = 0xF3; line 312)

 

Regards,

Ashish M

0 Kudos