<?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>Counter Configuration in Zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74255/counter-configuration-in-zephyr</link><description>Hello, how can we configure the counter in an nrfx52840 dev board to count pulses on an input pin in zephyr? There is a counter driver in zephyr, but there doesn&amp;#39;t seem to be a way to configure it to count outside transitions. We know the nrf52 hardware</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 21 Apr 2021 11:57:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74255/counter-configuration-in-zephyr" /><item><title>RE: Counter Configuration in Zephyr</title><link>https://devzone.nordicsemi.com/thread/306084?ContentTypeID=1</link><pubDate>Wed, 21 Apr 2021 11:57:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:964b0b4b-1961-4a1c-aade-b3380b1a7fa2</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order to count pulses, you need to place the TIMER instance in COUNTER mode.&lt;/p&gt;
&lt;p&gt;If you search for &amp;quot;timer counter mode&amp;quot; on the forum, you can find several examples on how to setup a timer instance in this mode.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to count and time the pulse, you should consider to use one TIMER in COUNTER mode, one TIMER in normal capture/compare, GPIOTE IN channels, and PPI.&lt;/p&gt;
&lt;p&gt;This setup will only require cpu interaction for setup and the &amp;quot;end interrupt&amp;quot;. Please see this implementation for nRF9160 (uses DPPI, so needs a bit of porting) for such a scenario:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/nrfx_timed_signal/src/main.c"&gt;https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/nrfx_timed_signal/src/main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can also search on the forum for how to setup this bare-metal/using nrfx drivers directly.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>