---
# System prepended metadata

title: WatchDog
tags: [Watchdog, Gemini, Thermal_Vacuum]

---

# WatchDog
###### tags: `Gemini`, `Watchdog`
###### src: **task_watchdog.c**
---
## 相關package
```C=
#include "FreeRTOS.h"
#include "os_task.h"
```
```C=
#include "HL_sys_common.h"
#include "HL_system.h"
#include "HL_rti.h"
```
```C=
#include "user_sci.h"
#include "global.h"
#include "task_watchdog.h"
```
## 變數
- define
    ```C=
    #define RTICLK ( configCPU_CLOCK_HZ )

    #define WATCHDOG_EXPIRED_TIME 16 // 0 ~ 16.777216 second
    #define WATCHDOG_PRELOAD_VALUE (((WATCHDOG_EXPIRED_TIME*RTICLK) >> 13) - 1)
    ```

## pre-designed function
- void **vTask_watchdog**(void *pvParameters)
    - initialize
    > dwdInit(rtiREG1, WATCHDOG_PRELOAD_VALUE);
    dwdCounterEnable(rtiREG1);
    
    - loop
        > **/ should large than zero /**
        vTaskDelay((WATCHDOG_EXPIRED_TIME - 1) * 1000);
          **/ reset the watchdog /**
        dwdReset(rtiREG1);

---
###### tags: `Gemini`, `Thermal_Vacuum`