<?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>Counting edges with PPI and GPIOTE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/54289/counting-edges-with-ppi-and-gpiote</link><description>I&amp;#39;ve used the example in examples/peripheral/gpiote to count edges of a WATCHDOG pin from a different MCU: 
 
 
 
 After starting the timer I want to periodically get the current count value with: 
 
 But it always gives me a constant value. If I use</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 Nov 2019 10:55:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/54289/counting-edges-with-ppi-and-gpiote" /><item><title>RE: Counting edges with PPI and GPIOTE</title><link>https://devzone.nordicsemi.com/thread/219868?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 10:55:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1491cff6-b8bd-4f9b-a2e3-a4a9f278e292</guid><dc:creator>Constantin</dc:creator><description>&lt;p&gt;Okay I&amp;#39;ve solved it: The issue is that you can not read the current count of the timer without triggering a capture. I solved it with:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_TIMER4-&amp;gt;TASKS_CAPTURE[2] = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;toggle_count = NRF_TIMER4-&amp;gt;CC[2];&lt;/p&gt;
&lt;p&gt;Maybe adding this information to the documentation or exampel is worth it.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Counting edges with PPI and GPIOTE</title><link>https://devzone.nordicsemi.com/thread/219846?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 09:37:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac06d8b3-9932-483c-b8f0-be74c36ddc4a</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Please check the return codes from&amp;nbsp;nrfx_timer_init() and the nrfx_ppi_x functions, and make sure that they return&amp;nbsp;NRFX_SUCCESS (=0). If you are not able to&amp;nbsp;find&amp;nbsp;the root cause of the issue, please post your main.c file and/or a full example that shows the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Counting edges with PPI and GPIOTE</title><link>https://devzone.nordicsemi.com/thread/219763?ContentTypeID=1</link><pubDate>Tue, 12 Nov 2019 20:01:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3aae67d-b067-4e82-abcc-047ae20a1068</guid><dc:creator>Constantin</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;okay that sound reasonable. But I am still not getting any count when I call&lt;/p&gt;
&lt;p&gt;toggle_count = nrfx_timer_capture_get(&amp;amp;m_timer, NRF_TIMER_CC_CHANNEL0);&lt;/p&gt;
&lt;p&gt;It only gives permanent 0. Although the line the toggling. What Am I missing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Counting edges with PPI and GPIOTE</title><link>https://devzone.nordicsemi.com/thread/219745?ContentTypeID=1</link><pubDate>Tue, 12 Nov 2019 16:41:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54456c98-9db7-4746-8879-91638f4e5e46</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;The gpiote interrupt is not enabled, only the event is enabled, i.e. last argument in nrf_drv_gpiote_in_event_enable(PIN_IN, false) is set to false.&lt;/p&gt;
&lt;p&gt;Same applies to the timer used for counting, the function nrf_drv_timer_compare_int_enable() and nrf_drv_timer_extended_compare() is not used to enable any interrupt for that timer.&lt;/p&gt;
&lt;p&gt;In the example, the m_timer_read interrupt is only used to periodically print the counter value.&lt;/p&gt;
&lt;p&gt;Also, the example I linked to does by default not put the CPU to sleep. Something like the snippet below should be added to main() while-loop&amp;nbsp;in order to do that.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    if (NRF_LOG_PROCESS() == false)
    {
                        // Wait for an event.
        __WFE();
        // Clear the internal event register.
        __SEV();
        __WFE();
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Counting edges with PPI and GPIOTE</title><link>https://devzone.nordicsemi.com/thread/219731?ContentTypeID=1</link><pubDate>Tue, 12 Nov 2019 15:40:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb385080-9003-4558-aa8f-42ab7d793d93</guid><dc:creator>Constantin</dc:creator><description>&lt;p&gt;Thanks for the reply. The issue is that in the example there are two interrupt routines. But I want to solve it without any interrupt routine. Why do I have to enter a timer_handler and a gpiote handler? &lt;br /&gt;This consumes CPU without optimization.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Counting edges with PPI and GPIOTE</title><link>https://devzone.nordicsemi.com/thread/219688?ContentTypeID=1</link><pubDate>Tue, 12 Nov 2019 13:43:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b2d34a4-3d40-4734-be79-b8c5969afdb9</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Check the code attached at the end of &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/53139/nrf52-calculation-method-between-rising-edges"&gt;this post&lt;/a&gt;&amp;nbsp;(inside the gpiote_timer_ppi.zip)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>