<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file</link><description>Hello, 
 I am using the task watchdog sample to test the task watchdog subsystem. It is working fine. 
 I would like to use a hardware watchdog as a fallback; for this I need to define it in the devicetree or an overlay file. 
 How can I do either of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 12 Jan 2024 12:04:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file" /><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/463965?ContentTypeID=1</link><pubDate>Fri, 12 Jan 2024 12:04:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6845ad9a-b1ad-411b-8e26-52964b7f5e67</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/463946"]There is &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html"&gt;partition manager&lt;/a&gt;&amp;nbsp;and a pm_xxx.yml file which serves similar purpose but it is not the exact same replace of flash_placement.xml.[/quote]
&lt;p&gt;I am afraid it is still not clear what I should be doing to make a section of RAM retainable after a reset.&lt;/p&gt;
&lt;p&gt;I may try this as suggested in this thread &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/79995/watchdog-event-handler-timeout,"&gt;devzone.nordicsemi.com/.../watchdog-event-handler-timeout,&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;#define RETAINED_BUFFER_SIZE 16&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;static int8_t m_retained_buffer[RETAINED_BUFFER_SIZE] __attribute__ ((section(&amp;quot;.non_init&amp;quot;)));&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;But I am not sure where I can add the &lt;strong&gt;&lt;em&gt;keep = &amp;quot;Yes&amp;quot;&lt;/em&gt;&lt;/strong&gt; setting.&lt;/p&gt;
&lt;p&gt;An example applicable to my environment (nRF52833, SES SDK v1.7.0) would help.&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/463946?ContentTypeID=1</link><pubDate>Fri, 12 Jan 2024 10:23:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02929a17-a0ef-42ec-8eee-7d66b17c8e1d</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Learner"]&lt;p&gt;I cannot find the file&amp;nbsp;&lt;span&gt;&lt;strong&gt;flash_placement.xml&lt;/strong&gt;&amp;nbsp;where the line containing &lt;strong&gt;.non_init&lt;/strong&gt;&amp;nbsp;is mentioned.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is there another equivalent file?&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;There is &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html"&gt;partition manager&lt;/a&gt;&amp;nbsp;and a pm_xxx.yml file which serves similar purpose but it is not the exact same replace of flash_placement.xml.&lt;/p&gt;
[quote user="Learner"]&amp;quot;&lt;strong&gt;(Also, the degree of which RAM content persists may depend on several other factors as well, and this is using the IC out of specification, so &lt;span style="background-color:rgba(255, 255, 0, 1);"&gt;you can never be guaranteed that RAM data is retained after a reset&lt;/span&gt;.)&lt;/strong&gt;&amp;quot;.[/quote]
&lt;p&gt;Yes, if you &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fpower.html&amp;amp;anchor=unique_961802881"&gt;see this table &lt;/a&gt;and the note below it it says that&amp;nbsp;&lt;em&gt;&lt;strong&gt;RAM[n].POWER are retained registers, see&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html#unique_961802881"&gt;Reset behavior&lt;/a&gt;.&lt;/strong&gt;&lt;/em&gt; It also says that&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;Note: The RAM is never reset, but depending on reset source, RAM content may be corrupted.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In my experience Softreset and rest from whakeup from systemoff should be fine, but other kind of resets might not guarantee the stability of power to RAM block. So hence the disclaimer. Also many start up codes in our SDKs overwrite the RAM.X registers quite early in the startup code, so you should be aware that they might reset the default retention setting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/463221?ContentTypeID=1</link><pubDate>Mon, 08 Jan 2024 17:50:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab38d058-665a-4953-a232-755b1f1981a1</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/463172"]You need to save the data in RAM and not flash if you have to write more than a word in the wdt_callback. This topic is covered and discussed in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/79995/watchdog-event-handler-timeout"&gt;this thread&lt;/a&gt;[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I cannot find the file&amp;nbsp;&lt;span&gt;&lt;strong&gt;flash_placement.xml&lt;/strong&gt;&amp;nbsp;where the line containing &lt;strong&gt;.non_init&lt;/strong&gt;&amp;nbsp;is mentioned.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is there another equivalent file?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Plus, according to Einar Thorsrud,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;&lt;strong&gt;(Also, the degree of which RAM content persists may depend on several other factors as well, and this is using the IC out of specification, so &lt;span style="background-color:#ffff00;"&gt;you can never be guaranteed that RAM data is retained after a reset&lt;/span&gt;.)&lt;/strong&gt;&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Mohamed&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/463220?ContentTypeID=1</link><pubDate>Mon, 08 Jan 2024 17:50:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d3c3cc1-8e73-459b-bae3-837f25cce303</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/463172"]You need to save the data in RAM and not flash if you have to write more than a word in the wdt_callback. This topic is covered and discussed in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/79995/watchdog-event-handler-timeout"&gt;this thread&lt;/a&gt;[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I cannot find the file&amp;nbsp;&lt;span&gt;&lt;strong&gt;flash_placement.xml&lt;/strong&gt;&amp;nbsp;where the line containing &lt;strong&gt;.non_init&lt;/strong&gt;&amp;nbsp;is mentioned.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is there another equivalent file?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Plus, according to Einar Thorsrud,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;&lt;strong&gt;(Also, the degree of which RAM content persists may depend on several other factors as well, and this is using the IC out of specification, so &lt;span style="background-color:#ffff00;"&gt;you can never be guaranteed that RAM data is retained after a reset&lt;/span&gt;.)&lt;/strong&gt;&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Mohamed&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/463172?ContentTypeID=1</link><pubDate>Mon, 08 Jan 2024 14:02:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6952c15e-9db5-437e-b466-2919d52f2713</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Learner"]&lt;p&gt;2- What is the difference between the hardware watchdog and the task watchdog?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CONFIG_WATCHDOG=y&lt;/strong&gt; versus&amp;nbsp;&lt;strong&gt;CONFIG_TASK_WDT=y&lt;/strong&gt;&lt;/p&gt;[/quote]
&lt;p&gt;You need CONFIG_WATCHDOG to use &lt;a href="https://docs.zephyrproject.org/apidoc/latest/group__watchdog__interface.html"&gt;watchdog_api&lt;/a&gt;&amp;nbsp;this inturn uses nrfx drivers.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;CONFIG_TASK_WDT is a firmware feature on top of the above watchdog which provides multiple channel usage of watchdog feature instead of the normal (only one) in most of the hardware watchdog.&lt;/p&gt;
[quote user="Learner"] Please answer the question above. I need to&amp;nbsp;store&amp;nbsp;in flash this watchdog reset event but I am not sure how I can do it without running out of time before the actual reset occurs. Is there a way of delaying the task_watchdog reset until I finish tidying up?[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You need to save the data in RAM and not flash if you have to write more than a word in the wdt_callback. This topic is covered and discussed in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/79995/watchdog-event-handler-timeout"&gt;this thread&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/462765?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2024 17:07:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b1d0eab-2374-45c5-ba3b-621c38bbe71f</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;Happy new year to you too.&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/462691"]&lt;div class="quote-user"&gt;Learner said:&lt;/div&gt;&lt;div class="quote-content"&gt;&lt;div&gt;I am printing the reset reason in my callback function&amp;nbsp;&lt;strong&gt;task_wdt_callback_t task_wdt_callback()&lt;/strong&gt; expecting it to be 2 since it was caused by a task watchdog timeout, instead I am getting &lt;strong&gt;reason = 0&lt;/strong&gt;.&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;printf( &amp;quot;Reas = %u\n&amp;quot;, NRF_POWER-&amp;gt;RESETREAS );&lt;/strong&gt;&lt;/div&gt;&lt;/div&gt;[/quote]
&lt;p&gt;1- Actually things have moved on now and I am getting this reset reason&amp;nbsp;&lt;strong&gt;SYSTEM_RESET_SOFTWARE&lt;/strong&gt; &lt;strong&gt;(0x4)&lt;/strong&gt;.&amp;nbsp;Maybe I should have added that once the task watchdog times out I am calling the function&amp;nbsp;&lt;strong&gt;sys_reboot(SYS_REBOOT_COLD)&lt;/strong&gt; from the &lt;strong&gt;task_wdt_callback()&lt;/strong&gt; function. I think this is why I am getting the software reset reason.&lt;/p&gt;
&lt;p&gt;2- What is the difference between the hardware watchdog and the task watchdog?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CONFIG_WATCHDOG=y&lt;/strong&gt; versus&amp;nbsp;&lt;strong&gt;CONFIG_TASK_WDT=y&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="92434" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/461648"]Finally, when I try to write to flash in the callback function&amp;nbsp;&lt;strong&gt;task_wdt_callback()&lt;/strong&gt;, &lt;strong&gt;nvs_write()&lt;/strong&gt; is returning the error&amp;nbsp;&lt;strong&gt;ECANCELED&lt;/strong&gt; (140) meaning the write operation has been cancelled. Is it because, as stated in the &lt;strong&gt;task_wdt&lt;/strong&gt; example comments, the callback has only &lt;strong&gt;61.2 us&lt;/strong&gt; to complete before the reset&amp;nbsp;occurs and writing to flash is taking longer than this?[/quote]
&lt;p&gt;3- Please answer the question above. I need to&amp;nbsp;store&amp;nbsp;in flash this watchdog reset event but I am not sure how I can do it without running out of time before the actual reset occurs. Is there a way of delaying the task_watchdog reset until I finish tidying up?&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/462691?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2024 13:06:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e78604a-27ac-43ad-bf84-505f6bbef777</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Thanks for waiting Mohamed, Happy New Year. I am just back from the holidays and wondering if you still have this issue or have you found the way to fix it?&lt;/p&gt;
[quote user="Learner"]Is it because I am refreshing the task watchdog timer every second?[/quote]
&lt;p&gt;That could be.&lt;/p&gt;
[quote user="Learner"]&lt;div&gt;I am printing the reset reason in my callback function&amp;nbsp;&lt;strong&gt;task_wdt_callback_t task_wdt_callback()&lt;/strong&gt; expecting it to be 2 since it was caused by a task watchdog timeout, instead I am getting &lt;strong&gt;reason = 0&lt;/strong&gt;.&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;printf( &amp;quot;Reas = %u\n&amp;quot;, NRF_POWER-&amp;gt;RESETREAS );&lt;/strong&gt;&lt;/div&gt;[/quote]
&lt;p&gt;That is strange. Can you please give me your project for me to reproduce and debug this? Maybe the reset reason is cleared somewhere else in the code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/461757?ContentTypeID=1</link><pubDate>Wed, 27 Dec 2023 09:59:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9da3e6ce-c1d5-43c9-8e19-818fd401acdb</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Maria,&lt;/p&gt;
&lt;p&gt;Thank you for letting me know.&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/461731?ContentTypeID=1</link><pubDate>Wed, 27 Dec 2023 09:25:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a2e6b43-7438-4d54-b4a4-1f654d555282</guid><dc:creator>Maria Gilje</dc:creator><description>&lt;p&gt;Hi Mohamed,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;We are severely understaffed this week because of the Christmas holidays, and Susheel will have to get back to you on this next week. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;Sorry for the inconvenience.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/461648?ContentTypeID=1</link><pubDate>Sun, 24 Dec 2023 21:18:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ff4fead-13bc-4798-bcf6-e1aeab6246e1</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;For some obscure reason I am not seeing the watchdog timer timing out when I enable the hardware timer. It is rather worrying because I think it will come back at some point. However, let&amp;#39;s forget about it for now.&lt;/p&gt;
&lt;p&gt;My question now is this,&lt;/p&gt;
&lt;p&gt;How do I check that the hardware timer will timeout if the&amp;nbsp;the task watchdog does not work as expected?&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; In other words I would like to simulate the scenario where the hardware watchdog fallback is used instead of the task watchdog as suggested in this Nordic example, see its description below.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;...\v1.7.0\zephyr\samples\subsys\task_wdt&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;/*&lt;br /&gt;* To use this sample, either the devicetree&amp;#39;s /aliases must have a&lt;br /&gt;* &amp;#39;watchdog0&amp;#39; property, or one of the following watchdog compatibles&lt;br /&gt;* must have an enabled node.&lt;br /&gt;*&lt;br /&gt;* If the devicetree has a watchdog node, we get the watchdog device&lt;br /&gt;* from there. Otherwise, the task watchdog will be used without a&lt;br /&gt;*&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;hardware watchdog fallback&lt;/span&gt;.&lt;br /&gt;*/&lt;/p&gt;
&lt;div&gt;Also, I have set my task watchdog timer to 600000 ((one minute) but the maximum value&amp;nbsp;&lt;strong&gt;CONFIG_TASK_WDT_MIN_TIMEOUT &lt;/strong&gt;can take is 10000, so I am setting it to 10000 in prj.conf.&lt;/div&gt;
&lt;div&gt;According to the description of&amp;nbsp;static void task_wdt_trigger() you sent me above I was expecting this function to be called regularly but it is not.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Is it because I am refreshing the task watchdog timer every second?&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;I am printing the reset reason in my callback function&amp;nbsp;&lt;strong&gt;task_wdt_callback_t task_wdt_callback()&lt;/strong&gt; expecting it to be 2 since it was caused by a task watchdog timeout, instead I am getting &lt;strong&gt;reason = 0&lt;/strong&gt;.&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;printf( &amp;quot;Reas = %u\n&amp;quot;, NRF_POWER-&amp;gt;RESETREAS );&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;Can you please explain why this is the case?&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Finally, when I try to write to flash in the callback function&amp;nbsp;&lt;strong&gt;task_wdt_callback()&lt;/strong&gt;, &lt;strong&gt;nvs_write()&lt;/strong&gt; is returning the error&amp;nbsp;&lt;strong&gt;ECANCELED&lt;/strong&gt; (140) meaning the write operation has been cancelled. Is it because, as stated in the &lt;strong&gt;task_wdt&lt;/strong&gt; example comments, the callback has only &lt;strong&gt;61.2 us&lt;/strong&gt; to complete before the reset&amp;nbsp;occurs and writing to flash is taking longer than this?&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Kind regards&lt;/div&gt;
&lt;div&gt;Mohamed&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/459563?ContentTypeID=1</link><pubDate>Fri, 08 Dec 2023 18:19:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c17aed93-48b7-4cf5-8cba-7c322d002521</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/459521"]I think you misunderstood this feature. the callback in the&amp;nbsp;task_wdt_add will be triggered when the watchdog has already expired[/quote]
&lt;p&gt;Yes, I&amp;nbsp;agree.&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/459521"]I see, this is called the callback feature not the fallback feature.[/quote]
&lt;p&gt;Not according to the comment in Nordic&amp;#39;s example&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;...\v1.7.0\zephyr\samples\subsys\task_wdt&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;/*&lt;br /&gt; * To use this sample, either the devicetree&amp;#39;s /aliases must have a&lt;br /&gt; * &amp;#39;watchdog0&amp;#39; property, or one of the following watchdog compatibles&lt;br /&gt; * must have an enabled node.&lt;br /&gt; *&lt;br /&gt; * If the devicetree has a watchdog node, we get the watchdog device&lt;br /&gt; * from there. Otherwise, the task watchdog will be used without a&lt;br /&gt; * &lt;span style="background-color:#ffff00;"&gt;hardware watchdog fallback&lt;/span&gt;.&lt;br /&gt; */&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/459521"]If you see in the file&amp;nbsp;zephyr\subsys\task_wdt\task_wdt.c, you will see that the callback is called with&amp;nbsp;task_wdt_trigger-&amp;gt;&lt;span&gt;channels&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;channel_id&lt;/span&gt;&lt;span&gt;].&lt;/span&gt;&lt;span&gt;callback&lt;/span&gt;[/quote]
&lt;p&gt;Does&amp;nbsp;the&amp;nbsp;function&amp;nbsp;static void &lt;strong&gt;task_wdt_trigger(struct k_timer *timer_id)&lt;/strong&gt; get called when the &lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;hardware&lt;/span&gt; &lt;/strong&gt;watchdog timer timesout?&lt;/p&gt;
&lt;p&gt;In my prj.conf file I have,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CONFIG_TASK_WDT_MIN_TIMEOUT=100&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;whereas my task watchdog timer is set with 30000 ms&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;task_wdt_id = task_wdt_add(30000U, (task_wdt_callback_t)task_wdt_callback, NULL);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Must I set&amp;nbsp;&lt;strong&gt;CONFIG_TASK_WDT_MIN_TIMEOUT=30000&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;to avoid the problem I ma seeing?&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/459521?ContentTypeID=1</link><pubDate>Fri, 08 Dec 2023 13:20:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3edc13bf-9c76-4904-ad3e-5000bfcd1474</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Learner"]According to the comment in the Nordic&amp;#39;s example, it means if the watchdog timer task (based on kernel&amp;#39;s timers) does not timeout and does not perform as expected then the hardware watchdog timer will come into action.&amp;nbsp;You should be able to find the sample code at,[/quote]
&lt;p&gt;I see, this is called the callback feature not the fallback feature.&lt;/p&gt;
[quote user="Learner"]According to the comment in the Nordic&amp;#39;s example, it means if the watchdog timer task (based on kernel&amp;#39;s timers) does not timeout and does not perform as expected then the hardware watchdog timer will come into action.&amp;nbsp;You should be able to find the sample code at,[/quote]
&lt;p&gt;I think you misunderstood this feature. the callback in the&amp;nbsp;task_wdt_add will be triggered when the watchdog has already expired. That means that if you call wdt_feed function in this callback it will not reset the wdt timer. This callback function needs to be used in places to run put your device in safe mode where it should expect that the device reset will happen soon.&lt;/p&gt;
&lt;p&gt;If you see in the file&amp;nbsp;zephyr\subsys\task_wdt\task_wdt.c, you will see that the callback is called with&amp;nbsp;task_wdt_trigger-&amp;gt;&lt;span&gt;channels&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;channel_id&lt;/span&gt;&lt;span&gt;].&lt;/span&gt;&lt;span&gt;callback and the description of this function is here.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * @brief Task watchdog timer callback.
 *
 * If the device operates as intended, this function will never be called,
 * as the timer is continuously restarted with the next due timeout in the
 * task_wdt_feed() function.
 *
 * If all task watchdogs have longer timeouts than the hardware watchdog,
 * this function is called regularly (via the background channel). This
 * should be avoided by setting CONFIG_TASK_WDT_MIN_TIMEOUT to the minimum
 * task watchdog timeout used in the application.
 *
 * @param timer_id Pointer to the timer which called the function
 */
static void task_wdt_trigger(struct k_timer *timer_id)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/459240?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 16:45:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e84982c-32fd-481b-b3ed-a3daaf00f34a</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/459232"]I do not understand what fallback means here?&amp;nbsp;[/quote]
&lt;p&gt;According to the comment in the Nordic&amp;#39;s example, it means if the watchdog timer task (based on kernel&amp;#39;s timers) does not timeout and does not perform as expected then the hardware watchdog timer will come into action.&amp;nbsp;You should be able to find the sample code at,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;...\v1.7.0\zephyr\samples\subsys\task_wdt&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I am sorry Susheel but I am not allowed to share the whole main() with you. However, here is a skeleton version of it. Note, the functions dealing with wdt have the prefix, &amp;#39;wdgt_&amp;#39;.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void main( void )
{
    ...[snip]
    LOG_INF( &amp;quot;Booting-up time [%u s]\n&amp;quot;, time_s );

    /* Set up debug port first */
    system_SetDebugPortAccess();

    if ( initialise( device_mode ) == RESULT_OK )   
    {
        ...[snip]
        
        if ( device_mode )
        {
            /* Initialise only the i2c and mp2695 charger to be able to detect &amp;#39;mains&amp;#39; supply. */
            io_initialise_batt_charger();

            /* Initialise the rest of the peripheral devices after the we&amp;#39;ve detected &amp;#39;mains&amp;#39; supply. */
            io_initialise();

            LOG_INF(&amp;quot;Waiting for DC supply - Plug In&amp;quot;);

            /* Initialise the Watch Dog Timer Task */
            wdgt_init();

            /* wait for the charger to be plugged in to signal installation */
            for(;;)
            {
                batt_charger_get_info();

                if ( ( io.charger-&amp;gt;plugged_in == true ) &amp;amp;&amp;amp; ( ( io.charger-&amp;gt;charging == true ) || ( io.charger-&amp;gt;ChargeDone == true ) ) )
                {
                    /* Update the battery voltage value read from the ADC */
                    io_update_batteryvoltage();

                    if ( io.battery.mv_raw &amp;gt;= 2700 ) /*!!!TBD replace magic number 2700 with BATT_DISCHARGE_PROTECT */
                    {
                        LOG_INF( &amp;quot;Batt_raw = %d mV&amp;quot;, io.battery.mv_raw );

                        break;
                    }
                }

                LOG_INF( &amp;quot;Plug In DC - Charger Status: %d\n&amp;quot;, io.charger-&amp;gt;charging | io.charger-&amp;gt;ChargeDone );

                /* Feed the watchdog channel timer. */
                wdgt_refresh();

                k_sleep(K_MSEC(10)); 
            }

            LOG_INF(&amp;quot;Plugged&amp;quot;);
            k_sleep(K_MSEC(10));

            /* Initialise the radio state machine. */
            hb_radio_initialise();

            k_work_init( &amp;amp;homebeacon_radio_status_check, homebeacon_radio_check_status_tasks );

            /* Initialise the tamper button */
            io_tamper_button_initialise();

            /* Also, we can seed random number effectively */
            srand( time( NULL ) );

            io_led_off( RED_LED );

            while ( 1 )
            {
                ...[snip]
                
                if ( flash_static_data_copy_hb.shutdown_flag == POWER_SHUTDOWN_SOURCE_NONE )
                {
                    /* This is the path for normal operation */
                    if ( b_one_sec_tasks )
                    {
                        b_one_sec_tasks = FALSE;

                        /* Refresh the watchdog channel timer. */
                        wdgt_refresh();

                    ...[snip]
                    
                    }
                }/* POWER_SHUTDOWN_SOURCE_NONE */
                else
                {
                    /* This is the path when the device is in SHUTDOWN mode */
                    ...[snip]
                }
            }
        }
        else    /* device mode NOT known */
        {
            ...[snip]

            /* What else can we do? */
            LOG_INF( &amp;quot;Unsupported device mode\n&amp;quot; );
        }
    }
    else
    {
        /* Initialisation error condition */
        ...[snip]

        /* What else can we do? */
        LOG_INF( &amp;quot;Initialisation Failed\n&amp;quot; );
    }

}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note the same code works fine if the hardware watchdog is not defined i.e. this line is commented out.&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt;#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(nordic_nrf_watchdog)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;Kind regards&lt;/div&gt;
&lt;div&gt;Mohamed&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/459232?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 16:03:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:447a4131-85a3-4e16-9e86-550f2f9d67a6</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I do not understand what fallback means here?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you please give me the whole snippet of your main function so that I can test why wdt timesout even though you expect it not to?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/459176?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 12:40:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8e384ac-6d74-4342-b8b8-dab9882381ad</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;I appreciate your prompt response. Thank you.&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/459171"]I do not see main function.[/quote]
&lt;p&gt;My main function looks something like this,&lt;/p&gt;
&lt;p&gt;void main( void )&lt;br /&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;...&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; while ( 1 )&lt;br /&gt;&amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ...&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* Refresh the watchdog channel timer every second */&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;wdgt_refresh();&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ...&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;So, despite the fact I am feeding wdt every second, wdt keeps timing out but this happens &lt;strong&gt;only when I enable the hardware watchdog as a fallback&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If I disable the&amp;nbsp;&lt;span&gt;hardware watchdog then the problem disappears and the application runs without the wdt timing out.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Mohamed&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/459171?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2023 12:25:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4df6c6ab-3516-4eaf-b29e-cf8c4a15c020</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Mohammed,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the code you attached, I do not see main function. I also do not see how&amp;nbsp;wdgt_refresh is being called.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the jist of it, the wdt sample shows you that the wdt initialization works and if you are feeding the wdt correctly, then wdt does not do anything and if the feeding stops, then wdt resets the chip as intended. I do not see any other issues. here&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/459050?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 16:05:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5add88f-7d69-43a2-901a-b547e258627e</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;drivers/watchdog.h&amp;gt;
#include &amp;lt;sys/reboot.h&amp;gt;
#include &amp;lt;task_wdt/task_wdt.h&amp;gt;
#include &amp;lt;logging/log.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;

#include &amp;quot;../../include/compiler.h&amp;quot;
#include &amp;quot;../../include/system.h&amp;quot;
#include &amp;quot;../../include/wdgt.h&amp;quot;
#include &amp;quot;../../include/event_handler.h&amp;quot;

LOG_MODULE_REGISTER(wdgt, LOG_LEVEL_INF);

/*
 * To use this sample, either the devicetree&amp;#39;s /aliases must have a
 * &amp;#39;watchdog0&amp;#39; property, or one of the following watchdog compatibles
 * must have an enabled node.
 *
 * If the devicetree has a watchdog node, we get the watchdog device
 * from there. Otherwise, the task watchdog will be used without a
 * hardware watchdog fallback.
 */
#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay)
#define WDT_NODE DT_ALIAS(watchdog0)
#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_window_watchdog)
#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(st_stm32_window_watchdog)
#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_watchdog)
#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(st_stm32_watchdog)
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_watchdog)
//#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_wdt)

/* According to the comment in the sample example at
 * https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/drivers/watchdog/src/main.c
 * Nordic supports a callback, but it has 61.2 us to complete before
 * the reset occurs, which is too short for this sample to do anything
 * useful. Explicitly disallow use of the callback.
 */
#define WDT_ALLOW_CALLBACK 1
#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(nordic_nrf_watchdog)

#elif DT_HAS_COMPAT_STATUS_OKAY(espressif_esp32_watchdog)
#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(espressif_esp32_watchdog)
#elif DT_HAS_COMPAT_STATUS_OKAY(silabs_gecko_wdog)
#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(silabs_gecko_wdog)
#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_kinetis_wdog32)
#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(nxp_kinetis_wdog32)
#elif DT_HAS_COMPAT_STATUS_OKAY(microchip_xec_watchdog)
#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(microchip_xec_watchdog)
#endif


/*
 *****************************************************************************************************************************************************
 *  !GLOBAL VARIABLES
 *****************************************************************************************************************************************************
 */
int             task_wdt_id;


#if WDT_ALLOW_CALLBACK
/**************************************************************************
 * Watchdog timeout callback function.
 *
 **************************************************************************
 */
static task_wdt_callback_t task_wdt_callback(int channel_id, void *user_data)
{
    LOG_DBG( &amp;quot;Task watchdog channel %d callback, thread: %s\n&amp;quot;,
             channel_id, k_thread_name_get( (k_tid_t)user_data ) );

    /*
     * If the issue could be resolved, call task_wdt_feed(channel_id) here
     * to continue operation.
     *
     * Otherwise we can perform some cleanup and reset the device.
     */

//  printf( &amp;quot;Resetting device...\n&amp;quot; );
    LOG_WRN(&amp;quot;Resetting device...&amp;quot;);

    sys_reboot(SYS_REBOOT_COLD);

    return 0;
}
#endif /* WDT_ALLOW_CALLBACK */


/**************************************************************************
 * Sets up necessary kernel timers and the hardware watchdog, if desired
 * as fallback).
 *
 * Note, It has to be called before wdgt_refresh().
 *
 **************************************************************************
 */
void wdgt_init( void )
{
#ifdef WDT_NODE
    const struct device *hw_wdt_dev = DEVICE_DT_GET(WDT_NODE);
#else
    const struct device *hw_wdt_dev = NULL;
#endif
    int result;

    LOG_DBG( &amp;quot;Watchdog Init&amp;quot; );

    if ( !device_is_ready( hw_wdt_dev ) )
    {
        LOG_WRN( &amp;quot;Hardware watchdog %s is NOT ready - ignored.&amp;quot;, hw_wdt_dev-&amp;gt;name );

        hw_wdt_dev = NULL;
    }
    else
    {
        LOG_INF( &amp;quot;Hardware watchdog %s is ready.&amp;quot;, hw_wdt_dev-&amp;gt;name );
    }


    result = task_wdt_init( hw_wdt_dev );
    if ( result )
    {
        LOG_ERR( &amp;quot;%i - Hardware watchdog not supported. &amp;quot;, result );
    }

    /* passing NULL instead of callback to trigger system reset */
#if WDT_ALLOW_CALLBACK
    task_wdt_id = task_wdt_add(15000U, (task_wdt_callback_t)task_wdt_callback, NULL);
#else
    task_wdt_id = task_wdt_add( 30000U, NULL, NULL );
#endif

    if ( task_wdt_id &amp;gt;= 0 )
    {
        LOG_INF( &amp;quot;Watchdog Timeout OK - %i.&amp;quot;, task_wdt_id );
    }
    else
    {
        LOG_ERR( &amp;quot;Watchdog Timeout Error - %i.&amp;quot;, task_wdt_id );
    }
}


/**************************************************************************
 * Refresh the watchdog peripheral to prevent timeout.
 *
 **************************************************************************
 */
void wdgt_refresh( void )
{
        LOG_DBG( &amp;quot;Application still alive...&amp;quot; );

        task_wdt_feed( task_wdt_id );
}
&lt;/pre&gt;Thank you Susheel.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/106260/how-to-add-a-fallback-hardware-watchdog-to-a-device-tree-overlay-file/458985"]&lt;p&gt;You can enable the watchdog by changing the&amp;nbsp;&lt;/p&gt;
&lt;p&gt;status = &amp;quot;okay&amp;quot;; inside the &amp;amp;wdt0 node&lt;/p&gt;[/quote]
&lt;p&gt;I can already see in my build folder a .dts file under zephyr\zephyr.dts, where the watchdog status is already set to &amp;quot;okay&amp;quot;. See below.&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;...[snip]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt;wdt: wdt0: watchdog@40010000 {&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color:#ffff00;color:#0000ff;"&gt;&lt;strong&gt; compatible = &amp;quot;nordic,nrf-watchdog&amp;quot;;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt; reg = &amp;lt; 0x40010000 0x1000 &amp;gt;;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt; interrupts = &amp;lt; 0x10 0x1 &amp;gt;;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color:#ffff00;color:#0000ff;"&gt;&lt;strong&gt; status = &amp;quot;okay&amp;quot;;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt; label = &amp;quot;WDT&amp;quot;;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;strong&gt; };&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;[snip]...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So, I added these macros (taken from one of Nordic&amp;#39;s examples) to my code,&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;/*&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt; * To use this sample, either the devicetree&amp;#39;s /aliases must have a&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt; * &amp;#39;watchdog0&amp;#39; property, or one of the following watchdog compatibles&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt; * must have an enabled node.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt; *&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt; * If the devicetree has a watchdog node, we get the watchdog device&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt; * from there. Otherwise, the task watchdog will be used without a&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt; * hardware watchdog fallback.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt; */&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#if DT_NODE_HAS_STATUS(DT_ALIAS(watchdog0), okay)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#define WDT_NODE DT_ALIAS(watchdog0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_window_watchdog)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(st_stm32_window_watchdog)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_watchdog)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(st_stm32_watchdog)&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color:#ffff00;"&gt;&lt;strong&gt;&lt;span style="color:#0000ff;"&gt;#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_watchdog)&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffff00;"&gt;&lt;strong&gt;&lt;span style="color:#0000ff;"&gt;#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(nordic_nrf_watchdog)&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;#elif DT_HAS_COMPAT_STATUS_OKAY(espressif_esp32_watchdog)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(espressif_esp32_watchdog)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#elif DT_HAS_COMPAT_STATUS_OKAY(silabs_gecko_wdog)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(silabs_gecko_wdog)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_kinetis_wdog32)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(nxp_kinetis_wdog32)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#elif DT_HAS_COMPAT_STATUS_OKAY(microchip_xec_watchdog)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#define WDT_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(microchip_xec_watchdog)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;#endif&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="color:#000000;"&gt;Unfortunately, when I ran my code, the watchdog timer keeps&amp;nbsp;timing out causing the application to keep rebooting. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="color:#000000;"&gt;However, if I don&amp;#39;t enable the hardware watchdog as fallback but instead use only the task watchdog then the app runs fine and reboots only when expected to reboot i.e. when I deliberately stop refreshing&amp;nbsp;the watchdog timer.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#3366ff;"&gt;*** Booting Zephyr OS build v2.6.99-ncs1 ***&lt;br /&gt;[00:00:00.000,213] &amp;lt;inf&amp;gt; main: Booting-up time [0 s]&lt;br /&gt;....&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#3366ff;"&gt;*** Booting Zephyr OS build v2.6.99-ncs1 ***&lt;br /&gt;[00:00:00.000,213] &amp;lt;inf&amp;gt; main: Booting-up time [0 s]&lt;br /&gt;...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#3366ff;"&gt;*** Booting Zephyr OS build v2.6.99-ncs1 ***&lt;br /&gt;[00:00:00.000,213] &amp;lt;inf&amp;gt; main: Booting-up time [0 s]&lt;br /&gt;...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="color:#000000;"&gt;Please tell what I am doing wrong.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="color:#000000;"&gt;Kind regards&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="color:#000000;"&gt;Mohamed&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add a fallback Hardware watchdog to a device tree/overlay file</title><link>https://devzone.nordicsemi.com/thread/458985?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 13:47:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a1d53aa-aac4-4821-a954-3a7c6d1c18a7</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Mohamed,&lt;/p&gt;
[quote user=""]&lt;p&gt;I would like to use&amp;nbsp;a hardware watchdog as a fallback; for this I need to define it in the devicetree or an overlay file.&lt;/p&gt;
&lt;p&gt;How can I do either of the above?&lt;/p&gt;[/quote]
&lt;p&gt;It seems like you said that the task watchdog sample that you tested is working fine. What do you mean by &amp;quot;either of the above&amp;quot;?&lt;/p&gt;
[quote user=""]I would like to use&amp;nbsp;a hardware watchdog as a fallback; for this I need to define it in the devicetree or an overlay file.[/quote]
&lt;p&gt;In the nRF Connect SDK and in the below file v2.5.0&amp;nbsp;zephyr\tests\drivers\watchdog\wdt_basic_api\boards\nrf52840dk_nrf52840_counter.overlay&lt;/p&gt;
&lt;p&gt;you can see how watchdog is defined in the overlay file. You can enable the watchdog by changing the&amp;nbsp;&lt;/p&gt;
&lt;p&gt;status = &amp;quot;okay&amp;quot;; inside the &amp;amp;wdt0 node&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>