<?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>How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23267/how-to-measure-two-wave-delay</link><description>I have two square waveforms coming out of a pin each.
I want to measure the delay between them.
Which command should I use?
How can I do this?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Oct 2017 02:03:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23267/how-to-measure-two-wave-delay" /><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91502?ContentTypeID=1</link><pubDate>Mon, 30 Oct 2017 02:03:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:367cb88b-f2a5-49eb-ae7d-bde7400fc392</guid><dc:creator>B</dc:creator><description>&lt;p&gt;Thank you very much Jorgen! I have managed to solve this problem! But another problem has arisen...&lt;/p&gt;
&lt;p&gt;I am trying to add this code that you sent me with the code &amp;quot;Bluetooth low energy Characteristics, a beginner&amp;#39;s tutorial&amp;quot;, but the functions &amp;quot;gpiote_init ()&amp;quot; and &amp;quot;timer_init ()&amp;quot; are conflicting with bluetooth transmission.&lt;/p&gt;
&lt;p&gt;Could you please take a look at this other question that I asked on the Nordic Developer Zone and help me please to find the error?&lt;/p&gt;
&lt;p&gt;The other question is:
&lt;a href="https://devzone.nordicsemi.com/question/175766/why-is-the-function-gpiote_init-and-timer_init-conflicting-with-the-bluetooth-code/"&gt;link text&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91501?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2017 09:37:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8db471a3-5ef3-436c-8ad4-79d32d7700cd</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Try &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;debugging&lt;/a&gt; to see which function is returning non-zero error code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91500?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 22:21:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df5fd9d1-7f4c-4340-b3a4-8e7e53e352af</guid><dc:creator>B</dc:creator><description>&lt;p&gt;Thank you very much again!!!!
The sdk 11 version is compiling and it sends data to the log. It crashes after some time though.. it’s not sending data continuously as the sdk 12 version did. How could I correct it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91504?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 13:12:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90ab485e-524a-4e1b-a212-d5470b675e52</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Updated above answer with SDK 11 version. Note that only Keil project is updated with correct files.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91499?ContentTypeID=1</link><pubDate>Sat, 21 Oct 2017 19:55:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9018745-829c-4465-8dc9-b3718bc86bf3</guid><dc:creator>B</dc:creator><description>&lt;p&gt;Hi Jørgen, Could you help me please with another thing? The code you sent me as an example uses the version of SDK 12.3, but I need it in version 11. How can I do this?
Can you send me the same example in version 11 of SDK, please?!&lt;/p&gt;
&lt;p&gt;Thank you
Best wishes,
B.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91498?ContentTypeID=1</link><pubDate>Mon, 09 Oct 2017 19:51:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7c14a22-7ba1-4acf-ae8b-6359c9b39111</guid><dc:creator>B</dc:creator><description>&lt;p&gt;Thank you very much!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91496?ContentTypeID=1</link><pubDate>Wed, 04 Oct 2017 07:29:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80307601-3b9a-44de-b629-cc922e2c7a3a</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You send it the way described in the links I posted above. I do not know how you receive the values in app inventor or android studio, as I have never used either of those. You should ask that question on the support portals for those development tools.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91497?ContentTypeID=1</link><pubDate>Mon, 02 Oct 2017 18:54:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:101cb84a-a132-4c8c-97ea-a5eacdb24b87</guid><dc:creator>B</dc:creator><description>&lt;p&gt;Hi Jorgen,
How do I send those values ​​that are leaving the terminal to a mobile application using the app inventor, or android studio?!
I do not know how to do this. How would the microcontroller code? Could you help me by sending an example please?!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91493?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 12:52:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da3a348b-cb5b-4659-9c7d-3de634642984</guid><dc:creator>B</dc:creator><description>&lt;p&gt;Thanks a lot! I&amp;#39;m using this microcontroller a little time so I have difficulties.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91492?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 12:40:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0f53b2e-654a-4254-8d12-8b3bbd16e170</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You can store the measured delay any way you want, in variables, &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/flashwrite_example.html?cp=4_0_3_4_5_9"&gt;write it to flash&lt;/a&gt;, or send it over BLE using &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/ble_sdk_app_nus_eval.html?cp=4_0_3_4_2_2_19"&gt;Nordic UART service&lt;/a&gt; or &lt;a href="https://devzone.nordicsemi.com/tutorials/8"&gt;custom BLE service&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91491?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 12:35:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22c6e3da-2660-4e8a-ad11-3973240d58bc</guid><dc:creator>B</dc:creator><description>&lt;p&gt;In the microcontroller registers. it&amp;#39;s possible?
Because I want to send these measurements by Bluetooth to a mobile
How can I do this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91494?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 06:32:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0ad6d29-8924-4975-a3b7-c09ce2b9961d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;What registers?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91495?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 04:09:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8531f30f-1112-4566-956a-3f7ab6224e63</guid><dc:creator>B</dc:creator><description>&lt;p&gt;Assuming there are different measured delay values. How do I store them in the registers?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91503?ContentTypeID=1</link><pubDate>Tue, 11 Jul 2017 12:29:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19199ccb-769e-42b9-ae57-c360e46c5585</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You can use PWM with a duty cycle of 50% to generate a square wave. There is PWM &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v13.1.0/pwm_hw_example.html?cp=4_0_0_4_5_19"&gt;driver&lt;/a&gt; and &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v13.1.0/pwm_example.html?cp=4_0_0_4_5_20"&gt;library&lt;/a&gt; example in our SDK. The rest of your request should be achievable using the code I posted in my answer above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91505?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2017 14:19:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8be134dd-2827-4467-a1af-9def4e6c960e</guid><dc:creator>B</dc:creator><description>&lt;p&gt;Hi!
Thank you very much for your answer. It helped a lot!
But I have another question, could you help me please?
I want the microcontroller to generate a square wave, this wave will go through an RC (external circuit), and then the microcontroller will measure the delay between them (the delay between the generated wave and that same wave passing through the RC), how can I do that? Could you send me a code as an example?!&lt;/p&gt;
&lt;p&gt;Best regards, B&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91490?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2017 15:23:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4f111e6-bc72-4aa7-84db-51143509e03f</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you are willing to use two extra GPIO ports, I think it should be possible to achieve what you want by using &lt;a href="http://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.1.pdf#page=70"&gt;GPIOTE&lt;/a&gt;, &lt;a href="http://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.1.pdf#page=73"&gt;PPI&lt;/a&gt; and &lt;a href="http://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.1.pdf#page=99"&gt;TIMERS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Connect the output pins to two new input pins that are configured to sense rising edge of a signal using GPIOTE. Use PPI channels to connect the sensing event of one input pins to the start task of a timer, and the sensing event of the second input pin to the stop and capture task of the timer allows you to measure the delay between the rising edge of the two output pins.&lt;/p&gt;
&lt;p&gt;I have created an example showing how this can be achieved using the drivers in SDK 12.3. Note that you have to connect PIN_OUT_1 to PIN_IN_1 and PIN_OUT_2 to PIN_IN_2 using cables. The timer runs at at 16 MHz, and the result reported is number of ticks. To convert it to seconds you can divide by 16000000. Let me know if anything is unclear.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/delay_5F00_between_5F00_pin_5F00_rise.zip"&gt;delay_between_pin_rise.zip (SDK12.3.0)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/delay_5F00_between_5F00_pin_5F00_rise_5F00_sdk11.zip"&gt;delay_between_pin_rise_sdk11.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91486?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2017 12:11:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e02fa988-4e06-4b66-81aa-bc358115f5b1</guid><dc:creator>B</dc:creator><description>&lt;p&gt;Yes!!
I wanted to see some example code that measured the delay between two square waves.
I do not know how to do this.
Could you help me please?!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91485?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2017 11:56:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84e53d1e-6f2d-484f-9f01-b6c5af1e24c8</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Are you using nRF51?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91489?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2017 10:04:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f1bcdb8-a604-40ba-9b78-261c4956959e</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Why would you do it? Even if MCU would do this for you there will be jitter caused by clock cycles needed to perform the instructions so it will be inaccurate. And what kind of &amp;quot;command&amp;quot; you expect? You think that ARM Cortex-M MCU worth 1~2USD in big volumes is running some fancy OS which allows you to communicate with it in &amp;quot;commands&amp;quot;?:) To do ANYTHING with such deeply embedded system YOU need to develop FW (it&amp;#39;s kind of misleading to speak about OS;), load it to it and then use interfaces and protocols you&amp;#39;ve implemented in your FW source code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91488?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2017 00:48:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72666454-df89-4bae-99a2-67eb343837ab</guid><dc:creator>B</dc:creator><description>&lt;p&gt;Oh yes ... But I want the microcontroller itself to measure this delay between waves. It is possible? How can I do it? And which command should I use?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to measure two wave delay?</title><link>https://devzone.nordicsemi.com/thread/91487?ContentTypeID=1</link><pubDate>Wed, 05 Jul 2017 20:42:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16f5756a-5a49-4c84-bd86-24c184ba2960</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Attach oscilloscope or logical analyzer to both PINs and then see time difference directly on time axis.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>