Hello,
I am currently using MC9S08SG32 microntroller. when i call __RESET_WATCHDOG(); in my ISR of Timer or SPI, my controller is getting resetted continously and throws series of zeros (0000...) on the serial port.
can u please suggest the reason for r the same and possible solution if any.
Regards,
Rizwan
Hello Rizwan, and welcome to the forum.
It is generally not a good idea to call __RESET_WATCHDOG() from any ISR for another reason. It is possible for there to be errant main loop code that does not affect the normal operation of hardware interrupts. Calling the macro or function from within an ISR may result in the runaway condition of the main loop code not being sensed.
If you find that you need to reset the watchdog timer from within an ISR, to prevent COP timeout, your ISR code is far too lengthy and/or time consuming. ISR code should be as short as possible.
Regards,
Mac
Do you have __RESET_WATCHDOG() also in main loop? If yes, then since watchdog on SG32 is cleared in two steps, SRS=0x55, then SRS=0xAA, interrupt may be triggered while PC is in between SRS=0x55 and SRS=0xAA of the main loop, producing SRS=0x55, 0x55, 0xAA, 0xAA and of course resetting MCU.