<?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>Using a counter via PPI to count pulses on a pin</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40415/using-a-counter-via-ppi-to-count-pulses-on-a-pin</link><description>I am highly experienced with microcontrollers, all the way back to the Intel 8008, but somewhat new to the nRF52832, with only a few designs under my belt for this microcontroller. I am attempting to use the PPI for my first time, in order to link a port</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Nov 2018 10:10:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40415/using-a-counter-via-ppi-to-count-pulses-on-a-pin" /><item><title>RE: Using a counter via PPI to count pulses on a pin</title><link>https://devzone.nordicsemi.com/thread/157254?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 10:10:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d13cecd7-b236-42ef-972f-49153c41c5ff</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Steve&lt;/p&gt;
&lt;p&gt;That is interesting. Typically it is only bit 31 that should be set. This is the PORT event, which is usually used for button detection by the button library.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You might find that buttons will no longer work if you clear this bit ;)&lt;/p&gt;
&lt;p&gt;Can you try to read the register before you clear it, using the debugger?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then you should see which bits are set originally.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As a general comment I would strongly suggest using the defines in nrf52_bitfields.h rather than using magic numbers for the registers. Then your code is more easily readable:&lt;/p&gt;
&lt;p&gt;&lt;em&gt; NRF_GPIO-&amp;gt;PIN_CNF[31] = GPIO_PIN_CNF_SENSE_Low &amp;lt;&amp;lt; GPIO_PIN_CNF_SENSE_Pos;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; NRF_GPIOTE-&amp;gt;CONFIG[6] = GPIOTE_CONFIG_MODE_Event &amp;lt;&amp;lt; GPIOTE_CONFIG_MODE_Pos |&lt;/em&gt;&lt;br /&gt;&lt;em&gt; 31 &amp;lt;&amp;lt; GPIOTE_CONFIG_PSEL_Pos;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using a counter via PPI to count pulses on a pin</title><link>https://devzone.nordicsemi.com/thread/157065?ContentTypeID=1</link><pubDate>Tue, 13 Nov 2018 11:58:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71e583be-c70b-41c5-8aba-85095a151b13</guid><dc:creator>SteveHx</dc:creator><description>&lt;p&gt;I have added this line to my configuration function:&lt;/p&gt;
&lt;p&gt;NRF_GPIOTE -&amp;gt; INTENCLR = 0xFFFFFFFF;&lt;/p&gt;
&lt;p&gt;and now everything works as it should. That tells me that somebody enabled one or more interrupts on that port. Everything appears to now be working nicely, including the BLE stack. But what have I turned off that is going to bite me later?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>