STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
iwdg_reg.h File Reference

IWDG registers: the independent watchdog (RM0390 section 20.4). More...

#include <stdint.h>
Include dependency graph for iwdg_reg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  IwdgRegisters_t
 IWDG register block. More...

Macros

#define IWDG_BASE   (0x40003000UL)
 IWDG base address (APB1).
#define IWDG   ((IwdgRegisters_t *)IWDG_BASE)
 The IWDG instance.
KR - key values (0x00)
#define IWDG_KEY_RELOAD   (0xAAAAU)
 Reload the counter from RLR (refresh).
#define IWDG_KEY_ENABLE_ACCESS   (0x5555U)
 Unlock PR and RLR for writing.
#define IWDG_KEY_START   (0xCCCCU)
 Start the watchdog; it cannot be stopped.
PR - prescaler (0x04)
#define IWDG_PR_PR_Pos   (0U)
 Bits 2:0.
#define IWDG_PR_PR_Msk   ((uint32_t)0x7U << IWDG_PR_PR_Pos)
  rw LSI divider: /4 << value, up to /256.
PR values

7 also divides by 256; IWDG_PR_DIV256 is the one value used for it.

#define IWDG_PR_DIV4   (0x0U)
 LSI / 4.
#define IWDG_PR_DIV8   (0x1U)
 LSI / 8.
#define IWDG_PR_DIV16   (0x2U)
 LSI / 16.
#define IWDG_PR_DIV32   (0x3U)
 LSI / 32.
#define IWDG_PR_DIV64   (0x4U)
 LSI / 64.
#define IWDG_PR_DIV128   (0x5U)
 LSI / 128.
#define IWDG_PR_DIV256   (0x6U)
 LSI / 256.
RLR - reload (0x08)
#define IWDG_RLR_RL_Pos   (0U)
 Bits 11:0.
#define IWDG_RLR_RL_Msk   ((uint32_t)0xFFFU << IWDG_RLR_RL_Pos)
  rw Counter reload value.
SR - status (0x0C)
#define IWDG_SR_PVU_Pos   (0U)
 Bit 0.
#define IWDG_SR_PVU   ((uint32_t)1U << IWDG_SR_PVU_Pos)
  ro A PR update is in progress.
#define IWDG_SR_RVU_Pos   (1U)
 Bit 1.
#define IWDG_SR_RVU   ((uint32_t)1U << IWDG_SR_RVU_Pos)
  ro An RLR update is in progress.

Typedefs

typedef struct IwdgRegisters_t IwdgRegisters_t
 IWDG register block.

Detailed Description

IWDG registers: the independent watchdog (RM0390 section 20.4).

Clocked by the LSI, so it can still reset the chip if SYSCLK hangs.

  • Write IWDG_KEY_ENABLE_ACCESS to KR before writing PR or RLR.
  • Wait for SR.PVU / SR.RVU to clear before writing PR / RLR again.

The F446's IWDG has no window register, so the block ends at SR (0x0C), matching ST's SVD.

Definition in file iwdg_reg.h.