<?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>how can i use timer as counter??</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12750/how-can-i-use-timer-as-counter</link><description>Hi, i need to calculate the frequency of two PWM. 
 When it comes to frequency calculation, the counter function is the best solution, i think. 
 i&amp;#39;m using SDK 6.0.0 for my project. 
 i tried to calculate the frequency by timer. but the &amp;#39;APP_TIMER_TICKS</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Nov 2017 14:17:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12750/how-can-i-use-timer-as-counter" /><item><title>RE: how can i use timer as counter??</title><link>https://devzone.nordicsemi.com/thread/48442?ContentTypeID=1</link><pubDate>Mon, 13 Nov 2017 14:17:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db79f819-4160-4420-9c8f-33cfe8edd1c9</guid><dc:creator>HYuan</dc:creator><description>&lt;p&gt;Hello, do you still have the code? it would be nice if you could send it to me. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how can i use timer as counter??</title><link>https://devzone.nordicsemi.com/thread/48441?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2016 13:33:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e4f9435-48e6-4f56-8258-e83be2842416</guid><dc:creator>Rokas</dc:creator><description>&lt;p&gt;Hello, could you share the sample code? It would help me too, thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how can i use timer as counter??</title><link>https://devzone.nordicsemi.com/thread/48440?ContentTypeID=1</link><pubDate>Mon, 28 Mar 2016 15:23:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db126de3-1d42-4f94-8289-7c78d2272b4b</guid><dc:creator>wlgrd</dc:creator><description>&lt;p&gt;Will try to provide some when I am back at my computer tomorrow&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how can i use timer as counter??</title><link>https://devzone.nordicsemi.com/thread/48439?ContentTypeID=1</link><pubDate>Mon, 28 Mar 2016 14:21:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d578c29a-11d9-4ff1-83f5-96338c4ed74a</guid><dc:creator>wooyongKim</dc:creator><description>&lt;p&gt;can i get some example code?? thanks..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how can i use timer as counter??</title><link>https://devzone.nordicsemi.com/thread/48438?ContentTypeID=1</link><pubDate>Mon, 28 Mar 2016 11:32:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1567ee9-1a74-4cd7-8bd3-159859a94cc2</guid><dc:creator>wlgrd</dc:creator><description>&lt;p&gt;Much smarter than my previous answer, don&amp;#39;t know what I was thinking, but the concept is almost the same.&lt;/p&gt;
&lt;p&gt;Use gpiote with event on rising edge, connect the event to timer start with ppi, connect falling edge gpiote event to timer stop and read the value. You can also connect the same event (stop event) to timer capture so the timer value resides in a CC register until you clear it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how can i use timer as counter??</title><link>https://devzone.nordicsemi.com/thread/48436?ContentTypeID=1</link><pubDate>Mon, 28 Mar 2016 11:19:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2c0a072-8439-454e-abd8-15162a64fff4</guid><dc:creator>wooyongKim</dc:creator><description>&lt;p&gt;hi, it will start with rising edge from PWM and stop with falling edge. i want to measure the time gap of it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how can i use timer as counter??</title><link>https://devzone.nordicsemi.com/thread/48443?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2016 21:42:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf7d2c47-3843-4aa0-82c5-9d80149f475c</guid><dc:creator>wlgrd</dc:creator><description>&lt;p&gt;Using nrf_drv_timer should work. The counter is just setting the timer mode to counter and trigger the COUNT task.
You can set up the pwm pin toggle to actually trigger the count task of a timer through GPIOTE and PPI. Connect the PWM pin to a GPIOTE event. Through PPI, connect the GPIOTE event to the TIMER COUNTER task for any timer.
When you are starting the measurement, you have set up another timer in timer mode, which you will start by setting the TIMER START task. When stopping, disable the PPI that counts the PWM and set the TIMER STOP task. Then you have a value for how long time you have done the measurement, and how many transitions the PWM has done during this time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how can i use timer as counter??</title><link>https://devzone.nordicsemi.com/thread/48437?ContentTypeID=1</link><pubDate>Wed, 23 Mar 2016 21:38:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed8c0024-3268-49db-bd8f-35bf95ba6513</guid><dc:creator>wlgrd</dc:creator><description>&lt;p&gt;how long do you need to measure the frequency? Do you use a button or anything to start the measurement or will it do it continously? When will you stop the measurement?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>