Hello everybody
I spent a lot of time to try to get watchdog running, but I can't obtain any results.
I configured Watchdog as below:
At the begininng a routine called __init_hardware() in the c file arm_strart.c sets the WDOG as
void __init_hardware()
{
SCB_VTOR = (uint32_t)__vector_table; /* Set the interrupt vector table position */
/* Disable the Watchdog because it may reset the core before entering main(). */
WDOG_TOVALH = 0x00; // setting timeout value
WDOG_TOVALH = 0x64; // setting timeout value
WDOG_CS2 = 0x01; // setting 1-kHz clock source
WDOG_CS1 = 0x27; // Watchdog disabled,
// Watchdog interrupts are disabled. Watchdog resets are not delayed,
// Updates allowed. Software can modify the watchdog configuration registers within 128 bus clocks after performing the unlock write sequence,
// Watchdog test mode disabled,
// Watchdog enabled in chip debug mode,
// Watchdog enabled in chip wait mode,
// Watchdog enabled in chip stop mode.
}
In the main of the program I immediatly call MCU_Init() procedure, and I reconfigure WDog registers as below:
void MCU_Init(){
//-------------------------- WATCHDOG -------------------------------------------------------------------
DisableInterrupts;
WDOG_CNT = 0x20C5; // write the 1st unlock word
WDOG_CNT = 0x28D9; // write the 2nd unlock word
WDOG_TOVALH = 0x00; // setting timeout value
WDOG_TOVALL = 0x6E; // setting timeout value 0x6E = 110ms...
WDOG_CS2 = 0x01; // setting 1-kHz clock source
WDOG_CS1 = 0x87; // enable counter running
EnableInterrupts;
....
When I control WDOG register during Debug session I can see that the values above are written in the registers, but the counter doesn't run, and so I don't have the MCU reset after 110ms. I can't understand why! I've tried to run software not in the Debug mode, but the result is still the same. I've checked examples and I think that I'm not doing mistakes, Ican't really understand why it doesn't work!
Thank you very much!
Roberto