<?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>ASSERTION FAIL [m_cb[p_instance-&amp;gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75112/assertion-fail-m_cb-p_instance--drv_inst_idx-state-nrfx_drv_state_powered_0</link><description>Hello, I attempted to enable the zephyr task watchdog model but whenever I configure it to enable the hardware watchdog module I get the error above. Any idea why I am getting this? My code is very similar to the sample project and I have the following</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 18 Dec 2021 03:46:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75112/assertion-fail-m_cb-p_instance--drv_inst_idx-state-nrfx_drv_state_powered_0" /><item><title>RE: ASSERTION FAIL [m_cb[p_instance-&gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_0</title><link>https://devzone.nordicsemi.com/thread/344218?ContentTypeID=1</link><pubDate>Sat, 18 Dec 2021 03:46:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e3507cd-e305-4afd-909c-3a66bf379ae0</guid><dc:creator>moose</dc:creator><description>&lt;p&gt;I just tested this module using the new zephyr version (2.7.99) and it seems to work fine now. Thanks for your support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [m_cb[p_instance-&gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_0</title><link>https://devzone.nordicsemi.com/thread/330202?ContentTypeID=1</link><pubDate>Mon, 20 Sep 2021 09:05:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da84a7d6-680f-401b-8059-e754f6c89aee</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Thanks for sharing the solution Spencer. Appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [m_cb[p_instance-&gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_0</title><link>https://devzone.nordicsemi.com/thread/326865?ContentTypeID=1</link><pubDate>Thu, 26 Aug 2021 20:57:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13207d87-a6f8-4775-bcdd-876604601d51</guid><dc:creator>SpencerMougey</dc:creator><description>&lt;p&gt;I just encountered this same issue today and found a work around for it. I don&amp;#39;t know if it is applicable to all systems, but at least the nRF5340 supports it, and I would imagine the other nRF processors would as well. As for the other Zephyr processors, that is TBD.&lt;/p&gt;
&lt;p&gt;Essentially it is just an ordering swap in the task_wdt_add function call as pointed out in one of the previous comments. The task_wdt_add runs the feed before the hardware watchdog has been run via the wdt_setup call which causes the underlying Nordic driver to assert (rightfully so in my opinion). I have included the fix below.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	/* look for unused channel (reload_period set to 0) */
	for (int id = 0; id &amp;lt; ARRAY_SIZE(channels); id++) {
		if (channels[id].reload_period == 0) {
			channels[id].reload_period = reload_period;
			channels[id].user_data = user_data;
			channels[id].timeout_abs_ticks = K_TICKS_FOREVER;
			channels[id].callback = callback;
			//task_wdt_feed(id); // THIS IS WHAT CAUSES THE SYSTEM CRASH!!!!!

#ifdef CONFIG_TASK_WDT_HW_FALLBACK
			if (!hw_wdt_started &amp;amp;&amp;amp; hw_wdt_dev) {
				/* also start fallback hw wdt */
				wdt_setup(hw_wdt_dev,
					WDT_OPT_PAUSE_HALTED_BY_DBG);
				hw_wdt_started = true;
			}
#endif
            // Feed the watchdog after the hardware setup is called.
            // Otherwise, the feed will throw an assert because the 
            // watchdog has not been set up yet.
            task_wdt_feed(id);
			return id;
		}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [m_cb[p_instance-&gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_0</title><link>https://devzone.nordicsemi.com/thread/311532?ContentTypeID=1</link><pubDate>Tue, 25 May 2021 14:25:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa11bbb7-7d18-43a3-80a5-c6acbafec6a1</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I tested the sample&amp;nbsp;zephyr\samples\subsys\task_wdt with an nRF52833dk_nrf52833 and it seemed to run fine.&lt;/p&gt;
&lt;p&gt;I got the same log output as mentioned in&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/tree/a409bc732b62ce659462114ccf2870ada1724e1c/samples/subsys/task_wdt#sample-output"&gt;https://github.com/nrfconnect/sdk-zephyr/tree/a409bc732b62ce659462114ccf2870ada1724e1c/samples/subsys/task_wdt#sample-output&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, setting CONFIG_ASSERT=Y triggered the same assert you got. It seems like this subsystem is quite new and recently added to Zephyr (&lt;a href="https://github.com/zephyrproject-rtos/zephyr/pull/28947"&gt;15th of March&lt;/a&gt;), so that&amp;#39;s why it might be some undiscovered bugs. Would you be able to create a Zephyr issue&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/new/choose"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/new/choose?&lt;/a&gt;&amp;nbsp;If you don&amp;#39;t get an answer, please get back to me here and I will look into it. If you resolve it, it would be nice if you could share the solution.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [m_cb[p_instance-&gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_0</title><link>https://devzone.nordicsemi.com/thread/310884?ContentTypeID=1</link><pubDate>Fri, 21 May 2021 01:14:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2143587c-9f60-4701-a219-18b5adaa7fa9</guid><dc:creator>moose</dc:creator><description>&lt;p&gt;Simon, as mentioned I am using the zephyr task wdt module which internally configures the hardware wdt. I call the task_wdt_init function first, then&amp;nbsp;task_wdt_add, and finally task_wdt_feed on a periodic event.&amp;nbsp;Here is the link for the module code &lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/task_wdt/task_wdt.c"&gt;link&lt;/a&gt;. In the code, you can see that wdt_setup function is called within task_wdt_add.&lt;/p&gt;
&lt;p&gt;Please note that within&amp;nbsp;&lt;span&gt;task_wdt_add,&amp;nbsp;&amp;nbsp;task_wdt_feed is called before wdt_setup which in turn call wdt_feed function. Not sure if this problematic.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Any ideas on how to proceed? Has the task_wdt module ever worked on a nordic SoC? Thx!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [m_cb[p_instance-&gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_0</title><link>https://devzone.nordicsemi.com/thread/310883?ContentTypeID=1</link><pubDate>Fri, 21 May 2021 01:14:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80be6d63-8c46-4fee-8f75-08c7e3e118e7</guid><dc:creator>moose</dc:creator><description>&lt;p&gt;Simon, as mentioned I am using the zephyr task wdt module which internally configures the hardware wdt. I call the task_wdt_init function first, then&amp;nbsp;task_wdt_add, and finally task_wdt_feed on a periodic event.&amp;nbsp;Here is the link for the module code&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/task_wdt/task_wdt.c"&gt;link&lt;/a&gt;. In the code, you can see that wdt_setup function is called within task_wdt_add.&lt;/p&gt;
&lt;p&gt;Please note that within&amp;nbsp;&lt;span&gt;task_wdt_add,&amp;nbsp;&amp;nbsp;task_wdt_feed is called before wdt_setup which in turn call wdt_feed function. Not sure if this problematic.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Any ideas on how to proceed? Has the task_wdt module ever worked on a nordic SoC? Thx!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [m_cb[p_instance-&gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_0</title><link>https://devzone.nordicsemi.com/thread/310187?ContentTypeID=1</link><pubDate>Tue, 18 May 2021 13:35:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9586d24d-06d4-416b-bcd9-8f757955237c</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Did you call the enable function before calling feed function? As you can see in the file&amp;nbsp;nrfx_wdt.c, it will &lt;a href="https://github.com/nrfconnect/sdk-hal_nordic/blob/8f013ea950f41bf69b18bf688bfb0dd80a3fdc44/nrfx/drivers/src/nrfx_wdt.c#L113"&gt;set&amp;nbsp;&lt;span&gt;p_cb-&amp;gt;&lt;/span&gt;&lt;span&gt;state to&amp;nbsp;&lt;span&gt;NRFX_DRV_STATE_POWERED_ON in nrfx_wdt_enable&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;(). If this is set, the assert won&amp;#39;t trigger.&lt;/p&gt;
&lt;p&gt;Call &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/a409bc732b62ce659462114ccf2870ada1724e1c/include/drivers/watchdog.h#L163"&gt;wdt_setup()&lt;/a&gt; before doing anything else, it will trigger &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/a9423cbce69a5df78140a2cf3ba11aa56d395cfc/drivers/watchdog/wdt_nrfx.c#L36"&gt;wdt_nrf_setup()&lt;/a&gt;, which will trigger &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/a9423cbce69a5df78140a2cf3ba11aa56d395cfc/drivers/watchdog/wdt_nrfx.c#L62"&gt;nrfx_wdt_enable()&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [m_cb[p_instance-&gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_0</title><link>https://devzone.nordicsemi.com/thread/309866?ContentTypeID=1</link><pubDate>Fri, 14 May 2021 18:22:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45974778-9363-40da-80b9-93139d2b83f5</guid><dc:creator>moose</dc:creator><description>&lt;p&gt;Hello Simon,&lt;/p&gt;
&lt;p&gt;Here is the full error message and attached is a screenshot of the output.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ASSERTION FAIL [m_cb[p_instance-&amp;gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_ON] @ WEST_TOPDIR/modules/hal/nordic/nrfx/drivers&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For some reason, it didn&amp;#39;t specify the actual file but when I look in that directory, I think the most relevant file is the nrfx_wdt.c included within the src directory. Within that file, I see the above assertion statement on line 155 within the&amp;nbsp;nrfx_wdt_channel_feed function.&lt;/p&gt;
&lt;p&gt;This function&amp;nbsp;&lt;span&gt;is called by&amp;nbsp;&lt;/span&gt;wdt_nrf_feed function within the wdt_nrfx.c. I am assuming this function is eventually called by task_wdt.c but I could find the exact link. task_wdt.c uses&amp;nbsp;wdt_feed function which I don&amp;#39;t know where is that one is defined.&lt;/p&gt;
&lt;p&gt;Hope this provides&amp;nbsp;some data and look forward to your input. Thanks!&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot-from-2021_2D00_05_2D00_14-11_2D00_19_2D00_35.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ASSERTION FAIL [m_cb[p_instance-&gt;drv_inst_idx].state == NRFX_DRV_STATE_POWERED_0</title><link>https://devzone.nordicsemi.com/thread/309783?ContentTypeID=1</link><pubDate>Fri, 14 May 2021 12:46:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0e3431f-ac90-4e42-bc55-6f15f9f1fe5d</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I&amp;#39;m not able to find the assert you&amp;#39;re referring to, could you point me to the file and line of the assert?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>