Intel: How should software handle using Platform Designer's Interval Timer core as a Watch Dog Timer?

platform designer

Category: IP
tool:-
device:-


To start the Watch Dog Timer countdown, write 1 to the START bit of the control register.
to any period register to reset and reload the counter.
Write arbitrary data. (The value has no meaning.)

(reference)
Embedded Peripherals IP User Guide
https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_embedded_ip.pdf
(See section 23.3.4. Configuring the Timer as a Watchdog Timer.)

Below is a sample code.

#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 be 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;
}



Experienced FAE
Free consultation is available.

From specific product specifications to parts selection, the Company FAE will answer your technical concerns free of charge. Please feel free to contact us.