<?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>1 Us delay ! Using nRF connect SDK.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91421/1-us-delay-using-nrf-connect-sdk</link><description>I have been trying to achieve a delay of 1 Us , I have tried using Kernel timers and even tried fetching the system clock and getting the difference, But I am unable to figure it out. 
 I am new to RTOS and NCS also , any help would be appreciated .</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 Aug 2022 11:31:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91421/1-us-delay-using-nrf-connect-sdk" /><item><title>RE: 1 Us delay ! Using nRF connect SDK.</title><link>https://devzone.nordicsemi.com/thread/383655?ContentTypeID=1</link><pubDate>Mon, 29 Aug 2022 11:31:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89b5956d-504f-4445-b120-c1c5522e7a17</guid><dc:creator>Manas_punjabi</dc:creator><description>&lt;p&gt;Thank you for your support , it worked.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 1 Us delay ! Using nRF connect SDK.</title><link>https://devzone.nordicsemi.com/thread/383633?ContentTypeID=1</link><pubDate>Mon, 29 Aug 2022 10:16:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2daacc71-ab6a-43e4-8d31-d9b4acc720e2</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;For sleep intervals in such low microsecond range, you must use the k_busy_wait() function:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.zephyrproject.org/3.0.0/reference/kernel/threads/index.html#c.k_busy_wait"&gt;https://docs.zephyrproject.org/3.0.0/reference/kernel/threads/index.html#c.k_busy_wait&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This will be a blocking function, meaning the delay is based on cpu cycles instead of a timer.&lt;/p&gt;
&lt;p&gt;Could you try this and see if it works better for your use-case?&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: 1 Us delay ! Using nRF connect SDK.</title><link>https://devzone.nordicsemi.com/thread/383628?ContentTypeID=1</link><pubDate>Mon, 29 Aug 2022 09:26:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b93c708d-65cb-4351-bbf3-34c5f094b334</guid><dc:creator>Manas_punjabi</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;device.h&amp;gt;
#include &amp;lt;devicetree.h&amp;gt;
#include &amp;lt;drivers/gpio.h&amp;gt;
#include &amp;lt;sys/util.h&amp;gt;
#include &amp;lt;sys/printk.h&amp;gt;
#include &amp;lt;hal/nrf_gpio.h&amp;gt;
#include &amp;lt;zephyr/kernel.h&amp;gt;


#define Data 02

K_TIMER_DEFINE(my_timer, NULL, NULL);

int main(void)
{
    /* Configure board. */
 nrf_gpio_cfg_output(Data);

	  while (1)
	 {
	 		nrf_gpio_pin_set(Data);
			k_timer_start(&amp;amp;my_timer, K_USEC(1),K_NO_WAIT);
			nrf_gpio_pin_clear(Data);
			k_timer_start(&amp;amp;my_timer, K_USEC(1),K_NO_WAIT);
	  }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>