Skip to content

Independent Watchdog (IWDG)


1. Introduction

  • IWDG is a hardware timer used to monitor system faults caused by abnormal operation and to recover from such faults.

2. Features

  • CI13XX supports one IWDG module. IWDG is based on a 32‑bit down‑counter. The counter decrements from the load value; when it reaches 0, a timeout interrupt is generated and the counter is reloaded. If the timeout interrupt is not cleared and the counter reaches 0 again, the IWDG will request a reset.
  • The reset domain can be configured via dpmu_iwdg_reset_none_config, dpmu_iwdg_reset_system_config, and dpmu_iwdg_reset_bus_config.

3. API List

Function Description
iwdg_init Initialize IWDG device
iwdg_open Start IWDG device
iwdg_close Stop IWDG device
iwdg_feed Feed the IWDG


4. Example

The following code configures and starts the IWDG with a 1 s feed interval:

```c

include “ci130x_scu.h”

include “ci130x_dpmu.h”

include “ci130x_iwdg.h”

include “ci130x_core_eclic.h”

void iwdg_test() { /* Enable IWDG controller clock */

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
scu_set_device_gate(HAL_IWDG_BASE, ENABLE);

/* Enable IWDG interrupt */

eclic_irq_enable(IWDG_IRQn);

/* Enable IWDG reset configuration */

dpmu_iwdg_reset_system_config();

/* Initialize IWDG */

iwdg_init_t init;
init.irq = iwdg_irqen_enable;         // Interrupt enable
init.res = iwdg_resen_enable;         // Reset enable
init.count = get_src_clk() / 16;      // IWDG clock = src clock / 16

iwdg_init(IWDG,init);

/* Start IWDG */

iwdg_open(IWDG);

/* Feed the watchdog */

iwdg_feed(IWDG);

}

5、API Reference