48. Independent watchdog (IWDG)
48.1 Introduction
The independent watchdog (IWDG) peripheral offers a high safety level, thanks to its capability to detect malfunctions due to software or hardware failures.
The IWDG is clocked by an independent clock, and stays active even if the main clock fails.
In addition, the watchdog function is performed in the \(V_{DD}\) voltage domain, allowing the IWDG to remain functional even in low power modes. Refer to Section 48.3 to check the capability of the IWDG in this product.
The IWDG is best suited for applications that require the watchdog to run as a totally independent process outside the main application, making it very reliable to detect any unexpected behavior.
48.2 IWDG main features
- • 12-bit down-counter
- • Dual voltage domain, thus enabling operation in low power modes
- • Independent clock
- • Early wake-up interrupt generation
- • Reset generation
- – In case of timeout
- – In case of refresh outside the expected window
48.3 IWDG implementation
Table 333. STM32MP157x IWDG features (1)
| IWDG modes/features | IWDG1 | IWDG2 |
|---|---|---|
| LSI used as IWDG kernel clock (iwdg_ker_ck) | X | X |
| Window function | X | X |
| Early wake-up interrupt generation | X | X |
| System reset generation (2) | X | X |
| Capability to work in system Stop | X | X |
| Capability to work in system Standby | X | X |
| Capability to generate an interrupt in system Stop | X | X |
| Capability to generate an interrupt in system Standby | - | - |
| Capability to be frozen when the MPU enters in debug mode | X (3) | X (4) |
| Capability to be frozen when the MCU enters in debug mode | - | - |
| Option bytes to control the activity in Stop mode (5) | X | X |
| Option bytes to control the activity in Standby mode (6) | X | X |
| Option bytes to control the hardware mode (7) | X | X |
1. 'X' = supported, '-' = not supported.
2. Refer to the RCC section for additional information.
- 3. Controlled by bit IWDG1 of DBGMCU_APB5FZ1 register in the DBG block.
- 4. Controlled by bit IWDG2 of DBGMCU_APB4FZ1 register in the DBG block.
- 5. Controlled via option bytes OTP_IWDG1_FZ_STOP and OTP_IWDG2_FZ_STOP, respectively, for IWDG1 and IWDG2.
- 6. Controlled via option bytes OTP_IWDG1_FZ_STANDBY and OTP_IWDG2_FZ_STANDBY, respectively, for IWDG1 and IWDG2.
- 7. Controlled via option bytes OTP_IWDG1_HW and OTP_IWDG2_HW, respectively, for IWDG1 and IWDG2.
48.4 IWDG functional description
48.4.1 IWDG block diagram
Figure 543 shows the functional blocks of the independent watchdog module.
Figure 543. Independent watchdog block diagram

