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