The example demonstrates the COP watchdog reset on MC9S12ZVL32 microcontroller. The code can be used on any MagniV device based on S12Z core.
The example project is created in CodeWarrior v10.6 (Eclipse IDE).
The SW code has been tested on TRK-S12ZVL board.
* Brief description:
The Phase Locked Loop (PLL) is set by default to PEI mode, so the bus clock is 6.25MHz based on 1MHz internal RC oscillator (IRC1M).
The RGB LED (red) is used to indicate MCU runs after reset. When the RGB colour changes to green, the COP time-out period has started.
After the period times out, the COP generates a reset and COPRF flag is set.
After the reset, based on COPRF flag, the Blue LED is turned on indicating previous reset has been generated by COP watchdog.
The COP time-out period is set to maximum (CPMUCOP register, bits CR[2:0]=7). The number of COPCLK cycles to time-out is 2^24 = 16777216.
The COPCLK is based on IRCCLK (by default) with 1MHz clock frequency. The maximum COP time-out period in this case is approximately 16.78 seconds.
- On the TRK-S12ZVL board:
Port P is used to drive RGB LED. Anode is connected to VDDX, a cathode to port pin. Port P can be set as output (DDRP=0xFF) and logic zero on output enables LED.
- Reference documentation: