Skip to content

Commit 8851a83

Browse files
Jandro20carlescufi
authored andcommitted
samples: Added README for watchdog sample
Added README for watchdog sample in rst format Signed-off-by: Alejandro Hidalgo Muñoz de Rivera <[email protected]>
1 parent 483126f commit 8851a83

File tree

1 file changed

+55
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)