<?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>Stuck Timer Value always reading Zero!</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/47593/stuck-timer-value-always-reading-zero</link><description>Hi, 
 I am using Timer0 to measure external pulse width. Using GPIOTE, PPI task and events. The problem here is, I am reading Timer0 Capture register as Zero always. Here I am giving PWM externally (10% duty cycle). Am I missing something here, does it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 Jun 2019 14:51:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/47593/stuck-timer-value-always-reading-zero" /><item><title>RE: Stuck Timer Value always reading Zero!</title><link>https://devzone.nordicsemi.com/thread/190574?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2019 14:51:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc1913ee-b562-4366-9ea5-0600c1a45c24</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;What prescaler do you use for the timer ?&lt;/p&gt;
&lt;p&gt;Are you using the projects found in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/23267/how-to-measure-two-wave-delay"&gt;this post&lt;/a&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stuck Timer Value always reading Zero!</title><link>https://devzone.nordicsemi.com/thread/188656?ContentTypeID=1</link><pubDate>Wed, 22 May 2019 18:47:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74247b89-bd81-445f-9067-bfc5566a0a3e</guid><dc:creator>AimHigh</dc:creator><description>&lt;p&gt;Hi, Well LATCH_GPIOTE is integer declared as global and initialized to value 0. I am using it if(Latch_GPIOTE==0) then start the timer on LoToHi on PIN_IN2 and increment Latch_GPIOTE++, else if(Latch_GPIOTE==1) stop the timer and reset Latch_GPIOTE to 0. And this else If(Latch_GPIOTE==1) is executed on next LoToHi pulse on PIN_IN2.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I did try to read CC[0] reg somehow nothing came out. But eventually, I have added&amp;nbsp;&lt;/p&gt;
&lt;p&gt;if(pin==PIN_IN2)&amp;amp;&amp;amp;(action==NRF_GPIOTE_POLARITY_LOTOHI)&amp;nbsp; this worked for it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;But got a new problem here. when I give 2microsecond pulse to PIN_IN2, the timer ticks value I am getting is 513 which is 32.0625 microseconds. Hence the scale is way off.&lt;/p&gt;
&lt;p&gt;What could be the problem here? I have got the range to measure from 2us to 135us.&lt;/p&gt;
&lt;p&gt;Here is the Output on debugging terminal for 2us pulse with 50% duty cycle.&lt;/p&gt;
&lt;p&gt;time in us: 33.062500&lt;br /&gt;Timer Ticks: 529&lt;br /&gt;time in us: 33.187500&lt;br /&gt;Timer Ticks: 531&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stuck Timer Value always reading Zero!</title><link>https://devzone.nordicsemi.com/thread/188652?ContentTypeID=1</link><pubDate>Wed, 22 May 2019 18:19:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:368a197b-1680-4bb4-81df-2bcc34bfde03</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Ok, the timer is started via PPI if &amp;quot;&lt;span&gt;LATCH_GPIOTE&amp;quot; is set to 0, and you get a in event for PIN2. Where are you setting&amp;nbsp;LATCH_GPIOTE ? and why do you need&amp;nbsp;LATCH_GPIOTE ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And the&amp;nbsp;timer_compare_task_addr&amp;nbsp;is using CC[2]&amp;nbsp;register, but in the&amp;nbsp;in_pin_handler() you are reading the CC[0]&amp;nbsp;register. So try using&amp;nbsp;NRF_TIMER_TASK_CAPTURE0 for the&amp;nbsp;timer_compare_task_addr&amp;nbsp;instead.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stuck Timer Value always reading Zero!</title><link>https://devzone.nordicsemi.com/thread/188639?ContentTypeID=1</link><pubDate>Wed, 22 May 2019 15:31:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5456fde2-472b-43c4-8916-90e7ee42d14d</guid><dc:creator>AimHigh</dc:creator><description>&lt;p&gt;Yes, In CMSIS congif window.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stuck Timer Value always reading Zero!</title><link>https://devzone.nordicsemi.com/thread/188627?ContentTypeID=1</link><pubDate>Wed, 22 May 2019 14:37:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ce04169-49c5-4aec-914c-1a6594a90a96</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you enabling the timer somewhere?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrf_drv_timer_enable(&amp;amp;m_timer);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>