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
C
Some of the example code that comes with the development tools usually demonstrates how to enable the watchdog and kept it set.
---Tom
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
C
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