0% found this document useful (0 votes)
8 views13 pages

Watchdog Timer Management Guide

This application note details the management of the Talaria TWO watchdog timer, which is a down-counting timer that triggers a system reset when it reaches zero. It provides functions for initialization, starting, and periodically resetting the timer to prevent system resets, along with a sample application code. Support and disclaimers regarding the use of the document and associated products are also included.

Uploaded by

jittu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views13 pages

Watchdog Timer Management Guide

This application note details the management of the Talaria TWO watchdog timer, which is a down-counting timer that triggers a system reset when it reaches zero. It provides functions for initialization, starting, and periodically resetting the timer to prevent system resets, along with a sample application code. Support and disclaimers regarding the use of the document and associated products are also included.

Uploaded by

jittu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Talaria TWOTM (INP2045)

Low Power Multi-Protocol Wireless Platform SoC


IEEE 802.11 b/g/n, BLE 5.0

Application Note
Watchdog Reset
Release: 11-21-2019

InnoPhase, Inc.
6815 Flanders Drive
San Diego, CA 92121
[Link]

Copyright © InnoPhase, Inc. 2021, All Rights Reserved


Watchdog Reset

Revision History

Version Number Date Comments


1.0 04-23-2020 First release

Version 1.0 1 ©InnoPhase Inc.,2021


Watchdog Reset

Contents
1 Figures ...................................................................................................................................... 3
2 Introduction ............................................................................................................................. 4
3 Watchdog Timer ...................................................................................................................... 4
3.1 Sample Application 1: wdreset.c.................................................................................. 5
3.2 Running the Application .................................................................................................... 8
3.3 Expected Output ................................................................................................................ 9
4 Support .................................................................................................................................. 11
5 Disclaimers ............................................................................................................................. 12

Version 1.0 2 ©InnoPhase Inc.,2021


Watchdog Reset

1 Figures
Figure 1: [Link] - Download tool output....................................................................................................... 8

Version 1.0 3 ©InnoPhase Inc.,2021


Watchdog Reset

2 Introduction
This application note describes managing the Talaria TWO watchdog timer using the functions
provided by the watchdog driver.

3 Watchdog Timer
The watchdog driver provides functions for managing the Talaria TWO watchdog timer.
It is a down-counting timer that generates a system reset (or an interrupt) when the counter reaches
zero. The timer is started with an application specific timeout via the watchdog_init() and
watchdog_start() functions. The client application uses the watchdog_kick() function to
periodically reload the counter to its initial value to avoid it counting to zero.
Depending on what the application wants to supervise using this watchdog, the watchdog_kick()
may be performed from contexts. If the goal is to make sure that a certain real-time response time is
required on a particular thread priority level, a dedicated thread on this priority level should kick the
watchdog. Failure to meet the real-time response will then lead to a system reset. Another use-case is
to supervise on interrupt level. In this case, the watchdog should be kicked from an interrupt service
handler on a timer interrupt that is scheduled at an interval slightly lower than the watchdog timeout.

Version 1.0 4 ©InnoPhase Inc.,2021


Watchdog Reset

3.1 Sample Application 1: wdreset.c


#include <kernel/os.h>

#include <kernel/callout.h>

#include <kernel/io.h>

#include <kernel/hwreg.h>

#include <kernel/watchdog.h>

#define WATCHDOG_TIMEOUT SYSTIME_MS(487)

static struct os_semaphore wakeup_event;

static void

wakeup_callback(struct callout *c)

os_sem_post(&wakeup_event);

static void

kick_the_dog(struct callout *c)

static uint32_t num_kicks;

pr_always("Kick\n");

watchdog_kick();

if (++num_kicks < 30)

callout_schedule(c, WATCHDOG_TIMEOUT * 9 / 10);

else

pr_always("Last kick\n");

Version 1.0 5 ©InnoPhase Inc.,2021


Watchdog Reset

static void

expire_cb()

/* Do Stuff here */

uint8_t trip = WDG_TRIP_ENABLE_PAUSE;

uint32_t value;

/* Route watchdog reset to POR */

mmio_wr8_set(PMU_RST_MASK_POR, &hw_pmu->rst_mask[1]);

mmio_wr8_clr(PMU_RST_MASK_POR, &hw_pmu->rst_mask[2]);

trip |= WDG_TRIP_RESET;

mmio_wr8(trip, &hw_wdg->trip);

int

main(void)

struct callout wakeup;

