<?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>GPIOTE two events for the same pin?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/64181/gpiote-two-events-for-the-same-pin</link><description>Hello, 
 For nRF51822 and nRF52832, I&amp;#39;m using GPIOTE, PPI and timers to measure the duration that a pin, which is normally low, goes hi (typically 100-300 milliseconds). I don&amp;#39;t want to use GPIOTE_CONFIG_POLARITY_Toggle because I&amp;#39;d have to keep track</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 Aug 2020 22:12:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/64181/gpiote-two-events-for-the-same-pin" /><item><title>RE: GPIOTE two events for the same pin?</title><link>https://devzone.nordicsemi.com/thread/262870?ContentTypeID=1</link><pubDate>Mon, 03 Aug 2020 22:12:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aad65483-2d10-4b19-8216-ef73eb0d97b3</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;Thanks, Simon, for checking with Susheel about this. I&amp;#39;ve revised our board to use two pins, so new product will be correct. We have product in customer use (around the world) where only one pin is used. While we have not experienced any issues, still we can push an update out via our iOS app and OTA DFU. I wonder about using one of these two approaches:&lt;/p&gt;
&lt;p&gt;1) Configure GPIOTE channel to watch for LoToHi event&amp;nbsp;and trigger interrupt. In the interrupt routine, reconfigure the&amp;nbsp;channel to watch for HiToLo. Potential issue is the interrupt does not happen before the HiToLo event occurs.&lt;/p&gt;
&lt;p&gt;2) Configure GPIOTE channel to watch for toggle event and use PPI groups to enable/disable PPI channels. Initially PPI group for channel to start timer1 is enabled. Add two&amp;nbsp;additional PPI channels that, in a PPI group, on GPIOTE channel event, disable group for channel to start timer1 and enable channel to stop timer1. See &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/45643/gpiote-one-input-pin-to-few-channels/179667#179667" rel="noopener noreferrer" target="_blank"&gt;this post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Reasonable? Pros/cons to each?&lt;/p&gt;
&lt;p&gt;Also, I&amp;#39;ve changed calls to&amp;nbsp;&amp;nbsp;nrfx_ppi_channel_enable() to:&lt;/p&gt;
&lt;pre&gt;err_code = sd_ppi_channel_assign(chan_0, nrfx_gpiote_in_event_addr_get(MY_PIN1),nrfx_timer_task_address_get(&amp;amp;m_timer1,NRF_TIMER_TASK_START));&lt;/pre&gt;
&lt;p&gt;and now get this compiler warning:&lt;/p&gt;
&lt;pre&gt;passing argument 2 of &amp;#39;sd_ppi_channel_assign&amp;#39; makes pointer from integer without a cast [-Wint-conversion]&lt;br /&gt;passing argument 3 of &amp;#39;sd_ppi_channel_assign&amp;#39; makes pointer from integer without a cast [-Wint-conversion]&lt;/pre&gt;
&lt;p&gt;Seems to work, but would like to understand and address the warnings.&lt;/p&gt;
&lt;p&gt;Many thanks, Simon.&lt;/p&gt;
&lt;p&gt;Tim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE two events for the same pin?</title><link>https://devzone.nordicsemi.com/thread/262697?ContentTypeID=1</link><pubDate>Mon, 03 Aug 2020 06:53:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af3b77be-99a2-4a7a-84ba-bbc6f7694721</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Tim&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve talked to Susheel, and he agrees with me. Seeing as this is outside of the GPIOTE specification, we can&amp;#39;t guarantee that this will work and we strongly recommend that you revise your board to uphold the one-pin-one-GPIOTE rule. As already stated, you might be good in your current setup, but any changes or untested operations on your device might cause a race condition between the GPIOTEs on this pin, leading to a crash/error.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE two events for the same pin?</title><link>https://devzone.nordicsemi.com/thread/262454?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2020 14:57:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e0ee22a-2edb-42f8-a052-b89bbf9ad9df</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;Thank you, Simonr, for checking with Susheel. Appreciate it.&lt;/p&gt;
&lt;p&gt;Tim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE two events for the same pin?</title><link>https://devzone.nordicsemi.com/thread/262284?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2020 06:22:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:506c8996-69d3-4bea-8f2e-6a3e8a3983a2</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Tim&lt;/p&gt;
&lt;p&gt;Seeing as you don&amp;#39;t have had any issues as of yet, I think you should be safe at these lower frequencies, but please let me double-check that with Susheel when he gets back into office (that should be on Monday). However, we can&amp;#39;t guarantee or recommend doing it like this due to the fact that we haven&amp;#39;t tested it thoroughly enough on our side as far as I know.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE two events for the same pin?</title><link>https://devzone.nordicsemi.com/thread/262028?ContentTypeID=1</link><pubDate>Tue, 28 Jul 2020 14:27:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80a47de7-6a9d-480f-9eb4-86c0b813537d</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;Thanks Simonr. I will modify our circuit for nRF52832 product in development to use two IO pins. I&amp;#39;m wondering, though, about nRF51822 product we have in the field, which uses the same code as above.&amp;nbsp;Susheel says:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span&gt;+1 for RK, It does break the rule, could be some side effects if myPin is toggling close to system clock frequency. But at lower frequencies on myPin (&amp;lt;4MhZ) this would work (not recommended though)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For my&amp;nbsp;product, the pin input signal (from a sensor) is not modulated at a certain frequency. I&amp;#39;m using GPIOTE to act on a single pulse (one LoToHi followed usually 100-300 ms later by one HiToLo, then some time&amp;nbsp;later, repeat). Given what Susheel says above, am I safe? I posed this question &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/53187/direct-manipulation-of-peripherals-timer-gpiote-ppi" rel="noopener noreferrer" target="_blank"&gt;a while ago&lt;/a&gt; and Hakon&amp;#39;s&amp;nbsp;response suggested it should be okay.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If not, is there anything I can do to resolve? I&amp;#39;d rather not use toggle event because sometimes a pulse can come quickly after the previous one (it can be quite random), and with SoftDevice enabled, the interrupt handler might not fire in time to flip the event.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If given our use case this is an issue for nRF51822, I&amp;#39;m hopeful for a workaround that we can push out to our customers via OTA DFU.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;/p&gt;
&lt;p&gt;-Tim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE two events for the same pin?</title><link>https://devzone.nordicsemi.com/thread/261904?ContentTypeID=1</link><pubDate>Tue, 28 Jul 2020 08:37:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d39dedae-1397-4c0a-8b70-779f7a73a369</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi again Tim&lt;/p&gt;
&lt;p&gt;Yes, as Susheel and RK are saying in that post, this is breaking the &amp;quot;one-pin-one GPIOTE&amp;quot; rule, so we can&amp;#39;t recommend it or guarantee that it will work. If you do sufficient testing and feel confident that this does work for you, you&amp;#39;re of course, welcome to do what works for you, but it&amp;#39;s not recommended by Nordic. My suggestion would be to use one pin for each GPIOTE event/task.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE two events for the same pin?</title><link>https://devzone.nordicsemi.com/thread/261839?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2020 15:44:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5668ed99-2e0b-480a-97e3-6ac3f8a3deb3</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;Sorry Simonr. Updated original post to include the link. Appreciate your response about this.&lt;/p&gt;
&lt;p&gt;-Tim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GPIOTE two events for the same pin?</title><link>https://devzone.nordicsemi.com/thread/261798?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2020 13:09:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c68b2f63-5b7a-4e4a-9b3f-18010ec68206</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Tim&lt;/p&gt;
[quote user=""]This post states that using two GPIOTE events on the same pin breaks&amp;nbsp;the one-pin-one-GPIOTE rule.[/quote]
&lt;p&gt;&amp;nbsp;Can you please link to the post you&amp;#39;re referring to here?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>