<?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>ANCS  add WDT</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21977/ancs-add-wdt</link><description>In the ANCS service to add wdt, the program has been reset, the use of the protocol stack is SDK9.0.0</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 18 May 2017 07:44:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21977/ancs-add-wdt" /><item><title>RE: ANCS  add WDT</title><link>https://devzone.nordicsemi.com/thread/86234?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 07:44:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00dd3ee2-1f5a-4f91-8512-05b7a643f5b5</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;The main difference between &lt;code&gt;__SEV (); __WFE (); __WFE ();&lt;/code&gt; and &lt;code&gt;power_manage ();&lt;/code&gt; is when should it get out of the function and let the CPU continue the loop , so that wdt_feed() can be called.
power_manager(); won&amp;#39;t let the CPU to continue the loop if there is no application event or BLE event.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;__SEV (); __WFE (); __WFE ();&lt;/code&gt; let the CPU continue if it has to wake up for anything. This includes the BLE activity that the softdevice handle in the back ground. In other words, this solution let the wdt_feed() to be called every time you have a connection event or advertising event, when power_manager() doesn&amp;#39;t.&lt;/p&gt;
&lt;p&gt;connection events and BLE events are not the same. BLE events are event that the softdevice send to application. Connection events is the event occurs on BLE interval even there is no data to send.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ANCS  add WDT</title><link>https://devzone.nordicsemi.com/thread/86235?ContentTypeID=1</link><pubDate>Wed, 17 May 2017 02:41:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68d4c272-c47c-4e4a-b817-d695a6373467</guid><dc:creator>muyang</dc:creator><description>&lt;p&gt;Hi
    After the experiment, use &lt;code&gt;__SEV (); __WFE (); __WFE ();&lt;/code&gt; instead of &lt;code&gt;power_manage ();&lt;/code&gt; the program can run normally, but I am not very clear about the difference and difference between the two.
Use &lt;code&gt;__SEV (); __WFE (); __WFE ();&lt;/code&gt;
Will not cause 51822 standby power consumption is too high, or can not enter the low power mode it
There is no relevant information or description, describe the use of the two methods, I hope you can help me, thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ANCS  add WDT</title><link>https://devzone.nordicsemi.com/thread/86233?ContentTypeID=1</link><pubDate>Tue, 16 May 2017 11:37:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e04e4ce-f3e1-481c-9275-b185f85dafd4</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Zhang,&lt;/p&gt;
&lt;p&gt;From your code I can see that if there is no application interrupt /BLE event occur the dog will not be fed. This is because power_manage() will put CPU to sleep and won&amp;#39;t let the loop to get out if there is no event.&lt;/p&gt;
&lt;p&gt;You can try to remove power_manage(), this will allow wdt_feed() be called all the time. But this will cause the CPU to be active all the time, consuming current.&lt;/p&gt;
&lt;p&gt;You can replace power_manage() with &lt;code&gt;__SEV();__WFE();__WFE();&lt;/code&gt;. This will put CPU to sleep, and still allow it to wake up and execute other command in the main loop when there is any BLE activity. Basically anytime the Softdevice is active.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ANCS  add WDT</title><link>https://devzone.nordicsemi.com/thread/86232?ContentTypeID=1</link><pubDate>Tue, 16 May 2017 09:47:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d07fcb51-a9b9-495f-94f1-da983442b940</guid><dc:creator>muyang</dc:creator><description>&lt;p&gt;enter code here&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;db_discovery_init();
    scheduler_init();
    gap_params_init();
    service_init();
    advertising_init();
    conn_params_init();
	
    //Start execution.
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);
	WDTconfig();

    //Enter main loop.
    for (;;)
    {
		
        app_sched_execute();
		wdt_feed();
        power_manage();
		
    }

    void WDTconfig(void)
{
	uint32_t err_code;
	//Configure WDT.
    nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
    err_code = nrf_drv_wdt_init(&amp;amp;config, wdt_event_handler);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_wdt_channel_alloc(&amp;amp;m_channel_id);
    APP_ERROR_CHECK(err_code);
    nrf_drv_wdt_enable();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is the watchdog initialization procedure&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; void wdt_feed(void)
{
	nrf_drv_wdt_channel_feed(m_channel_id);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a feeding dog program&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ANCS  add WDT</title><link>https://devzone.nordicsemi.com/thread/86231?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 14:39:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:312640bc-d738-4e68-8493-27a7c30ed094</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;You meant if you connect to the phone, then the device will crash and reset ?&lt;/p&gt;
&lt;p&gt;How do you feed the WDT ? Could you post your code ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ANCS  add WDT</title><link>https://devzone.nordicsemi.com/thread/86230?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 13:25:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74af4a4a-5603-4e38-9010-374c72608bf9</guid><dc:creator>muyang</dc:creator><description>&lt;p&gt;Is this, why not connect to the phone will not reset, because not connected to the case of mobile phones will not find ANCS service, I would like to express the meaning of the ANCS service caused by the reasons for the reset.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ANCS  add WDT</title><link>https://devzone.nordicsemi.com/thread/86229?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 12:36:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03938a36-b38c-4401-a004-eb98c16235a8</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I don&amp;#39;t understand what you say here &amp;quot;If 51822 does not connect the phone will not be reset, connected to the phone after the device has been reset&amp;quot;. Have you fixed the issue or not ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ANCS  add WDT</title><link>https://devzone.nordicsemi.com/thread/86228?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 06:19:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed9406fe-6296-4b9a-aa5b-e4625ab93fa9</guid><dc:creator>muyang</dc:creator><description>&lt;p&gt;If 51822 does not connect the phone will not be reset, connected to the phone after the device has been reset&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ANCS  add WDT</title><link>https://devzone.nordicsemi.com/thread/86227?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 03:33:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1376b9c4-95a6-48b9-9b34-56e30528d74f</guid><dc:creator>muyang</dc:creator><description>&lt;p&gt;I was having to feed the dog, and I added in the same way that the nus routine was working properly&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ANCS  add WDT</title><link>https://devzone.nordicsemi.com/thread/86226?ContentTypeID=1</link><pubDate>Fri, 12 May 2017 10:38:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86ab9691-4de2-4bab-adbb-674b3e5b1a7b</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Muyang,&lt;/p&gt;
&lt;p&gt;How do you handle WDT in the source code ? If you don&amp;#39;t handle it (feed the dog ) it will trigger a reset.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>