struct callout kicker;

callout_init(&wakeup, wakeup_callback);

os_sem_init(&wakeup_event, 0);

watchdog_init(WATCHDOG_TIMEOUT, expire_cb);

pr_always("Starting watchdog\n");

watchdog_start();

Version 1.0 6 ©InnoPhase Inc.,2021


Watchdog Reset

callout_init_soft(&kicker, kick_the_dog);

callout_schedule(&kicker, WATCHDOG_TIMEOUT * 9 / 10);

for (;;) {

os_suspend_enable();

callout_schedule(&wakeup, SYSTIME_SEC(2));

pr_always("Sleeping\n");

os_sem_wait(&wakeup_event);

pr_always("Awake\n");

os_suspend_disable();

os_usleep(SYSTIME_SEC(4));

Here, we create a function called kick_the_dog()which calls watchdog_kick()before


the watchdog timer expires. Every time watchdog_kick() is called, it resets the watchdog
timer that we set using watchdog_init(). After the 30th call of watchdog_kick(), we no
longer call it and thus the watchdog timer expires.
uint32_t watchdog_init(uint32_t timeout_us, void(*expire_cb)(void))

The expire_cb argument of watchdog_init()may be a function that is called (in interrupt


context) when the watchdog expires. If expire_cb is passed a NULL value, then the default
action is to do a system reset.

Version 1.0 7 ©InnoPhase Inc.,2021


Watchdog Reset

3.2 Running the Application


Program [Link] using the Download tool. Launch the Download tool provided with
InnoPhase Talaria TWO SDK. In the GUI window, select the appropriate EVK from the drop-down
and load the [Link]. Prog RAM or Prog Flash as per requirement.

(For details on using the Download tool, refer to the Download Tool User Guide)

Figure 1: [Link] - Download tool output

Version 1.0 8 ©InnoPhase Inc.,2021


Watchdog Reset

3.3 Expected Output


FLASH:PNWWAE

Build $Patch: git-97ea9fecf $ $Id: git-da63701bb $

$App:git-9b4efae

SDK Ver: sdk_2.2

Lpuart Tx Demo App

UART:NWWAE

Build $Patch: git-97ea9fecf $ $Id: git-da63701bb $

$App:git-9b4efae

SDK Ver: sdk_2.2

Watchdog Reset Demo App

Starting watchdog

Sleeping

Kick

Kick

Awake

Kick

Kick

Kick

Kick

Sleeping

Kick

Awake

Kick

Kick

Kick

Kick

Sleeping

Version 1.0 9 ©InnoPhase Inc.,2021


Watchdog Reset

Kick

Awake

Kick

Kick

Kick

Kick

Sleeping

Kick

Awake

Kick

Kick

Kick

Kick

Sleeping

Kick

Awake

Kick

Kick

Kick

Kick

Sleeping

Kick

Awake

Kick

Kick

Kick

Last kick

Version 1.0 10 ©InnoPhase Inc.,2021


Watchdog Reset

4 Support
1. Sales Support: Contact an InnoPhase sales representative via email – sales@[Link]
2. Technical Support:
a. Visit: [Link]
b. Also Visit: [Link]
c. Contact: support@[Link]
InnoPhase has offices in USA, Asia and Europe diligently providing outstanding support to all its
customers.

Version 1.0 11 ©InnoPhase Inc.,2021


Watchdog Reset

5 Disclaimers
Limited warranty and liability — Information in this document is believed to be accurate and reliable.
However, InnoPhase Incorporated does not give any representations or warranties, expressed or
implied, as to the accuracy or completeness of such information and assumes no liability associated
with the use of such information. InnoPhase Incorporated takes no responsibility for the content in this
document if provided by an information source outside of InnoPhase Incorporated.
InnoPhase Incorporated disclaims liability for any indirect, incidental, punitive, special or consequential
damages associated with the use of this document, applications and any products associated with
information in this document, whether or not such damages are based on tort (including negligence),
warranty, including warranty of merchantability, warranty of fitness for a particular purpose, breach of
contract or any other legal theory. Further, InnoPhase Incorporated accepts no liability and makes no
warranty, express or implied, for any assistance given with respect to any applications described herein
or customer product design, or the application or use by any customer’s third-party customer(s).
Notwithstanding any damages that a customer might incur for any reason whatsoever, InnoPhase
Incorporated’ aggregate and cumulative liability for the products described herein shall be limited in
accordance with the Terms and Conditions of identified in the commercial sale documentation for such
InnoPhase Incorporated products.
Right to make changes — InnoPhase Incorporated reserves the right to make changes to information
published in this document, including, without limitation, changes to any specifications and product
descriptions, at any time and without notice. This document supersedes and replaces all information
supplied prior to the publication hereof.
Suitability for use — InnoPhase Incorporated products are not designed, authorized or warranted to be
suitable for use in life support, life-critical or safety-critical systems or equipment, nor in applications
where failure or malfunction of an InnoPhase Incorporated product can reasonably be expected to
result in personal injury, death or severe property or environmental damage. InnoPhase Incorporated
and its suppliers accept no liability for inclusion and/or use of InnoPhase Incorporated products in such
equipment or applications and such inclusion and/or use is at the customer’s own risk.
All trademarks, trade names and registered trademarks mentioned in this document are property of
their respective owners and are hereby acknowledged.

Version 1.0 12 ©InnoPhase Inc.,2021

Common questions

Powered by AI

The sample application ensures periodic execution of tasks by using callouts, which are scheduled functions that execute tasks at defined intervals. Specifically, the kick_the_dog() function is scheduled to kick the watchdog timer at intervals slightly less than the watchdog timeout, ensuring that the watchdog is reset consistently before it expires. This scheduling is managed using the callout_schedule() function, providing a structured way to handle periodic task execution .

Including disclaimers in documentation is essential for InnoPhase to legally manage risk by formally notifying users of the limitations regarding product use and liability. These disclaimers protect the company by clarifying that they assume no responsibility for any damages resulting from product misuse, unauthorized applications, or failures in critical systems, thus minimizing potential legal and financial repercussions .

The watchdog timer addresses the problem of monitoring system activity and ensuring embedded systems do not become unresponsive due to software failures or malfunctions. In the Talaria TWO, it provides a fail-safe mechanism to trigger a system reset if the software fails to execute expected tasks within a designated timeframe, thus maintaining system reliability and ensuring real-time application performance standards are met .

An application might opt not to provide a custom expire callback function if the default action of performing a system reset is sufficient for fault recovery. This choice simplifies the design by utilizing the built-in fail-safe provided by the watchdog timer, ensuring that the system resets automatically in case of unresponsiveness or failure conditions without requiring additional custom logic .

The primary function of the watchdog timer in the Talaria TWO platform is to provide a mechanism for system reset or interrupt generation when a down-counting timer reaches zero. This is achieved through functions like watchdog_init(), watchdog_start(), and watchdog_kick(), which are used to start the timer and periodically reload the counter to prevent it from reaching zero, thus avoiding a reset. This mechanism ensures that certain application-specific constraints, like real-time response times, are met by kicking the watchdog from dedicated contexts or interrupt service handlers .

InnoPhase Incorporated states that their products are not designed, authorized, or warranted to be suitable for use in life support, life-critical, or safety-critical systems or equipment. They specify that their products should not be used where failure can result in personal injury, death, or significant property or environmental damage, indicating such use is at the customer's own risk .

The function watchdog_init() is responsible for initializing the watchdog timer with a specified timeout value and setting up an expire callback function. This function configures the watchdog to trigger the callback when the timer expires. If the expire_cb parameter is passed as NULL, the system defaults to performing a system reset upon expiration. This setup allows for flexible management of timer expiration responses .

Interrupt service handlers can be used to kick the watchdog timer from an interrupt context. This is necessary when the application needs to ensure that deadlines are met at interrupt levels, providing a mechanism to reload the watchdog timer from within a handler that executes on timer interrupts. This setup helps to maintain system stability by ensuring periodic watchdog kicks, reducing the risk of unexpected resets if the system is functioning correctly .

Failure to meet real-time response requirements when using the watchdog timer can lead to a system reset. If the application does not kick the watchdog within the specified timeout period, indicating a delay or fault in meeting the expected real-time processes, the watchdog timer will elapse and initiate a reset. This mechanism enforces timely execution but requires careful timing and scheduling to avoid unintended system resets .

In the sample application, the function kick_the_dog() is used to call watchdog_kick() before the watchdog timer expires. This function is scheduled to execute at intervals slightly shorter than the watchdog timeout using the callout_schedule() function. The process repeats until the 30th call, after which it stops calling watchdog_kick(), allowing the timer to expire and potentially trigger a system reset or other specified action .

You might also like