<?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>err_code = 0x07 after calling a timer start</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22827/err_code-0x07-after-calling-a-timer-start</link><description>Hi,
I got an err_code = 0x00000007 after calling this function. 
 void system_timer_start(void)
{
	uint32_t err_code;

	
	err_code = app_timer_start(m_one_ms_timer_id, ONE_MILLISEC_TICKS, NULL);

	if(err_code != NRF_SUCCESS)
	{
 
	}

	APP_ERROR_CHECK</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Jun 2017 13:36:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22827/err_code-0x07-after-calling-a-timer-start" /><item><title>RE: err_code = 0x07 after calling a timer start</title><link>https://devzone.nordicsemi.com/thread/89751?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 13:36:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cbf66da-22b5-49a9-83c0-2c3eba77ff90</guid><dc:creator>Francesca</dc:creator><description>&lt;p&gt;That was the problem.. I changed the value of APP_TIMER_MIN_TIMEOUT_TICKS modifying my code. Now it is set to 5. Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: err_code = 0x07 after calling a timer start</title><link>https://devzone.nordicsemi.com/thread/89750?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 13:28:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be01ac35-6082-4f02-b960-ba21d5291c81</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure why you see wrong value with optimization level 3, but why are you redefining &lt;code&gt;APP_TIMER_MIN_TIMEOUT_TICKS&lt;/code&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: err_code = 0x07 after calling a timer start</title><link>https://devzone.nordicsemi.com/thread/89749?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 13:12:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a40343c-d2a4-4f3e-ae23-f982221497f7</guid><dc:creator>Francesca</dc:creator><description>&lt;p&gt;I discovered the problem&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context)
{
    uint32_t timeout_periodic;
    timer_node_t * p_node = (timer_node_t*)timer_id;
    
    // Check state and parameters
    VERIFY_MODULE_INITIALIZED();

    if (timer_id == 0)
    {
        return NRF_ERROR_INVALID_STATE;
    }
    if (timeout_ticks &amp;lt; APP_TIMER_MIN_TIMEOUT_TICKS)
    {
        return NRF_ERROR_INVALID_PARAM;
    }
    if (p_node-&amp;gt;p_timeout_handler == NULL)
    {
        return NRF_ERROR_INVALID_STATE;
    }
    
    // Schedule timer start operation
    timeout_periodic = (p_node-&amp;gt;mode == APP_TIMER_MODE_REPEATED) ? timeout_ticks : 0;

    return timer_start_op_schedule(user_id_get(),
                                   p_node,
                                   timeout_ticks,
                                   timeout_periodic,
                                   p_context);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;if (timeout_ticks &amp;lt; APP_TIMER_MIN_TIMEOUT_TICKS) was true because APP_TIMER_MIN_TIMEOUT_TICKS = 60 and ONE_MILLISEC_TICKS  = 33.
Concerning the 1984, the debugger showed the correct value (60) using optimization 0 ( before I used optimization 3) Why?
Thanks for the suggestion!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: err_code = 0x07 after calling a timer start</title><link>https://devzone.nordicsemi.com/thread/89745?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 12:47:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1dd0f7f-8f9b-4a8e-a54d-8f06ccc84dc5</guid><dc:creator>Francesca</dc:creator><description>&lt;p&gt;Sorry, I edited my answer because I inverted the order of istructions. I declared an extern variable called ticks as follow
uint32_t ticks = APP_TIMER_MIN_TIMEOUT_TICKS;
Through the debugger, I added ticks to watch 1 and the value displayed is 1984 (0x000007C0).Why? It should be 60.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: err_code = 0x07 after calling a timer start</title><link>https://devzone.nordicsemi.com/thread/89748?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 12:38:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1da0db45-9971-4381-a11d-642357a5fe61</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Are you calling it in that order? You should define APP_TIMER_PRESCALER before calling APP_TIMER_TICKS. Also, try printing ONE_MILLISEC_TICKS somewhere, to make sure it is larger than 5.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: err_code = 0x07 after calling a timer start</title><link>https://devzone.nordicsemi.com/thread/89747?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 12:34:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb24c068-aece-4bae-8a77-71b82b96564f</guid><dc:creator>Francesca</dc:creator><description>&lt;p&gt;Hi, thanks for your answer.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define APP_TIMER_PRESCALER              0
#define ONE_MILLISEC_TICKS      APP_TIMER_TICKS(1, APP_TIMER_PRESCALER)
#define APP_TIMER_MIN_TIMEOUT_TICKS  60
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: err_code = 0x07 after calling a timer start</title><link>https://devzone.nordicsemi.com/thread/89746?ContentTypeID=1</link><pubDate>Thu, 15 Jun 2017 12:30:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2dccb25-a0d6-4d15-b260-b13ec6e7d45d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;What is the value of the parameter &lt;code&gt;ONE_MILLISEC_TICKS&lt;/code&gt;? &lt;code&gt;app_timer_start()&lt;/code&gt; will return &lt;code&gt;NRF_ERROR_INVALID_PARAM&lt;/code&gt; if timeout_ticks is set to less than 5 ticks (&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v13.0.0/group__app__timer.html#ga30c7af1b67835f8031ccc934af7d1af7"&gt;&lt;code&gt;APP_TIMER_MIN_TIMEOUT_TICKS&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>