<?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>NRF Timer doesn&amp;#39;t start</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101316/nrf-timer-doesn-t-start</link><description>Hi, 
 In my application I need an interrupt every 8us that I use as basetime, so I add a nrf timer to my code in the following way: 
 in the prj.conf 
 
 
 In the application: 
 
 I call the function startIrTimer() and the function return without any</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 Jul 2023 19:00:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101316/nrf-timer-doesn-t-start" /><item><title>RE: NRF Timer doesn't start</title><link>https://devzone.nordicsemi.com/thread/434303?ContentTypeID=1</link><pubDate>Mon, 03 Jul 2023 19:00:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86431190-b0f4-4b06-a855-cd23ed65c415</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;It seems like something else is masking your interrupt sometimes for a small period of time. It would be better if you enable tracing and &lt;a href="https://www.zephyrproject.org/tracing-zephyr-applications-with-segger-systemview/"&gt;use the systemview&lt;/a&gt; to get the overall timings of all contexts traced.&lt;/p&gt;
&lt;p&gt;Other than some other higher interrupt masking your timer interrupt sometimes, I do not see a valid explanation for this behavior. Once you understand which interrupt is doing this you will have better control on your timer. If you have BLE or any other RADIO protocol activity in parallel, then it makes sense that the protocol high priority activity is masking your application interrupt. Are you using BLE or any other radio protocol in parallel with your timer? If so, test the behavior of timer latencies without any other protocols to double confirm on the cause of this behavior.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF Timer doesn't start</title><link>https://devzone.nordicsemi.com/thread/434107?ContentTypeID=1</link><pubDate>Mon, 03 Jul 2023 08:04:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b44e0ed-b693-4990-a2a5-72dde0deeb42</guid><dc:creator>warcomeb-am</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;I am using a pin to toggle its output just to show when the interrupt was trigger.&lt;/p&gt;
&lt;p&gt;The output is the yellow line.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Marco&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:1040px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/2080x480/__key/communityserver-discussions-components-files/4/2063.timing.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF Timer doesn't start</title><link>https://devzone.nordicsemi.com/thread/433995?ContentTypeID=1</link><pubDate>Fri, 30 Jun 2023 15:44:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44afea08-08f9-400b-8555-1591f5a54b8a</guid><dc:creator>warcomeb-am</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;thank, with your suggestion the base-time works but not perfecty: I mean that the interrupt some time was triggered after 6us and other times after 29us. What is it wrong?&lt;/p&gt;
&lt;p&gt;Best&lt;/p&gt;
&lt;p&gt;Marco&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF Timer doesn't start</title><link>https://devzone.nordicsemi.com/thread/433699?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2023 13:01:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af58b3a7-49e6-4465-b0b3-403630fdb845</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;instead of using 10 as hardcoded value in the nrfx_timer_extended_compare I suggest you use this code to get correct conversion.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uint32_t desired_ticks = nrfx_timer_us_to_ticks(&amp;amp;mIrTimer, 10);

// Interrupt every 10us
nrfx_timer_extended_compare(&amp;amp;mIrTimer, NRF_TIMER_CC_CHANNEL0, desired_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF Timer doesn't start</title><link>https://devzone.nordicsemi.com/thread/433599?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2023 07:24:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c820f9da-57e6-475b-b9f7-ec1092d43251</guid><dc:creator>warcomeb-am</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;thanks for the reply. Yes, you are right, 8us is a typo.&lt;/p&gt;
&lt;p&gt;In the application I need an interrupt every 10us, so I changed the code in this way:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static bool startIrTimer (void) 
{
    nrfx_err_t errCode;

    nrfx_timer_config_t tmrConfig = NRFX_TIMER_DEFAULT_CONFIG;
    tmrConfig.frequency           = NRF_TIMER_FREQ_1MHz;
    tmrConfig.mode                = NRF_TIMER_MODE_TIMER;
    tmrConfig.bit_width           = NRF_TIMER_BIT_WIDTH_8;
    //tmrConfig.interrupt_priority  = NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY;

    errCode = nrfx_timer_init(&amp;amp;mIrTimer,&amp;amp;tmrConfig,irTimerHandler);
    if (errCode != NRFX_SUCCESS) 
    {
		return false;
	}

    // Interrupt every 10us
    nrfx_timer_extended_compare(&amp;amp;mIrTimer, NRF_TIMER_CC_CHANNEL0, 10, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);

	IRQ_CONNECT(TIMER2_IRQn,5,nrfx_timer_2_irq_handler, NULL,0);

    //nrfx_timer_clear(&amp;amp;mIrTimer);
    nrfx_timer_enable(&amp;amp;mIrTimer);

    return true;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Now the interrupt was triggered, but it seems to be ten times faster. How is it possible?&lt;/p&gt;
&lt;p&gt;Best&lt;/p&gt;
&lt;p&gt;Marco&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF Timer doesn't start</title><link>https://devzone.nordicsemi.com/thread/433548?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2023 20:47:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24e99086-4b06-4831-b1f6-67da5b64b34c</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;you seems to have commented out the&amp;nbsp;nrfx_timer_extended_compare which actually sets the CC register needed to trigger the event and the interrupt. Have you tried uncommenting the&amp;nbsp;&lt;span&gt;nrfx_timer_extended_compare&amp;nbsp;part?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Also you seem to be using 10 ticks hardcoded into the&amp;nbsp;&lt;/span&gt;cc_value parameter in the&amp;nbsp;&lt;span&gt;nrfx_timer_extended_compare&amp;nbsp; function.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
[quote user=""]In my application I need an interrupt every 8us that I use as basetime,[/quote]
&lt;p&gt;Setting 10 in CC of Timer running at 125KHz speed will give you a timeout of 80uS not 8uS (or maybe 8uS is a typo?)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>