MS49973V4
The register and IRQ interfaces are located into the VCORE voltage domain. The watchdog function itself is located into the VDD voltage domain to remain functional in low power modes. See Section 48.3 for IWDG capabilities.
The register and IRQ interfaces are mainly clocked by the APB clock (iwdg_pclk), while the watchdog function is clocked by a dedicated kernel clock (iwdg_ker_ck). A synchronization mechanism makes the data exchange between the two domains possible. Note that most of the registers located in the register interface are shadowed into the VDD voltage domain.
The IWDG down-counter (IWDCNT) is clocked by the prescaled clock (presc_ck). The prescaled clock is generated from the kernel clock iwdg_ker_ck divided by the prescaler, according to PR[3:0] bitfield.
The table below gives the timing delays according to the actions performed on the IWDG: changing the prescaler, the timeout, the window or the early wake-up comparator values or doing a refresh.
Table 334. IWDG delays versus actions (1)| TDRVU, TDPVU | TDWVU | TDEWU | TDRefresh | TDRefAuto | |||||
|---|---|---|---|---|---|---|---|---|---|
| Min | Max | Min | Max | Min | Max | Min | Max | Min | Max |
| 5 Tk | 6 Tk | - | 6 Tk | - | 6 Tk | 2 Tk | 2 Tk + Tp | - | Tp |
1. Tk represents a period of the kernel clock input, Tp represents a period of presc_ck.
48.4.2 IWDG internal signals
The list of IWDG internal signals is detailed in Table 335.
Table 335. IWDG internal input/output signals| Signal name | Signal type | Description |
|---|---|---|
| iwdg_ker_ck | Input | IWDG kernel clock |
| iwdg_ker_req | Input | IWDG kernel clock request |
| iwdg_pclk | Input | IWDG APB clock |
| iwdg_out_rst | Output | IWDG reset output |
| iwdg_in_rst | Input | IWDG reset input |
| iwdg_wkup | Output | IWDG wake-up event |
| iwdg_it | Output | IWDG early wake-up interrupt |
48.4.3 Software and hardware watchdog modes
The watchdog modes allow the application to select the way the IWDG is enabled, either by software commands (Software watchdog mode), or automatically (Hardware watchdog mode). All other functions work similarly for both Software and Hardware modes.
The Software watchdog mode is the default working mode. The independent watchdog is started by writing the value 0x0000 CCCC into the IWDG key register (IWDG_KR), and the IWDCNT starts counting down from the reset value (0xFFFF).
In the hardware watchdog mode the independent watchdog is started automatically at power-on, or every time it is reset (via iwdg_in_rst). The IWDCNT down-counter starts counting down from the reset value 0xFFFF. The hardware watchdog mode feature is enabled through the device option bits, see Section 48.3 for details.
When the IWDCNT reaches 0x000, a reset signal is generated (iwdg_out_rst asserted).
Whenever the key value 0x0000 AAAA is written in the IWDG key register (IWDG_KR), the IWDG_RLR value is reloaded into the IWDCNT, and the watchdog reset is prevented.
Due to re-synchronization delays, the IWDG must be refreshed before the IWDCNT down-counter reaches 1.
Once started, the IWDG can be stopped only when it is reset (iwdg_in_rst asserted).
As shown in Figure 544, when the refresh command is executed, one period of presc_ck later, the IWDCNT is reloaded with the content of RL[11:0].
Figure 544. Reset timing due to timeout
![Timing diagram for IWDG reset timing. The top graph shows the IWDCNT value decreasing from 0xFFF to 0 over time. It is divided into 'Refresh not allowed' and 'Refresh allowed' regions. A window is defined by WIN[11:0] and WIN[11:0]+1. The bottom graph shows the 'Writing 0xAAAA into IWDG_KR' signal, the 'iwdg_out_rst' (output reset) signal, and the 'iwdg_in_rst' (input reset) signal. A callout shows the prescaler clock (T_presc_ck) with levels 0, 1, and 2.](/RM0436-STM32MP157/af231ac6622e17ec6cfce9ed1ad14e73_img.jpg)
The figure is a timing diagram for the Independent Watchdog (IWDG). The top part shows the 'IWDCNT value' on the y-axis (ranging from 0 to 0xFFF) against 'Time' on the x-axis. The counter starts at 0xFFF and decrements. A 'Refresh not allowed' region is shaded, followed by a 'Refresh allowed' region. A window is defined by 'WIN[11:0]' and 'WIN[11:0]+1'. The counter reaches 0 at the end of the allowed region. The bottom part shows three signals: 'Writing 0xAAAA into IWDG_KR' (a pulse), 'iwdg_out_rst' (asserted low when the counter reaches 0), and 'iwdg_in_rst' (asserted low when the counter reaches 0). A callout shows the 'T_presc_ck' period with levels 0, 1, and 2.
MS49974V2
1. If window option activated.
If the IWDG is not refreshed before the IWDCNT reaches 1, the IWDG generates a reset (iwdg_out_rst is asserted). In return, the RCC resets the IWDG (assertion of iwdg_in_rst) to clear the reset source.
48.4.4 Window option
The IWDG can also work as a window watchdog, by setting the appropriate window in the IWDG window register (IWDG_WINR).
If the reload operation is performed while the counter is greater than WIN[11:0] + 1, a reset is generated. WIN[11:0] is located in the IWDG window register (IWDG_WINR). As shown in Figure 545, the reset is generated one period of presc_ck after the unexpected refresh command.
The default value of the IWDG window register (IWDG_WINR) is 0x0000 0FFF, so, if not updated, the window option is disabled.
As soon as the window value changes, the down-counter (IWDCNT) is reloaded with the RL[11:0] value, to ease the estimation for where the next refresh must take place.
Figure 545. Reset timing due to refresh in the not allowed area
![Timing diagram for IWDG reset timing due to refresh in the not allowed area. The diagram shows the IWDCNT value decreasing over time, with a reload event at RL[11:0]. A shaded region indicates 'Refresh not allowed'. The diagram also shows the IWDG_KR register being written with 0xAAAA, and the resulting iwdg_out_rst and iwdg_in_rst signals.](/RM0436-STM32MP157/d9ed09d95544334276764d50359ffadc_img.jpg)
The diagram illustrates the IWDG counter (IWD_CNT) behavior during a refresh operation. The IWD_CNT value starts at 0xAAA and counts down to 0xAAA+1. A reload event occurs at RL[11:0], and the counter then counts down to 0xAAA+1. A shaded region indicates the 'Refresh not allowed' area. The diagram also shows the IWDG_KR register being written with 0xAAAA, and the resulting iwdg_out_rst and iwdg_in_rst signals. The timing is defined by the prescaler clock period (Tpresc_ck).
MS49975V3
Configuring the IWDG when the window option is enabled
- 1. Enable the IWDG by writing 0x0000 CCCC in the IWDG key register (IWDG_KR).
- 2. Enable register access by writing 0x0000 5555 in the IWDG key register (IWDG_KR).
- 3. Write the IWDG prescaler by programming IWDG prescaler register (IWDG_PR).
- 4. Write the IWDG reload register (IWDG_RLR).
- 5. If needed, enable the early wake-up interrupt, and program the early wake-up comparator, by writing the proper values into the IWDG early wake-up interrupt register (IWDG_EWCR).
- 6. Write to the IWDG window register (IWDG_WINR). This automatically reloads the IWD_CNT down-counter with the RL[11:0] value.
- 7. Wait for the registers to be updated (IWDG_SR = 0x0000 0000).
- 8. Write 0x0000 0000 into IWDG key register (IWDG_KR) to write-protect registers.
Note: Step 7 can be skipped if the application does not intend to disable the APB clock after the completion of this sequence.
Configuring the IWDG when the window option is disabled
When the window option it is not used, the IWDG can be configured as follows:
- 1. Enable the IWDG by writing 0x0000 CCCC in the IWDG key register (IWDG_KR).
- 2. Enable register access by writing 0x0000 5555 in the IWDG key register (IWDG_KR).
- 3. Write the prescaler by programming the IWDG prescaler register (IWDG_PR).
- 4. Write the IWDG reload register (IWDG_RLR).
- 5. If needed, enable the early wake-up interrupt, and program the early wake-up comparator, by writing the proper values into the IWDG early wake-up interrupt register (IWDG_EWCR).
- 6. Wait for the registers to be updated (IWDG_SR = 0x0000 0000).
- 7. Refresh the counter with RL[11:0] value, and write-protect registers by writing 0x0000 AAAA into IWDG key register (IWDG_KR).
The figure below shows a sequence example changing the prescaler, the reload value, and then performing a refresh.
Figure 546. Changing PR, RL, and performing a refresh(1)
![Timing diagram showing the sequence of operations for changing the IWDG prescaler (PR), reload value (RL), and performing a refresh. The diagram includes signals for iwdg_ker_ck, WDG_CNT counter, PVU, RVU, Prescaler, RL[11:0], and CPU activity. Key events include writing 1 to IWDG_PR, writing 0x5555 to IWDG_KR to unlock registers, writing M to RL[11:0], and writing 0xAAAA to IWDG_KR to perform a refresh and lock registers. Timing parameters TD_PVU, TD_RVU, and TD_Refresh are indicated.](/RM0436-STM32MP157/826d834f005903bdf1fbd0074b108037_img.jpg)
The diagram illustrates the timing sequence for modifying the IWDG prescaler and reload value, followed by a refresh operation. It shows the relationship between the IWDG kernel clock (iwdg_ker_ck), the watchdog counter (WDGCNT), the prescaler update (PVU), the reload value update (RVU), the prescaler division ratio, the reload value (RL[11:0]), and CPU activity. The sequence starts with writing 1 to IWDG_PR and 0x5555 to IWDG_KR to unlock the registers. This is followed by writing the new reload value M to RL[11:0]. Finally, writing 0xAAAA to IWDG_KR performs the refresh and locks the registers. Timing parameters TDPVU, TDRVU, and TDRefresh are shown. A 'Refresh ignored region' is highlighted in the counter sequence.
MSv75426V1
1. Refer to Table 334: IWDG delays versus actions for details on timing values.
Note: When the new prescaler value is accepted by the IWDG (falling edge of PVU), the new division ratio is effective when the current division sequence is completed (N-k in the drawing).
Note: The timeout delay between the refresh (write 0xAAAA into IWDG_KR) and the watchdog reset is increased by TDRefresh.
If a refresh command is sent while the previous refresh command is not yet completed, this last refresh command is ignored.
Updating the window comparator
It is possible to update the window comparator when the IWDG is already running. The IWDCNT is reloaded as well. The following sequence can be performed to update the window comparator:
- 1. Enable register access by writing 0x0000 5555 in the IWDG key register (IWDG_KR).
- 2. Write to the IWDG window register (IWDG_WINR). This automatically reloads the IWDCNT down-counter with RL[11:0] value.
- 3. Wait for WVU = 0
- 4. Lock registers by writing IWDG_KR to 0x0000 0000
Step 3 can be skipped if the application does not intend to disable the APB clock after the completion of this sequence.
48.4.5 Debug
When the processor enters into Debug mode (core halted), the IWDCNT down-counter either continues to work normally or stops, depending on debug capability of the product. Refer to Section 48.3 for details on the capabilities of this product.
48.4.6 Register access protection
Write accesses to IWDG prescaler register (IWDG_PR), IWDG reload register (IWDG_RLR), IWDG early wake-up interrupt register (IWDG_EWCR) and IWDG window register (IWDG_WINR) are protected. To modify them, first write 0x0000 5555 in the IWDG key register (IWDG_KR). A write access to this register with a different value breaks the sequence and register access is protected again. This is the case of the reload operation (writing 0x0000 AAAA).
A status register is available to indicate that an update of the prescaler or the down-counter reload value or the window value is ongoing.
48.5 IWDG low power modes
Depending on option bytes configuration, the IWDG can continue counting or not during the low power modes. Refer to Section 48.3 for details.
Table 336. Effect of low power modes on IWDG
| Mode | Description |
|---|---|
| Sleep | No effect. IWDG interrupts cause the device to exit from the mode. |
| Stop | The IWDG remains active or not, depending on option bytes configuration. Refer to Section 48.3 for details. IWDG interrupts cause the device exit the Stop mode. |
| Standby | The IWDG remains active or not, depending on option bytes configuration. Refer to Section 48.3 for details. IWDG interrupts do not make the device to exit from Standby mode. |
| Shutdown | The IWDG is not working. |
48.6 IWDG interrupts
The IWDG offers the possibility to generate an early interrupt depending on the value of the down-counter. The early interrupt is enabled by setting the EWIE bit of the IWDG early wake-up interrupt register (IWDG_EWCR) to 1.
A comparator value (EWIT[11:0]) allows the application to define the position where the early interrupt must be generated.
When the IWDCNT down-counter reaches the value of EWIT[11:0] - 1, the iwdg_wkup is activated, making it possible for the system to exit from low power modes, if needed.
When the APB clock is available, the iwdg_it is activated as well.
In addition, the flag EWIF of the IWDG status register (IWDG_SR) is set to 1.
The EWI interrupt is acknowledged by writing 1 to the EWIC bit in the IWDG early wake-up interrupt register (IWDG_EWCR).
Writing into the IWDG_EWCR register also triggers a refresh of the down-counter (IWDCNT) with the reload value RL[11:0].
Figure 547. Independent watchdog interrupt timing diagram
![Timing diagram showing IWDCNT value decreasing over time, reaching EWIT[11:0] - 1, triggering iwdg_wkup_it, and subsequent APB write access to EWIC and pclk active period.](/RM0436-STM32MP157/5cd30eb56ff6efc55608a1b237031d80_img.jpg)
The diagram illustrates the timing of IWDG interrupts. The top graph shows the IWDCNT value decreasing linearly over time. A horizontal line marks the EWIT[11:0] level. A vertical dashed line indicates the point where IWDCNT = EWIT - 1. Below this, the iwdg_wkup_it signal transitions from low to high. An APB write access to the EWIC bit occurs while iwdg_wkup_it is high. Following this, the pclk signal becomes active for a duration. Finally, the iwdg_it signal transitions from low to high, coinciding with the end of the pclk active period. The diagram is labeled MS49976V1.
The early wake-up interrupt (EWI) can be used if specific safety operations or data logging must be performed before the watchdog reset is generated.
Changing the early wake-up comparator value
It is possible to change the early wake-up comparator value or to enable/disable the interrupt generation at any time, by performing the following sequence:
- 1. Enable register access by writing 0x0000 5555 in the IWDG key register (IWDG_KR).
- 2. Enable or disable the early wake-up interrupt, and/or program the early wake-up comparator, by writing the proper values into the IWDG early wake-up interrupt register (IWDG_EWCR).
- 3. Wait for EWU = 0, EWU is located into the IWDG status register (IWDG_SR).
- 4. Write-protect registers by writing 0x0000 0000 to IWDG key register (IWDG_KR).
Step 3 can be skipped if the application does not intend to disable the APB clock after the completion of this sequence.
Table 337 summarizes the IWDG interrupt request.
Table 337. IWDG interrupt request
| Interrupt event | Event flag | Interrupt clear method | Interrupt enable control bit | Activated interrupt | |
|---|---|---|---|---|---|
| iwdg_it | iwdg_wkup_it | ||||
| IWDCNT reaches EWIT value | EWIF | Writing EWIC to 1 | EWIE | Y(1) | Y(2) |
- 1. Generated when a clock is present on iwdg_pclk input.
- 2. Generated when a clock is present on iwdg_ker_ck input.
48.7 IWDG registers
Refer to Section 1.2 on page 121 for a list of abbreviations used in register descriptions.
The peripheral registers can be accessed by half-words (16-bit) or words (32-bit).
Most of the registers located into the register interface are shadowed into the VDD voltage domain. When the iwdg_in_rst is asserted, the watchdog logic and the shadow registers located into the VDD voltage domain are reset.
When the application reads back a watchdog register, the hardware transfers the value of the corresponding shadow register to the register interface.
When the application writes a watchdog register, the hardware updates the corresponding shadow register.
48.7.1 IWDG key register (IWDG_KR)
Address offset: 0x00
Reset value: 0x0000 0000
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| KEY[15:0] | |||||||||||||||
| w | w | w | w | w | w | w | w | w | w | w | w | w | w | w | w |
Bits 31:16 Reserved, must be kept at reset value.
Bits 15:0 KEY[15:0]: Key value (write only, read 0x0000)
These bits can be used for several functions, depending upon the value written by the application:
- - 0xAAAA: reloads the RL[11:0] value into the IWDCNT down-counter (watchdog refresh), and write-protects registers. This value must be written by software at regular intervals, otherwise the watchdog generates a reset when the counter reaches 0.
- - 0x5555: enables write-accesses to the registers.
- - 0xCCCC: enables the watchdog (except if the hardware watchdog option is selected) and write-protects registers.
- - values different from 0x5555: write-protects registers.
Note that only IWDG_PR, IWDG_RLR, IWDG_EWCR and IWDG_WINR registers have a write-protection mechanism.
48.7.2 IWDG prescaler register (IWDG_PR)
Address offset: 0x04
Reset value: 0x0000 000F
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | PR[3:0] | |||
| rw | rw | rw | rw | ||||||||||||
Bits 31:4 Reserved, must be kept at reset value.
Bits 3:0 PR[3:0]: Prescaler divider
These bits are write access protected, see Section 48.4.6. They are written by software to select the prescaler divider feeding the counter clock. PVU bit of the IWDG status register (IWDG_SR) must be reset to be able to change the prescaler divider.
- 0000: divider / 4
- 0001: divider / 8
- 0010: divider / 16
- 0011: divider / 32
- 0100: divider / 64
- 0101: divider / 128
- 0110: divider / 256
- 0111: divider / 512
- Others: divider / 1024
Note: Reading this register returns the prescaler value from the VDD voltage domain. This value may not be up to date/valid if a write operation to this register is ongoing. For this reason the value read from this register is valid only when the PVU bit in the IWDG status register (IWDG_SR) is reset.
48.7.3 IWDG reload register (IWDG_RLR)
Address offset: 0x08
Reset value: 0x0000 0FFF
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Res. | Res. | Res. | Res. | RL[11:0] | |||||||||||
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | ||||
Bits 31:12 Reserved, must be kept at reset value.
Bits 11:0 RL[11:0]: Watchdog counter reload value
These bits are write access protected, see Section 48.4.6. They are written by software to define the value to be loaded in the watchdog counter each time the value 0xAAAA is written in the IWDG key register (IWDG_KR). The watchdog counter counts down from this value. The timeout period is a function of this value and the prescaler.clock. It is not recommended to set RL[11:0] to a value lower than 2.
The RVU bit in the IWDG status register (IWDG_SR) must be reset to be able to change the reload value.
Note: Reading this register returns the reload value from the \(V_{DD}\) voltage domain. This value may not be up to date/valid if a write operation to this register is ongoing, hence the value read from this register is valid only when the RVU bit in the IWDG status register (IWDG_SR) is reset.
48.7.4 IWDG status register (IWDG_SR)
Address offset: 0x0C
Reset value: 0x0000 0000
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Res. | EWIF | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | EWU | WVU | RVU | PVU |
| r | r | r | r | r |
Bits 31:15 Reserved, must be kept at reset value.
Bit 14 EWIF: Watchdog early interrupt flag
This bit is set to '1' by hardware in order to indicate that an early interrupt is pending. This bit must be cleared by the software by writing the bit EWIC of IWDG_EWCR register to '1'.
Bits 13:4 Reserved, must be kept at reset value.
Bit 3 EWU: Watchdog interrupt comparator value update
This bit is set by hardware to indicate that an update of the interrupt comparator value (EWIT[11:0]) or an update of the EWIE is ongoing. It is reset by hardware when the update operation is completed in the \(V_{DD}\) voltage domain. Refer to Table 334: IWDG delays versus actions for delay values.
The EWIT[11:0] and EWIE fields can be updated only when EWU bit is reset.
Bit 2 WVU: Watchdog counter window value update
This bit is set by hardware to indicate that an update of the window value is ongoing. It is reset by hardware when the reload value update operation is completed in the VDD voltage domain. Refer to Table 334: IWDG delays versus actions for delay values.
The window value can be updated only when WVU bit is reset.
This bit is generated only if generic “window” = 1.
Bit 1 RVU: Watchdog counter reload value update
This bit is set by hardware to indicate that an update of the reload value is ongoing. It is reset by hardware when the reload value update operation is completed in the VDD voltage domain. Refer to Table 334: IWDG delays versus actions for delay values.
The reload value can be updated only when RVU bit is reset.
Bit 0 PVU: Watchdog prescaler value update
This bit is set by hardware to indicate that an update of the prescaler value is ongoing. It is reset by hardware when the prescaler update operation is completed in the VDD voltage domain. Refer to Table 334: IWDG delays versus actions for delay values.
The prescaler value can be updated only when PVU bit is reset.
Note: If several reload, prescaler, early interrupt position or window values are used by the application, it is mandatory to wait until RVU bit is reset before changing the reload value, to wait until PVU bit is reset before changing the prescaler value, to wait until WVU bit is reset before changing the window value, and to wait until EWU bit is reset before changing the early interrupt position value. After updating the prescaler and/or the reload/window/early interrupt value, it is not necessary to wait until RVU or PVU or WVU or EWU is reset before continuing code execution, except in case of low power mode entry.
48.7.5 IWDG window register (IWDG_WINR)
Address offset: 0x10
Reset value: 0x0000 0FFF
| Note: 48.7.5 | column_2 | Bit 2 Bit 1 Bit 0 | WVU: RVU: PVU: | domain. Refer to domain. Refer to domain. Refer to | column_6 | column_7 | column_8 | column_9 | column_10 | column_11 | column_12 | for delay values. for delay values. for delay values. | column_14 | column_15 | RM0436 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Res. | Res. | Res. | Res. | WIN[11:0] | |||||||||||
| rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | ||||
| Bits 11:0 | WIN[11:0]: | Watchdog counter window value | |||||||||||||
| These bits are write access protected, see | Section 48.4.6 | .They contain the high limit of the | |||||||||||||
| The WVU bit in the reload value. | IWDG status register (IWDG_SR) | must be reset to be able to change the |
Bits 31:12 Reserved, must be kept at reset value.
Bits 11:0 WIN[11:0]: Watchdog counter window value
These bits are write access protected, see Section 48.4.6. They contain the high limit of the window value to be compared with the downcounter.
To prevent a reset, the IWDCNT downcounter must be reloaded when its value is lower than WIN[11:0] + 1 and greater than 1.
The WVU bit in the IWDG status register (IWDG_SR) must be reset to be able to change the reload value.
Note: Reading this register returns the reload value from the VDD voltage domain. This value may not be valid if a write operation to this register is ongoing. For this reason the value read from this register is valid only when the WVU bit in the IWDG status register (IWDG_SR) is reset.
48.7.6 IWDG early wake-up interrupt register (IWDG_EWCR)
Address offset: 0x14
Reset value: 0x0000 0000
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| EWIE | EWIC | Res. | Res. | EWIT[11:0] | |||||||||||
| rw | w | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | rw | ||
Bits 31:16 Reserved, must be kept at reset value.
Bit 15 EWIE: Watchdog early interrupt enable
Set and reset by software.
0: The early interrupt interface is disabled.
1: The early interrupt interface is enabled.
The EWU bit in the IWDG status register (IWDG_SR) must be reset to be able to change the value of this bit.
Bit 14 EWIC: Watchdog early interrupt acknowledge
The software must write a 1 into this bit in order to acknowledge the early wake-up interrupt and to clear the EWIF flag. Writing 0 has no effect, reading this flag returns a 0.
Bits 13:12 Reserved, must be kept at reset value.
Bits 11:0 EWIT[11:0]: Watchdog counter window value
These bits are write access protected (see Section 48.4.6). They are written by software to define at which position of the IWDCNT down-counter the early wake-up interrupt must be generated. The early interrupt is generated when the IWDCNT is lower or equal to EWIT[11:0] - 1.
EWIT[11:0] must be bigger than 1.
An interrupt is generated only if EWIE = 1.
The EWU bit in the IWDG status register (IWDG_SR) must be reset to be able to change the reload value.
Note: Reading this register returns the Early wake-up comparator value and the Interrupt enable bit from the \(V_{DD}\) voltage domain. This value may not be up to date/valid if a write operation to this register is ongoing, hence the value read from this register is valid only when the EWU bit in the IWDG status register (IWDG_SR) is reset.
48.7.7 IWDG hardware configuration register (IWDG_HWCFGR)
Address offset: 0x3F0
Reset value: 0x0000 0081
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | PR_DEFAULT[3:0] | WINDOW[3:0] | ||||||
| r | r | r | r | r | r | r | r | ||||||||
Bits 31:8 Reserved, must be kept at reset value.
Bits 7:4 PR_DEFAULT[3:0]: Prescaler default value
This bitfield gives the default value of the prescaler (see PR[3:0]: Prescaler divider of IWDG prescaler register (IWDG_PR))
- 0000: Prescaler (PR[3:0]) default value after reset is 0000'
- 0001: Prescaler (PR[3:0]) default value after reset is 0001'
- 0010: Prescaler (PR[3:0]) default value after reset is 0010'
- 0011: Prescaler (PR[3:0]) default value after reset is 0011'
- 0100: Prescaler (PR[3:0]) default value after reset is 0100'
- 0101: Prescaler (PR[3:0]) default value after reset is 0101'
- 0110: Prescaler (PR[3:0]) default value after reset is 0110'
- 0111: Prescaler (PR[3:0]) default value after reset is 0111'
- 1xxx: Prescaler (PR[3:0]) default value after reset is 1000
Bits 3:0 WINDOW[3:0]: Support of Window function
- 0000: Window option disabled
- 0001: Window option enabled
- Others: Reserved
48.7.8 IWDG version register (IWDG_VERR)
Address offset: 0x3F4
Reset value: 0x0000 0030
| 48.7.8 | column_2 | Bits 7:4 Bits 3:0 | column_4 | WINDOW[3:0] Others: Reserved | column_6 | column_7 | column_8 | column_9 | column_10 | column_11 | column_12 | column_13 | column_14 | column_15 | RM0436 of IWDG |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | MAJREV[3:0] | MINREV[3:0] | ||||||
| r | r | r | r | r | r | r | r | ||||||||
| Bits 7:4 | MAJREV[3:0] | : IWDG major revision | |||||||||||||
| Bits 3:0 | MINREV[3:0] | : IWDG minor revision |
Bits 31:8 Reserved, must be kept at reset value.
Bits 7:4 MAJREV[3:0]: IWDG major revision
Bits 3:0 MINREV[3:0]: IWDG minor revision

