Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Watchdog Timer Example

Purpose

This example uses a push button event to simulate a deadlock in program so as to demonstrate how watchdog timer works.

Requirements

This package can be used with SAM evaluation kits.

Descriptions

At first, the example configures the pins of LED and Console UART, enables the watchdog timer, and then prints some information via UART. Before user presses the push button that the information mentions, the LED keeps blinking and the counter of the watchdog timer is restarted before any fault of the watchdog timer occurs (the interrupt in this case). The example enters a deadlock status after user presses the push button and it causes that the counter will not be restarted until a fault occurs (the interrupt). In the interrupt handler, the counter is restarted.

Usage

  1. Compile the application.
  2. Connect the UART port of the evaluation board to the computer and open it in a terminal.
    • Settings: 115200 bauds, 8 bits, 1 stop bit, no parity, no flow control.
  3. Download the program into the evaluation board and run it.
  4. Upon startup, the application will output the following lines on the UART:
    -- Watchdog with IRQ Interrupt Example --
    -- xxxxxx-xx
    -- Compiled: xxx xx xxxx xx:xx:xx --
  5. Press the push button on board.
    Press xxx to simulate a deadlock loop.