<?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>Could I stop and restart a timer in this timer timeout handler?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7295/could-i-stop-and-restart-a-timer-in-this-timer-timeout-handler</link><description>In timeout handler, I need to reload a new value, could this be fail since the timer stop is delayed by SWI0.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 21 Jul 2015 11:46:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7295/could-i-stop-and-restart-a-timer-in-this-timer-timeout-handler" /><item><title>RE: Could I stop and restart a timer in this timer timeout handler?</title><link>https://devzone.nordicsemi.com/thread/25786?ContentTypeID=1</link><pubDate>Tue, 21 Jul 2015 11:46:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea5dd223-66fc-4d2e-b47d-3f44a8a51d81</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;cgha, please update this thread, if this answer helped you then please click the ✓ to the left of the answer so that others can come and look here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Could I stop and restart a timer in this timer timeout handler?</title><link>https://devzone.nordicsemi.com/thread/25785?ContentTypeID=1</link><pubDate>Thu, 28 May 2015 11:12:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa071cb9-c0c9-4c93-a4e7-640da1ea0edf</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Yes you can. Verified on SDK8.1 S110
I have tried this below code on S110 with connection established to master control panel&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static app_timer_id_t                   m_test_timer_id;
#define GPIO_NUM		6
#define TEST_INTERVAL1     APP_TIMER_TICKS(5, APP_TIMER_PRESCALER)
#define TEST_INTERVAL2     APP_TIMER_TICKS(10, APP_TIMER_PRESCALER)

static void test_timeout_handler(void * p_context)
{
	static bool is_true = true;
	nrf_gpio_pin_toggle(GPIO_NUM);
	uint32_t err_code;
	
	if(is_true)
	{
		err_code = app_timer_stop(m_test_timer_id);
		APP_ERROR_CHECK(err_code);
		err_code = app_timer_start(m_test_timer_id, TEST_INTERVAL1, NULL);
		APP_ERROR_CHECK(err_code);
	}
	else
	{
		err_code = app_timer_stop(m_test_timer_id);
		APP_ERROR_CHECK(err_code);
		err_code = app_timer_start(m_test_timer_id, TEST_INTERVAL2, NULL);
		APP_ERROR_CHECK(err_code);
	}
	is_true = !is_true;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and I got the timer value changed correctly (with 0.04ms error because of handler execution time).Attaching is logic analyzer output for togle GPIO pin inside the handler
&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5126.Capture.JPG" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>