48.7.9 IWDG identification register (IWDG_IDR)
Address offset: 0x3F8
Reset value: 0x0012 0041
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| ID[31:16] | |||||||||||||||
| r | r | r | r | r | r | r | r | r | r | r | r | r | r | r | r |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| ID[15:0] | |||||||||||||||
| r | r | r | r | r | r | r | r | r | r | r | r | r | r | r | r |
Bits 31:0 ID[31:0]: IWDG identifier
48.7.10 IWDG size identification register (IWDG_SIDR)
Address offset: 0x3FC
Reset value: 0xA3C5 DD01
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
| SID[31:16] | |||||||||||||||
| r | r | r | r | r | r | r | r | r | r | r | r | r | r | r | r |
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| SID[15:0] | |||||||||||||||
| r | r | r | r | r | r | r | r | r | r | r | r | r | r | r | r |
Bits 31:0 SID[31:0]: IWDG size identifier
The address decoding range is 1 Kbyte.
48.7.11 IWDG register map
Table 338. IWDG register map and reset values
| Offset | Register name | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x00 | IWDG_KR | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | KEY[15:0] | |||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||||||||||||
| 0x04 | IWDG_PR | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | PR[3:0] | |||||||
| Reset value | 1 | 1 | 1 | 1 | |||||||||||||||||||||||||||||||
| 0x08 | IWDG_RLR | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | RL[11:0] | |||||||||||||
| Reset value | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||||||||||||||||||||||
| 0x0C | IWDG_SR | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | EWIF | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | EWU | WVU | RVU | PVU | ||
| Reset value | 0 | 0 | 0 | 0 | 0 | ||||||||||||||||||||||||||||||
| 0x10 | IWDG_WINR | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | WIN[11:0] | |||||||||||||
| Reset value | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||||||||||||||||||||||
| 0x14 | IWDG_EWCR | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | EWIE | EWIC | Res. | Res. | EWIT[11:0] | |||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||||||||||||||
| 0x3F0 | IWDG_HWCFGR | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | PR_DEFAULT [3:0] | WINDOW [3:0] | ||||||||
| Reset value | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | ||||||||||||||||||||||||||
| 0x3F4 | IWDG_VERR | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | Res. | MAJREV[3:0] | MINREV[3:0] | ||||||||
| Reset value | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | ||||||||||||||||||||||||||
| 0x3F8 | IWDG_IDR | ID[31:0] | |||||||||||||||||||||||||||||||||
| Reset value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | |||
| 0x3FC | IWDG_SIDR | SID[31:0] | |||||||||||||||||||||||||||||||||
| Reset value | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | |||
Refer to Section 2.5 for the register boundary addresses.