Information Center for ARM

Example description

  
WWDG_Example WWDG_Example
  
Example Description 

This example shows how to update at regular period the WWDG counter and how to
simulate a software fault generating an MCU WWDG reset on expiry of a programmed 
time period.

The WWDG timeout is set to 69.9 ms and the refresh window is set to 80. 
The WWDG counter is refreshed each 50ms in the main program infinite loop to 
prevent a WWDG reset.
LED2 is also toggled each 53 ms indicating that the program is running.

An EXTI Line is connected to a GPIO pin, and configured to generate an interrupt
on the rising edge of the signal.

The EXTI Line is used to simulate a software failure: once the EXTI Line event 
occurs, by pressing the Key push-button, the corresponding interrupt is served.
In the ISR, a write to invalid address generates a Hardfault exception containing
an infinite loop and preventing to return to main program (the WWDG counter is 
not refreshed).
As a result, when the WWDG counter falls to 63, the WWDG reset occurs.
If the WWDG reset is generated, after the system resumes from reset, LED1 turns on.

If the EXTI Line event does not occur, the WWDG counter is indefinitely refreshed
in the main program infinite loop, and there is no WWDG reset. 

Directory contents

  - WWDG_Example/system_stm32f2xx.c   STM32F2xx system clock configuration file 
  - WWDG_Example/stm32f2xx_conf.h     Library Configuration file
  - WWDG_Example/stm32f2xx_it.c       Interrupt handlers
  - WWDG_Example/stm32f2xx_it.h       Header for stm32f2xx_it.c
  - WWDG_Example/main.c               Main program

	  The "system_stm32f2xx.c" is generated by an automatic clock configuration 
      tool and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool. 

Hardware and Software environment 

  - This example runs on STM32F2xx Devices.
  
  - This example has been tested with STM322xG-EVAL RevB and can be easily tailored
    to any other development board


  - STM322xG-EVAL Set-up  
    - Use LD1 and LD2 leds connected respectively to PG.06 and PG.08 pins
    - Use the KEY push button connected to PG.15 pin (EXTI Line15).