Skip to main content
Terje Bøhler
Associate III
December 18, 2018
Question

My simple IWDG dont work - why?

  • December 18, 2018
  • 1 reply
  • 1128 views

0690X000006CrtMQAS.pngHi.

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_IwdgSetup

The following is happening when debugging:

  1. When I start the debugger, the first breakpoint (at the call to stm32_IwdgSetup) is entered OK (see attached picture).
  2. 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

    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    December 18, 2018

    Is NRST driven HIGH externally? ie not a pull-up, rather some other circuit with a push-pull driver?

    The DBGMCU settings can alter some behaviour, executing at 0x21000000 not one I'm familiar with.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..