STM32F103 - IWDG usage

Document created by fillon.nicolas Employee on Aug 16, 2017
Version 1Show Document
  • View in full screen mode



I had to do some tests with the IWDG of the F103.


There is no code example in the Cube for either of the boards.


So here is one code to enable the IWGD by software on the STM32F103 Discovery kit.


I tested a code on STM32F103 discovery kit and I can see that the IWDG is working properly.


I am setting the timeout of the IWDG to 1 second.


In my infinite loop I refresh the watchdog every 100 ms: the code is running properly and no reset is generated by IWDG


Now if in my infinite loop I remove the refresh then I see that as expected every second I get a reset (by monitoring NRST line on the scope: you can see the NRST being asserted every second).


A very simple code to show you how to enable and use the IWDG.


Tested on the STM32F013 Discovery kit.


You will need to download the F1 Cube library (link to the latest version here:


Code attached should be unzipped at the following location in your F1 Cube Library (tested with version 1.4.0):




(IWDG needs to be created).


Best Regards.