17.3.2.1 Reconfiguring the WatchdogIn some cases (such as when supporting a bootloader function), users may want toreconfigure or disable the watchdog without forcing a reset first. By settingCS1[UPDATE] to a 1 on the initial configuration of the watchdog after a reset, users canreconfigure the watchdog at any time by executing an unlock sequence. (Conversely, ifCS1[UPDATE] remains 0, the only way to reconfigure the watchdog is by initiating areset.) The unlock sequence is similar to the refresh sequence but uses different values.17.3.2.2 Unlocking the WatchdogThe unlock sequence is a write to the WDOG_CNTH:L registers of 0xC520 followed by0xD928 within 16 bus clocks at any time after the watchdog has been configured. Oncompleting the unlock sequence, the user must reconfigure the watchdog within 128 busclocks; otherwise, the watchdog forces a reset to the MCU.NOTEDue to 128 bus clocks requirement for reconfiguring thewatchdog, some delays must be inserted before executingSTOP or WAIT instructions after reconfiguring the watchdog.This ensures that the watchdog's new configuration takes effectbefore MCU enters low power mode. Otherwise, the MCU maynot be waken up from low power mode.17.3.2.3 Example code: Reconfiguring the WatchdogThe following code segment shows an example reconfiguration of the WDOG module./* Initialize watchdog with ~1-kHz clock source, ~1s time-out */DisableInterrupts; // disable global interruptWDOG_CNT = 0xC520; // write the 1st unlock wordWDOG_CNT = 0xD928; // write the 2nd unlock wordWDOG_TOVAL = 1000; // setting timeout valueWDOG_CS2 = WDOG_CS2_CLK_MASK; // setting 1-kHz clock sourceWDOG_CS1 = WDOG_CS1_EN_MASK; // enable counter runningEnableInterrupts; // enable global interruptFunctional descriptionMC9S08PA4 Reference Manual, Rev. 5, 08/2017346 NXP Semiconductors