zephyr/samples/drivers/watchdog
Torsten Rasmussen b9f3d68863 samples: tests: additional overlay and conf file adjustments
Adjustments of overlay and conf files to adjust for the MERGE removal.

The revert of MERGE requires specific overlay and conf files for boards
which relied on the MERGE feature.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-04-09 23:35:54 +02:00
..
boards samples: tests: additional overlay and conf file adjustments 2024-04-09 23:35:54 +02:00
src samples: watchdog: add support for NXP FS26 watchdog 2023-08-01 09:51:16 +02:00
CMakeLists.txt cmake: increase minimal required version to 3.20.0 2021-08-20 09:47:34 +02:00
prj.conf samples: Use immediate logging mode in watchdog related samples 2022-12-10 09:45:02 +01:00
README.rst doc: driver: samples: Update driver samples to use new Sphinx extension 2023-09-22 09:21:43 +02:00
sample.yaml samples: drivers: watchdog testing on stm32c031 nucleo board 2024-03-03 19:00:18 +01:00

.. zephyr:code-sample:: watchdog
   :name: Watchdog
   :relevant-api: watchdog_interface

   Use the watchdog driver API to reset the board when it gets stuck in an infinite loop.

Overview
********

This sample demonstrates how to use the watchdog driver API.

A typical use case for a watchdog is that the board is restarted in case some piece of code
is kept in an infinite loop.

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

In this sample, a watchdog callback is used to handle a timeout event once. This functionality is used to request an action before the board
restarts due to a timeout event in the watchdog driver.

The watchdog peripheral is configured in the board's ``.dts`` file. Make sure that the watchdog is enabled
using the configuration file in ``boards`` folder.

Building and Running for ST Nucleo F091RC
=========================================

The sample can be built and executed for the
:ref:`nucleo_f091rc_board` as follows:

.. zephyr-app-commands::
	:zephyr-app: samples/drivers/watchdog
	:board: nucleo_f091rc
	:goals: build flash
	:compact:

To build for another board, change "nucleo_f091rc" to the name of that board and provide a corresponding devicetree overlay.

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

You should get a similar output as below:

.. code-block:: console

	Watchdog sample application
	Attempting to test pre-reset callback
	Feeding watchdog 5 times
	Feeding watchdog...
	Feeding watchdog...
	Feeding watchdog...
	Feeding watchdog...
	Feeding watchdog...
	Waiting for reset...
	Handled things..ready to reset

.. note:: After the last message, the board will reset and the sequence will start again