How to enable and use Watchdog on a HC08JM

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

How to enable and use Watchdog on a HC08JM

601 Views
SuperByte
Contributor I

Hi Guys 

 

Could anyone PLEASE assist me as I am new to this. I am using a MC9S08JM Mirco and need to use the watchdog.

I need firstly to enable and I guess to reset it in the main loop or any other .  I read that I need to enable the COP and

define the reset adress. How do I do this .

 

Please help me if you can .

 

Thanking you

Labels (1)
0 Kudos
3 Replies

400 Views
J2MEJediMaster
Specialist I

Some of the example code that comes with the development tools usually demonstrates how to enable the watchdog and kept it set.

 

---Tom

0 Kudos

400 Views
SuperByte
Contributor I

Hi Tom 

 

Thanks for taking the time to reply. It is really appreciated. 

I have got the watchdog to work but I am not sure if it is working properly. 

 

I have set SOPT1 to D3  and call the  __RESET_WATCHDOG(); in my main loop. 

To test I Commented out the reset watchdog routine and sure enough the micro 

resets which is correct but it only resets for 4 times and then it hangs .

 

Is this normal ?  

Do I have a problem pointing the COP reset to the reset vector address?

 

Your help will be greatly apprecited.

 

Thnking you kindly

 

0 Kudos

400 Views
bigmac
Specialist III

Hello,

 

All types of reset use the same reset vector, i.e. the same as for a POR.

 

To fully define the COP operating conditions, SOPT2 register also needs to be written, in addition to SOPT1.  This is to define the COP timer clock source, and whether there is "windowed" operation of the COP.

 

Additionally, have you taken into account that both registers are write once - each register must have all bits simultaneously written.

 

How are you monitoring when each reset occurs?  Do you read the SRS register within the initialisation sequence, to determine which source was the cause of reset?

 

What do you specifically mean when you say that the MCU "hangs"?  What you seem to be saying is that there is no reset occurring, but the code may otherwise be operating normally.

 

Do you have the __RESET_WATCHDOG() macro at more than one position within your code?  Note that this macro should not be used within any ISR function.

 

Regards,

Mac

 

0 Kudos