Question
My simple IWDG dont work - why?
Hi.
I downloaded some IWDG example code from Keil because I will use the IWDG-feature of my STM32F107. Configurations/init are located in this procedure:
//__inline static void stm32_IwdgSetup (void) {
static void stm32_IwdgSetup (void) {
RCC->CSR |= (1<<0); // LSI (internal low speed oscillator) enable, necessary for IWDG
while ((RCC->CSR & (1<<1)) == 0); // wait till LSI is ready
/*----------------------------------------------------------------------------
Define IWDG PR and RLR settings
*----------------------------------------------------------------------------*/
IWDG->KR = 0x5555; // enable write to PR, RLR
IWDG->PR = 1;
IWDG->RLR = 400;
IWDG->KR = 0xAAAA; // Reload the watchdog
IWDG->KR = 0xCCCC; // Start the watchdog
} // end of stm32_IwdgSetupThe following is happening when debugging:
- When I start the debugger, the first breakpoint (at the call to stm32_IwdgSetup) is entered OK (see attached picture).
- When I single-STEPped the stm32_IwdgSetup to it’s last line, then (at that point) everything “hungs�? (the debugger did not exit the procedure properly, it did not reach/enter the line next to the stm32_IwdgSetup) and it seems like the MCU tries to execute code from memory location 0x21000000 (see attacjed picture).
I very much appreciate some assistance to this issue.
Best regards Terje Bøhler
