<?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 to config the gpiote and timer capture mode to count the external pulses on a GPIO?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61073/how-to-config-the-gpiote-and-timer-capture-mode-to-count-the-external-pulses-on-a-gpio</link><description>Hi, 
 I am new to NORDIC dev and I find its ppi is really useful but also difficult to understand. 
 Now my device may be connected the truck engine to count the engine speed(rpm) with a gpio. The engine generates a pulse on the GPIO and the device needs</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 May 2020 11:01:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61073/how-to-config-the-gpiote-and-timer-capture-mode-to-count-the-external-pulses-on-a-gpio" /><item><title>RE: How to config the gpiote and timer capture mode to count the external pulses on a GPIO?</title><link>https://devzone.nordicsemi.com/thread/248416?ContentTypeID=1</link><pubDate>Wed, 06 May 2020 11:01:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f31e8dbb-4197-4896-b381-bda9267f1cc8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I notice a few problems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You use the default timer configuration&amp;nbsp;NRF_DRV_TIMER_DEFAULT_CONFIG as is, without doing any changes. Unless you have made changes in your sdk_config.h file, the default configuration for the timer driver is to use the timer in timer mode, not counter mode, which is what you want.&lt;/li&gt;
&lt;li&gt;You use NRF_TIMER_CC_CHANNEL0, but you should use the COUNT task to increment the counter in the timer (NRF_TIMER_TASK_COUNT).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Looking quickly fixing those two issues should work. You could also refer to &lt;a href="https://jimmywongiot.com/2019/10/03/how-to-count-gpio-pin-raising-falling-with-timer-counter-through-ppi/"&gt;this example&lt;/a&gt;, which demonstrates exactly what you want to do (see the last part of&amp;nbsp;timer_counter_with_gpio() &lt;a href="https://github.com/jimmywong2003/nrf5-gpio-ppi-timer-counter/blob/master/ble_app_uart/main.c"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>