• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

boards/03-Apr-2024-308247

src/03-Apr-2024-149103

CMakeLists.txtD03-Apr-2024190 85

README.rstD03-Apr-20241.6 KiB5740

prj.confD03-Apr-2024115 65

sample.yamlD03-Apr-20243 KiB113112

README.rst

1.. zephyr:code-sample:: watchdog
2   :name: Watchdog
3   :relevant-api: watchdog_interface
4
5   Use the watchdog driver API to reset the board when it gets stuck in an infinite loop.
6
7Overview
8********
9
10This sample demonstrates how to use the watchdog driver API.
11
12A typical use case for a watchdog is that the board is restarted in case some piece of code
13is kept in an infinite loop.
14
15Building and Running
16********************
17
18In this sample, a watchdog callback is used to handle a timeout event once. This functionality is used to request an action before the board
19restarts due to a timeout event in the watchdog driver.
20
21The watchdog peripheral is configured in the board's ``.dts`` file. Make sure that the watchdog is enabled
22using the configuration file in ``boards`` folder.
23
24Building and Running for ST Nucleo F091RC
25=========================================
26
27The sample can be built and executed for the
28:ref:`nucleo_f091rc_board` as follows:
29
30.. zephyr-app-commands::
31	:zephyr-app: samples/drivers/watchdog
32	:board: nucleo_f091rc
33	:goals: build flash
34	:compact:
35
36To build for another board, change "nucleo_f091rc" to the name of that board and provide a corresponding devicetree overlay.
37
38Sample output
39=============
40
41You should get a similar output as below:
42
43.. code-block:: console
44
45	Watchdog sample application
46	Attempting to test pre-reset callback
47	Feeding watchdog 5 times
48	Feeding watchdog...
49	Feeding watchdog...
50	Feeding watchdog...
51	Feeding watchdog...
52	Feeding watchdog...
53	Waiting for reset...
54	Handled things..ready to reset
55
56.. note:: After the last message, the board will reset and the sequence will start again
57