<?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 example how can i modify to pulse once and why dont I get time event</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57866/gpiote-example-how-can-i-modify-to-pulse-once-and-why-dont-i-get-time-event</link><description>Uisng pca10040 and SDk16.0.0 + Segger 
 I built and ran the GPIOTE example so I could experiment. 
 I want to toggle a gpio once only and then stop and I need to know when its complete. 
 So I changed NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK to NRF_TIMER_SHORT_COMPARE0_STOP_MASK</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Feb 2020 08:58:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57866/gpiote-example-how-can-i-modify-to-pulse-once-and-why-dont-i-get-time-event" /><item><title>RE: GPIOTE example how can i modify to pulse once and why dont I get time event</title><link>https://devzone.nordicsemi.com/thread/234816?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 08:58:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5c3fc1c-34bd-457a-a97b-fa600b091ea7</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Robin,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;in the GPIOTE example the Timer is configured in the&amp;nbsp;&lt;span&gt;extended compare mode using&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__timer.html#ga2ce27bb2a29a79257932da348a7c79e7"&gt;nrfx_timer_extended_compare&lt;/a&gt;. The last parameter passed to&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__timer.html#ga2ce27bb2a29a79257932da348a7c79e7"&gt;nrfx_timer_extended_compare&lt;/a&gt;&amp;nbsp;is the boolean value&amp;nbsp;&lt;em&gt;enable_int, &lt;/em&gt;which dictates if the&amp;nbsp;the interrupt for the compare channel is&amp;nbsp;enabled or disabled.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In the example&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__timer.html#ga2ce27bb2a29a79257932da348a7c79e7"&gt;nrfx_timer_extended_compare&lt;/a&gt;&amp;nbsp;is called with int_enable set to false&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; nrf_drv_timer_extended_compare(&amp;amp;timer, (nrf_timer_cc_channel_t)0, 200 * 1000UL, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So If you want the TIMER IRQ, i.e.&amp;nbsp;timer_dummy_handler to be called on every compare event, then you just need to alter the line to&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrf_drv_timer_extended_compare(&amp;amp;timer, (nrf_timer_cc_channel_t)0, 200 * 1000UL, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In order to have the GPIO go high and then low again, you will need to have two COMPARE0 event. In the GPIOTE context, toggleing a GPIO means that it will go from&lt;strong&gt; low to high&lt;/strong&gt; if the pin is low or&lt;strong&gt; high to low&lt;/strong&gt; if the pin is high. Hence, the TOGGLE task of the GPIO must be triggered twice for the GPIO to go back to the initial state.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Lastly, there is no event generated when a GPIO state is set, so if you want to verify that the pin went high or low, then you need to check this in the interrupt handler of the event that triggered the Toogle task, which in this case is the TIMER IRQ handler, i.e.&amp;nbsp;timer_dummy_handler.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, the whole point with the GPIO task and event system and PPI is that you&amp;#39;re able to trigger task without any CPU execution.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>