<?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>Timer 0 interface program</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51450/timer-0-interface-program</link><description>Hi, 
 i am trying to interface ultrasonic sensor with nrf9160, but i dont get any examples regarding ultrasonic. so i tried the interrupt method to measure the time of gpio high state, i used 
 k_cycle_get_32(); function to get starting timing and also</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 30 Aug 2019 12:32:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51450/timer-0-interface-program" /><item><title>RE: Timer 0 interface program</title><link>https://devzone.nordicsemi.com/thread/207141?ContentTypeID=1</link><pubDate>Fri, 30 Aug 2019 12:32:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2adab7ec-9c24-4c90-ba9f-423d1d336909</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try this sample and see if it works on your end? It uses TIMER in 16M resolution.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Rallare/fw-nrfconnect-nrf/tree/nrf9160_samples/samples/nrf9160/nrfx_timed_signal"&gt;https://github.com/Rallare/fw-nrfconnect-nrf/tree/nrf9160_samples/samples/nrf9160/nrfx_timed_signal&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You might have to change the pins to match your use-case. Its GPIOs 6 and 7 now, which are active low at my end.&lt;/p&gt;
&lt;p&gt;Note the spm diff file, where DPPIC is set to non-secure.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer 0 interface program</title><link>https://devzone.nordicsemi.com/thread/206897?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2019 13:31:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1250252e-a4e1-4d66-a5c4-5b7134859e01</guid><dc:creator>hmdra</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;br /&gt;&amp;nbsp;Thank you for your valuable response,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;i need micro second timer accuracy, ultrasonic need two GPIOs, one for tirgger and another is for echo, i configure trigger as output and echo pin as interrupt, as per the ultrasonic datasheet the echo pin returns the high state for a short period of time which is help to measure the distance. so that i start measure timing for initial high level and end of the high level, then i converts it as nanosecond.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;the posted program is now working good to me, the only thing make my timing different is printing statement. it tooks more time so i have missed the original count.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;as per your suggestion i have doubt how to configure GPIOTE as toggle. i didnt have an API for that.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&amp;nbsp;&lt;/p&gt;
&lt;p&gt;hmdra&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer 0 interface program</title><link>https://devzone.nordicsemi.com/thread/206617?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2019 12:14:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4739bb81-ade9-4b13-9416-da985806bd69</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What is the required accuracy for the signal? Right now you&amp;#39;re using the&amp;nbsp;RTC (the kernel timer), which is 32.768 kHz base frequency, which might not be accurate enough for your application.&lt;/p&gt;
&lt;p&gt;In order to do this as accurate as possible, it would require:&lt;/p&gt;
&lt;p&gt;*&amp;nbsp;NRF_TIMER&lt;/p&gt;
&lt;p&gt;* 2 x GPIOTE IN (One on rising, one on falling edge)&lt;/p&gt;
&lt;p&gt;* Two PPI channels (one to start, one to stop TIMER)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Connect the signal you want to time to two GPIOs (configured as IN), as &amp;quot;GPIOTE IN Toggle&amp;quot; will not be able to differentiate between the start and stop of the signal here.&lt;/p&gt;
&lt;p&gt;This method will require either bare-metal or the usage of nrfx drivers directly.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>