<?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>Timer accuracy with softdevice</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/96461/timer-accuracy-with-softdevice</link><description>I have a scenario where the timer needs to be strictly 250us timed and repeated, aligned with GPS 1pps. 
 
 
 
 
 
 
 
 To achieve this goal, I use the rising edge event of GPS 1PPS to capture the value of the timer, so as to evaluate the error of the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 09 Feb 2023 06:45:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/96461/timer-accuracy-with-softdevice" /><item><title>RE: Timer accuracy with softdevice</title><link>https://devzone.nordicsemi.com/thread/409049?ContentTypeID=1</link><pubDate>Thu, 09 Feb 2023 06:45:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14601008-a3cf-4e3c-a1d6-68a6368c7bd1</guid><dc:creator>yinxu951</dc:creator><description>&lt;p&gt;sorry, TIMER2 should be TIMER1。 after enable the HFXO, the problem has been solved.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer accuracy with softdevice</title><link>https://devzone.nordicsemi.com/thread/408859?ContentTypeID=1</link><pubDate>Wed, 08 Feb 2023 12:40:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:742d95bc-30ef-44aa-b8c8-857a57848b53</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The timer peripheral itself is not affected by the SoftDevice, and is completely independent. There is one thing to remember though, and that is that for the timer to be accurate, you need to request the HFXO so that it does not use the HFINT as clock source. If you don&amp;#39;t, you will be using the (inaccurate) HFINT for the most part, except when there is radio activity, as the SoftDevice will enable the HFXO for those times.&lt;/p&gt;
&lt;p&gt;As the SoftDevice does not impact the timer, there must be another issue. I do not see enough of you r code to get a full overview, but I see&amp;nbsp;that you use shorts and PPI, which is&amp;nbsp;independent of the CPU when configured, and thus also independent of the SoftDevice. However, I also see that you enable interrupt but I don&amp;#39;t know what you are doing in the interrupt handler. A key point here is that the interrupt may be delayed if a higher priority SoftDevice interrupt is being processed at that time, so you should make sure to not depend on the timing of the interrupt (so don&amp;#39;t do things like restarting timers etc. in an interrupt, instead this must be done with shorts or PPI in order to avoid such issues).&lt;/p&gt;
&lt;p&gt;Lastly, I notice a few things&amp;nbsp;worth mentioning. You write to both&amp;nbsp;TIMER1 and TIMER2 registers, but I assume all should have been TIMER1? Also, you set the CC to&amp;nbsp;1000, and while that could be right, it seems wrong, as the counter counts from 0, and the clearing of the counter via a short also&amp;nbsp;takes a clock cycle. This would give a consistent bias though, so it should not be related to the issue you are seeing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>