File tree 5 files changed +104
-1
lines changed
arch/arm/soc/nxp_kinetis/kwx 5 files changed +104
-1
lines changed Original file line number Diff line number Diff line change @@ -112,8 +112,13 @@ static int kwx_init(struct device *arg)
112
112
/* disable interrupts */
113
113
oldLevel = irq_lock ();
114
114
115
- /* Disable the watchdog */
115
+ /* Configure or disable the watchdog */
116
+ #if defined(CONFIG_WATCHDOG )
117
+ /* 1kHz LPC clock, 2^13 cycles = 8192ms */
118
+ SIM -> COPC = SIM_COPC_COPCLKSEL (00 ) | SIM_COPC_COPCLKS (1 ) | SIM_COPC_COPT (01 );
119
+ #else
116
120
SIM -> COPC = 0 ;
121
+ #endif
117
122
118
123
/* Initialize system clock to 40 MHz */
119
124
clkInit ();
Original file line number Diff line number Diff line change
1
+
2
+ include ($ENV{ZEPHYR_BASE} /cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
3
+ project (NONE)
4
+
5
+ target_sources (app PRIVATE src/main.c)
6
+ target_sources (app PRIVATE $ENV{ZEPHYR_BASE} /ext /hal/nxp/mcux/drivers/fsl_vref.c)
Original file line number Diff line number Diff line change
1
+ CONFIG_STDOUT_CONSOLE=y
2
+ CONFIG_WATCHDOG=y
Original file line number Diff line number Diff line change
1
+ sample :
2
+ description : Hello World sample, the simplest Zephyr
3
+ application
4
+ name : hello world
5
+ platforms : all
6
+ common :
7
+ tags : samples
8
+ harness : console
9
+ harness_config :
10
+ type : one_line
11
+ regex :
12
+ - " Hello World! (.*)"
13
+ tests :
14
+ singlethread :
15
+ extra_args : CONF_FILE=prj_single.conf
16
+ filter : not CONFIG_BT and not CONFIG_GPIO_SCH and ASSERT == 0
17
+ test :
18
+ tags : samples
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2018 blik GmbH
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @file main.c
9
+ *
10
+ * @copyright 2018 blik GmbH
11
+ *
12
+ * @author Alexander Preißner <[email protected] >
13
+ *
14
+ * This is a sample application that demonstrates how to use the KW41Z
15
+ * Watchdog Timer.
16
+ */
17
+
18
+ /*----------------------------------------------------------------------------*/
19
+ /* HEADERS */
20
+ /*----------------------------------------------------------------------------*/
21
+
22
+ #include <zephyr.h>
23
+
24
+ #include <misc/printk.h>
25
+
26
+ #include <fsl_common.h>
27
+ #include <misc/util.h>
28
+
29
+
30
+ /*----------------------------------------------------------------------------*/
31
+ /* MACROS */
32
+ /*----------------------------------------------------------------------------*/
33
+
34
+ /**
35
+ * @brief Watchdog Timer reload sequence
36
+ *
37
+ * The exact sequence 0x55 and 0xAA MUST be written to the SRVCOP register
38
+ * in order to reload the Watchdog Timer.
39
+ */
40
+ #if defined(CONFIG_WATCHDOG )
41
+ #define WDT_RELOAD () SIM->SRVCOP = SIM_SRVCOP_SRVCOP(0x55); \
42
+ SIM->SRVCOP = SIM_SRVCOP_SRVCOP(0xAA)
43
+ #else
44
+ #define WDT_RELOAD ()
45
+ #endif
46
+
47
+ /**
48
+ * @brief Switch defining whether watchdog timer is reloaded or not in this
49
+ * sample.
50
+ *
51
+ * If this variable is '0' "Hello blik!" should be printed to STDOUT every
52
+ * 8.192 seconds.
53
+ */
54
+ #define RELOAD_WATCHDOG 0
55
+
56
+
57
+ /**
58
+ * @brief Function for Main thread
59
+ */
60
+ void main (void ) {
61
+ // Print what this sample is about
62
+ printk ("Hello blik!\n" );
63
+
64
+ while (RELOAD_WATCHDOG )
65
+ {
66
+ WDT_RELOAD ();
67
+
68
+ k_sleep (1000 );
69
+ }
70
+
71
+ return ;
72
+ }
You can’t perform that action at this time.
0 commit comments