zephyr/samples/subsys/task_wdt
Flavio Ceolin 6e9f4bb6d6 samples: task_wdt: Use wdt device if it is ready
hw_wdt_dev may not be NULL and the device not be ready to be used.
If that is the case we explicitely initialize task_wdt_init with
NULL and do not use hw watchdog.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2025-03-19 01:24:56 +01:00
..
boards boards: mr_canhubk3: enable SWT watchdog 2024-08-03 05:58:46 -05:00
src samples: task_wdt: Use wdt device if it is ready 2025-03-19 01:24:56 +01:00
CMakeLists.txt
prj.conf samples: Use immediate logging mode in watchdog related samples 2022-12-10 09:45:02 +01:00
README.rst boards: st: adopt new zephyr:board directive and role 2024-10-24 17:51:15 +02:00
sample.yaml boards: mr_canhubk3: enable SWT watchdog 2024-08-03 05:58:46 -05:00

.. zephyr:code-sample:: task-wdt
   :name: Task watchdog
   :relevant-api: task_wdt_api

   Monitor a thread using a task watchdog.

Overview
********

This sample allows to test the :ref:`task watchdog <task_wdt_api>` subsystem.

Building and Running
********************

It should be possible to build and run the task watchdog sample on almost any
board. If a hardware watchdog is defined in the devicetree, it is used as a
fallback. Otherwise the task watchdog will run independently.

Building and Running for ST Nucleo L073RZ
=========================================
The sample can be built and executed for the
:zephyr:board:`nucleo_l073rz` as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/task_wdt
   :board: nucleo_l073rz
   :goals: build flash
   :compact:

For other boards just replace the board name.

Sample output
=============

The following output is printed and continuously repeated (after each
reset):

.. code-block:: console

   Task watchdog sample application.
   Main thread still alive...
   Control thread started.
   Main thread still alive...
   Main thread still alive...
   Main thread still alive...
   Control thread getting stuck...
   Main thread still alive...
   Task watchdog channel 1 callback, thread: control
   Resetting device...