Intel:Platform Designer の Interval Timer コアを Watch Dog Timer として使用する場合、ソフトウェアではどのように処理すべきですか?

プラットフォーム・デザイナー

カテゴリ:IP
ツール:-
デバイス:-


Watch Dog Timer のカウントダウンを開始するには control レジスタの START bit に 1 をライトします。
カウンタをリセットしてリロードさせるためには、いずれかの period レジスタに対して
任意のデータのライトします。(値は意味を持ちません。)

(参考)
Embedded Peripherals IP User Guide
https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_embedded_ip.pdf
(23.3.4. Configuring the Timer as a Watchdog Timer の項目をご参照ください。)

以下はサンプルコードです。

#include <stdio.h>
#include <unistd.h>

#include "system.h"
#include "altera_avalon_timer.h"
#include "altera_avalon_timer_regs.h"
#include "altera_avalon_pio_regs.h"

// If you want to use timer as WDT, sys_clk_timer feature should not be used in bsp-editor.

// Please Select - 1: kick wdt in app / 0: No kick wdt in app(Will be reset)
#define WDT_KICK (0)

#define LED_BLINK_PERIOD_MS (250)

static int boot_count = 1; //if 0, it will assigned to bss. so initial value is 1, in this case it will assign to rwdata.

int main() {
printf("Hello from Nios II!\n");
printf("Boot Count = 0x%x \n", boot_count++);

//Start WDT
    IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_0_BASE, ALTERA_AVALON_TIMER_CONTROL_START_MSK);

while(1){
        IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 0xFF);
        usleep(1000 * LED_BLINK_PERIOD_MS);
        IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 0x00);
        usleep(1000 * LED_BLINK_PERIOD_MS);
#if WDT_KICK
        //Write Dummy Value to restart a timer
        IOWR_ALTERA_AVALON_TIMER_PERIODL(TIMER_0_BASE, 0xff);
#endif
    }

return 0;
}



経験豊富なFAEが
無料でご相談を承ります。

特定製品の仕様からパーツの選定まで、当社のFAEが皆様のテクニカルなお悩みに無料で回答します。ぜひ、お気軽にご相談ください。