<?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>Input pulse width extend using GPIOTE / PPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75641/input-pulse-width-extend-using-gpiote-ppi</link><description>Good day 
 Due to I am very new with NRF chips and I did not find direct answer on forum I require some clarification on that moment... 
 
 The task is to detect input pulse ( trailing edge ) of original length 2 us and extend it for &amp;lt;time_us&amp;gt; 
 
 For</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Jun 2021 10:59:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75641/input-pulse-width-extend-using-gpiote-ppi" /><item><title>RE: Input pulse width extend using GPIOTE / PPI</title><link>https://devzone.nordicsemi.com/thread/313364?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 10:59:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13f111fc-58ef-4539-8b1c-9ea22fdf752e</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Yes, there are too much code executed in gpiote library before&amp;nbsp;it calls your event handler. To make things faster, write your own high-priority interrupt handler instead of using library (though with running BLE stack you still get no guarantee that interrupt comes in time). Or you could configute pin as D0H1 and make a pulse with PWM hardware&amp;nbsp;activated&amp;nbsp;by GPIOTE event - I can&amp;#39;t say for sure that it will work on the same pin but you can try.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Input pulse width extend using GPIOTE / PPI</title><link>https://devzone.nordicsemi.com/thread/313080?ContentTypeID=1</link><pubDate>Wed, 02 Jun 2021 11:53:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05fb1190-8ed1-43f3-8c35-b44e5855657f</guid><dc:creator>swisst</dc:creator><description>&lt;p&gt;Both plots reflect pin state - original pulse ( high one on the plots ) and generated ( low one but not complete ) have delay between leading edges and that is exactly what I was trying to show on plots&lt;/p&gt;
&lt;p&gt;The delay between leading edges ( ~25 us ) is time between GPIOTE edge detect event -&amp;gt; in_handler invocation -&amp;gt;&amp;nbsp; series of pin commands ( pin_set and pin_cfg ) before&amp;nbsp;nrf_delay_us()&lt;/p&gt;
&lt;p&gt;The strong level you mentioned is caused because of delay when pin is not reconfigured to output - both plots describe leading edge ( despite of second one is too low to be high )&lt;/p&gt;
&lt;p&gt;But I use commented code&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#if( !_PROLONG_WITH_2_PINS)
    configure_txir_pin( false );
    nrf_drv_gpiote_out_set( TXIR_OUT_PIN );
    nrf_delay_us( get_txir_pulse_width_us() );
    configure_txir_pin( true );
#endif
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I get next picture with the same schematic but with longer delay between leading edges&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/IMG_5F00_20210602_5F00_143518.jpg" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Input pulse width extend using GPIOTE / PPI</title><link>https://devzone.nordicsemi.com/thread/313066?ContentTypeID=1</link><pubDate>Wed, 02 Jun 2021 11:24:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b572262-64ee-45d2-9d50-6a2ac2cfb404</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;I can&amp;#39;t get how your signals are put together.. does pulse source have open-drain output?&lt;/p&gt;
&lt;p&gt;At the end of pulse, you call&amp;nbsp;nrf_gpio_pin_clear then&amp;nbsp;configure_txir_pin - between them you have strong low level. You don&amp;#39;t need to change pin state, only configuration. For predictable timings, it&amp;#39;s probably better to use GPIOTE with&amp;nbsp;NRF_GPIO_PIN_D0H1 output (not sure because I don&amp;#39;t know your schematic).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Input pulse width extend using GPIOTE / PPI</title><link>https://devzone.nordicsemi.com/thread/313056?ContentTypeID=1</link><pubDate>Wed, 02 Jun 2021 10:05:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6cea8921-3dae-4b0c-ae96-9b20cbefcbe5</guid><dc:creator>swisst</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;thanks for reply&amp;nbsp; - I did try to implement it in this way&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5684.pulse_5F00_width_5F00_extend.c"&gt;devzone.nordicsemi.com/.../5684.pulse_5F00_width_5F00_extend.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;the problem is only in leading edge delay - there is profit but the problem is still exists.&amp;nbsp;Now the output pin high level differs&amp;nbsp;depending on how it is configured ( nrf_gpio_cfg() or nrf_drv_gpiote_out_init() )&lt;/p&gt;
&lt;p&gt;sdk_config.h&lt;/p&gt;
&lt;p&gt;#define GPIOTE_CONFIG_IRQ_PRIORITY 2&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;below best and worst cases&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/IMG_5F00_20210602_5F00_121133.jpg" /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/IMG_5F00_20210602_5F00_120430.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Sorry for delays - please take in account that it is a challenge for now to implement so main tasks may have influence&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Input pulse width extend using GPIOTE / PPI</title><link>https://devzone.nordicsemi.com/thread/312323?ContentTypeID=1</link><pubDate>Fri, 28 May 2021 09:37:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f03d14db-937c-40c4-9b96-03d5fc89abaf</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;you don&amp;#39;t need to unconfigure pin, just set output value to 1 and then use &lt;code&gt;nrf_gpio_cfg()&amp;nbsp;&lt;/code&gt;to switch direction from input to output and back.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Input pulse width extend using GPIOTE / PPI</title><link>https://devzone.nordicsemi.com/thread/312031?ContentTypeID=1</link><pubDate>Thu, 27 May 2021 10:37:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73d319e6-c1f1-4a75-9a00-f494f0124264</guid><dc:creator>swisst</dc:creator><description>&lt;p&gt;Hi Sigurd&lt;/p&gt;
&lt;p&gt;Thanks for quick reply.&lt;/p&gt;
[quote userid="15146" url="~/f/nordic-q-a/75641/input-pulse-width-extend-using-gpiote-ppi/311746#311746"]You want to use 1 GPIO pin for both the input and the output?[/quote]
&lt;p&gt;Exactly, I want to use one pin by re-configuring it on the fly&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Input pulse width extend using GPIOTE / PPI</title><link>https://devzone.nordicsemi.com/thread/311746?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 11:23:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdcacb42-a278-4f8a-aebf-1ad56dbc5a75</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="99142" url="~/f/nordic-q-a/75641/input-pulse-width-extend-using-gpiote-ppi"]&lt;p&gt;I plan to improve this implementation with hw timer +&amp;nbsp;PPI to produce &amp;lt;time_us&amp;gt; delay with&amp;nbsp;falling edge&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Yes, that is the best approach. You might find the &amp;quot;second_count_ppi_rtc_timers.zip&amp;quot; example from this post useful:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/34547/ppi-configuration-to-count-pulses/133136#133136"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/34547/ppi-configuration-to-count-pulses/133136#133136&lt;/a&gt;&lt;/p&gt;
[quote userid="99142" url="~/f/nordic-q-a/75641/input-pulse-width-extend-using-gpiote-ppi"]The task is to detect input pulse ( trailing edge ) of original length 2 us and extend it for &amp;lt;time_us&amp;gt;[/quote][quote userid="99142" url="~/f/nordic-q-a/75641/input-pulse-width-extend-using-gpiote-ppi"]But the question is whether it is possible to implement this using only one pin ?[/quote]
&lt;p&gt;You want to use 1 GPIO pin for both the input and the output?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>