<?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>why the timer callback can&amp;#39;t be called in a loop?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48696/why-the-timer-callback-can-t-be-called-in-a-loop</link><description>SDK14+NRF52832. 
 I used one timer to do something every millisecond. and I used another function to do a loop action, the function maybe breaked if the time period exceed one value. 
 now I found when execute the loop action function, the timer can&amp;#39;t</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 25 Jun 2019 01:07:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48696/why-the-timer-callback-can-t-be-called-in-a-loop" /><item><title>RE: why the timer callback can't be called in a loop?</title><link>https://devzone.nordicsemi.com/thread/194482?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2019 01:07:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14d3fbd9-7838-44d7-9fba-d506803e0a93</guid><dc:creator>zk017</dc:creator><description>&lt;p&gt;it&amp;#39;s hasn&amp;#39;t any other interrupt at this time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why the timer callback can't be called in a loop?</title><link>https://devzone.nordicsemi.com/thread/194480?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2019 00:57:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4507e5de-3111-45aa-b868-8c9121dd2987</guid><dc:creator>zk017</dc:creator><description>&lt;p&gt;static volatile uint32_t nrf_ms_ticks = 0;&amp;nbsp; and only be used in the following functions:&lt;pre class="ui-code" data-mode="c_cpp"&gt;static volatile uint32_t nrf_ms_ticks = 0;
int nrf_ticks_get(unsigned long *tick)  
{
    *tick = nrf_ms_ticks;
	//NRF_LOG_PRINTF(&amp;quot;%s %d\n&amp;quot;, __FUNCTION__, nrf_ms_ticks);
	return 0;
}


//-----------------------------------------------------------------
static void nrf_tick_event_handler(void * p_context)
{
	UNUSED_PARAMETER(p_context);
	nrf_ms_ticks++;
	//NRF_LOG_PRINTF(&amp;quot;%s\n&amp;quot;, __FUNCTION__);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why the timer callback can't be called in a loop?</title><link>https://devzone.nordicsemi.com/thread/194336?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 11:52:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58757552-70ff-4b8b-abaf-7c01b4a59df5</guid><dc:creator>mark_l</dc:creator><description>&lt;p&gt;How is nrf_ms_ticks declared?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why the timer callback can't be called in a loop?</title><link>https://devzone.nordicsemi.com/thread/194213?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 05:52:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83d1b3c6-2c5a-41b8-aae5-cbe4e35931cc</guid><dc:creator>zk017</dc:creator><description>&lt;p&gt;Yes， I found the log in while, NRF_LOG_PRINTF(&amp;quot;stop_cup_then_home, interval_len=%d\n &amp;quot;, interval_len); always printed the same value, this can verify the nrf_tick_event_handler havn&amp;#39;t executed. and some time passed, system restarted, which meet the watch dog &amp;#39;s function，havn&amp;#39;t feed the watch dog resulted system restart.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why the timer callback can't be called in a loop?</title><link>https://devzone.nordicsemi.com/thread/194132?ContentTypeID=1</link><pubDate>Fri, 21 Jun 2019 13:46:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:934310ae-608b-4a5b-a5a2-a2bc9ac2109d</guid><dc:creator>mark_l</dc:creator><description>&lt;p&gt;How are you determining it isn&amp;#39;t running? via the log prints? your while loop is heavily spamming the log, potentially blocking anything else from running or printing, depending on the output channel for the log data. Try taking the log print out of the while loop to see what happens. Also how is nrf_ms_ticks defined? Has it been declared as volatile?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why the timer callback can't be called in a loop?</title><link>https://devzone.nordicsemi.com/thread/194118?ContentTypeID=1</link><pubDate>Fri, 21 Jun 2019 12:57:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:207a2b2a-6025-4c01-96ff-29514f473b5f</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It&amp;#39;s difficult to tell what the issue is without reproducing the issue myself. What priorities does the timer interrupts have? The application will not handle an interrupt immediately if it&amp;#39;s already handling another interrupt with the same priority. The interrupt will be handled after it has returned from the first.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>