<?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_drv_timer interrupt handler get called instantly</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7046/nrf_drv_timer-interrupt-handler-get-called-instantly</link><description>I have been developing an application using PCA10028 board which needs to use timer. From the SDK8.0.0 pack, I found an example &amp;quot;timer_pca10028&amp;quot;. It works fine when the SD is not at present. 
 Then I used part of the code inside my own application to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Feb 2016 21:20:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7046/nrf_drv_timer-interrupt-handler-get-called-instantly" /><item><title>RE: nrf_drv_timer interrupt handler get called instantly</title><link>https://devzone.nordicsemi.com/thread/24898?ContentTypeID=1</link><pubDate>Mon, 01 Feb 2016 21:20:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d218e33-db60-40ce-9d76-d87afa004e7d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Questchin,&lt;/p&gt;
&lt;p&gt;I missed to see your comment, i would strongly recommend you not to directly write to timer registers when using nrf drivers. Nrf drivers had internal state machine, your code will not necessarily be compatible with future SDKs where they might store the value of prescaler inside the driver and then it would create a conflict.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_timer interrupt handler get called instantly</title><link>https://devzone.nordicsemi.com/thread/24897?ContentTypeID=1</link><pubDate>Mon, 18 May 2015 14:58:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d312cd40-e0e9-4a2f-9f94-08b00bbed687</guid><dc:creator>Questchin</dc:creator><description>&lt;p&gt;Thank you, Aryan! That is the problem. I simply use NRF_Timerx-&amp;gt;PRESCALER = 4 to do this after the nrf_drv_timer_init() function. I know this is not the standard way of initialization while the SD is at present, but it works fine now. Thank you very much!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_timer interrupt handler get called instantly</title><link>https://devzone.nordicsemi.com/thread/24896?ContentTypeID=1</link><pubDate>Mon, 18 May 2015 11:32:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c586ba0d-79d1-4b02-8b93-66f7a6c69e59</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;The problem is with your PRESCALER and time_ms.
With PRESCALER = 0 in the timer you generate 0X3E80 (16000) ticks per millisecond.
So for your 50ms number of ticks required is C3500. This does not fit in 16-bit TIMER1.
Change the prescaler so that your time_ticks will be able to fit in 16-bit TIMER1 CC register.&lt;/p&gt;
&lt;p&gt;changed the prescaler to 4 instead of 0 using&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_timer_frequency_set(STREAM_PAC.p_reg, NRF_TIMER_FREQ_1MHz);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;after initializing the timer and it will work with the precision you need, which I verified by copying your timer code into ble_app_beacon_s110 example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_timer interrupt handler get called instantly</title><link>https://devzone.nordicsemi.com/thread/24895?ContentTypeID=1</link><pubDate>Fri, 15 May 2015 14:23:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:038ebe3c-1f54-4f39-a577-a2abff09ab96</guid><dc:creator>Questchin</dc:creator><description>&lt;p&gt;Thank you for the input. Although I end up with using the app_timer, I found it not so accurate that I prefer to switch back to the this nrf_drv_timer. Would you please indicate some way of testing which reason it might be? I used have some issue regarding the bootloader since header files are always linked to the library file instead of the one I modified. I was wondering if that would be the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_timer interrupt handler get called instantly</title><link>https://devzone.nordicsemi.com/thread/24894?ContentTypeID=1</link><pubDate>Fri, 15 May 2015 10:07:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42367048-f3b5-4b8a-9c27-f0db6f960c79</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;If you changed the time interval and it really did not effect your timing then only three things can explain this.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;1) someone else is using this timer overwriting your settings OR
2) the SHORT for compare and clear is not working somehow.
3) The PRESCALER for timer is small and your required time does not fit in Timer CC register
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>