<?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 in microsecond on nRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/37896/timer-in-microsecond-on-nrf52840</link><description>hello , i&amp;#39;am working actually on the timer of nRF52840 S140 
 my timer look like this: 
 
 but how to switch from millisecond resolution to microsecond resolution ? ( APP_TIMER_TICKS) 
 thank&amp;#39;s</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 Aug 2018 12:35:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/37896/timer-in-microsecond-on-nrf52840" /><item><title>RE: timer in microsecond on nRF52840</title><link>https://devzone.nordicsemi.com/thread/146110?ContentTypeID=1</link><pubDate>Tue, 28 Aug 2018 12:35:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:395da57f-fc13-4f2a-a9db-a5227d0e8839</guid><dc:creator>lmouelo</dc:creator><description>&lt;p&gt;ok i have understood&amp;nbsp;&lt;/p&gt;
&lt;p&gt;thank&amp;#39;s&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: timer in microsecond on nRF52840</title><link>https://devzone.nordicsemi.com/thread/146102?ContentTypeID=1</link><pubDate>Tue, 28 Aug 2018 12:18:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05621a28-efaf-42c9-ac59-341ba0f4502f</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I told you the resolution is 30 µs. You try to calculate ticks for 1 µs. Of course that will not work. App_timer have a minimum tick configuration of 5:&amp;nbsp;&lt;a title="APP_TIMER_MIN_TIMEOUT_TICKS" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/group__app__timer.html?cp=4_0_1_6_11_54_8#ga30c7af1b67835f8031ccc934af7d1af7"&gt;APP_TIMER_MIN_TIMEOUT_TICKS&lt;/a&gt;, which means you cannot get a timeout of less than ~150 µs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: timer in microsecond on nRF52840</title><link>https://devzone.nordicsemi.com/thread/146099?ContentTypeID=1</link><pubDate>Tue, 28 Aug 2018 12:12:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d948e83e-89dd-475c-86c5-c34d8f968aff</guid><dc:creator>lmouelo</dc:creator><description>&lt;p&gt;i have defined the MACRO on app_timer.h like this&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#ifndef FREERTOS
#define APP_TIMER_TICKS(MS)                                \
            ((uint32_t)ROUNDED_DIV(                        \
            (MS) * (uint64_t)APP_TIMER_CLOCK_FREQ,         \
            1000 * (APP_TIMER_CONFIG_RTC_FREQUENCY + 1)))

#define APP_TIMER_TICKS_US(US)                                \
            ((uint32_t)ROUNDED_DIV(                        \
            (US) * (uint64_t)APP_TIMER_CLOCK_FREQ,         \
            1000000 * (APP_TIMER_CONFIG_RTC_FREQUENCY + 1)))
#else
#include &amp;quot;FreeRTOSConfig.h&amp;quot;
#define APP_TIMER_TICKS(MS) (uint32_t)ROUNDED_DIV((MS)*configTICK_RATE_HZ,1000)
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and on my main :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define COMPTEUR_INTERVAL     APP_TIMER_TICKS_US(1)                   /**&amp;lt; Tick / Us */void test(){
	
	ret_code_t err_code;
	//Create timers
	err_code = app_timer_create(&amp;amp;timer_id,APP_TIMER_MODE_REPEATED,timer_sd_handler);
	lfclk_request();
	APP_ERROR_CHECK(err_code);
	NRF_LOG_INFO(&amp;quot;Timer_sd_start&amp;quot;);
	err_code = app_timer_start(timer_id, COMPTEUR_INTERVAL, NULL);
	NRF_LOG_INFO(&amp;quot;%d&amp;quot;,err_code);
	APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;but i have a fatal error when i define like this :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-&amp;gt;&amp;nbsp;#define COMPTEUR_INTERVAL&amp;nbsp; &amp;nbsp; &amp;nbsp;APP_TIMER_TICKS_US(1)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/**&amp;lt; Tick / Us */&amp;nbsp;&lt;/p&gt;
&lt;p&gt;but no fatal error with this&amp;nbsp; :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-&amp;gt;&amp;nbsp;#define COMPTEUR_INTERVAL&amp;nbsp; &amp;nbsp; &amp;nbsp;APP_TIMER_TICKS_US(1000)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/**&amp;lt; Tick / Us */&lt;/p&gt;
&lt;p&gt;i don&amp;#39;t know why&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: timer in microsecond on nRF52840</title><link>https://devzone.nordicsemi.com/thread/146092?ContentTypeID=1</link><pubDate>Tue, 28 Aug 2018 11:40:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00e219ba-520b-4cb2-a3cd-14dc0de08f07</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You are not required to use the MACRO defined in the app_timer library. You can calculate the ticks value yourself, or create your own MACRO to calculate ticks from microseconds:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define APP_TIMER_TICKS_US(US)                                \
            ((uint32_t)ROUNDED_DIV(                        \
            (US) * (uint64_t)APP_TIMER_CLOCK_FREQ,         \
            1000000 * (APP_TIMER_CONFIG_RTC_FREQUENCY + 1)))&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: timer in microsecond on nRF52840</title><link>https://devzone.nordicsemi.com/thread/146077?ContentTypeID=1</link><pubDate>Tue, 28 Aug 2018 10:24:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94aaad9c-45b9-4007-83ee-e4b773da9c2d</guid><dc:creator>lmouelo</dc:creator><description>&lt;p&gt;30 us is enough for me,&amp;nbsp;&lt;strong&gt;same 1 us&amp;nbsp;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;what I want : &lt;/p&gt;
&lt;p&gt;-&amp;gt; make a break every 62.5ms, how to do this.? (when my compteur equal( 62.5ms) but to do this i will to replace this&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;-&amp;gt; #define COMPTEUR_INTERVAL&amp;nbsp; &amp;nbsp; &amp;nbsp;APP_TIMER_TICKS(1)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/**&amp;lt; Tick / &lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;Ms&lt;/strong&gt;&lt;/span&gt; */&lt;/p&gt;
&lt;p&gt;by&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;#define COMPTEUR_INTERVAL&amp;nbsp; &amp;nbsp; &amp;nbsp;APP_TIMER_TICKS(1)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;em&gt;&amp;nbsp; &amp;nbsp;/**&amp;lt; Tick / &lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;Us&lt;/span&gt; */&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;em&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I want my counter (&amp;quot;&lt;em&gt;compteur&amp;quot;&lt;/em&gt;)&amp;nbsp; to increment every microsecond&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: timer in microsecond on nRF52840</title><link>https://devzone.nordicsemi.com/thread/146068?ContentTypeID=1</link><pubDate>Tue, 28 Aug 2018 09:30:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f12db91d-adbb-488e-8f54-9d7039522d2d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The application timer library runs using the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52840.ps/rtc.html?cp=2_0_0_5_21"&gt;RTC peripheral&lt;/a&gt;, which again use the LFCLK as the clock source. This will give you a maximum frequency of 32.768 kHz, or a resolution of ~30 µs. If you want better resolution, you need to use the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52840.ps/timer.html?cp=2_0_0_5_29"&gt;TIMER peripheral&lt;/a&gt;. There is a &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.1.0/hardware_driver_timer.html?cp=4_0_0_2_0_16"&gt;driver&lt;/a&gt; and an &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.1.0/nrf_dev_timer_example.html"&gt;example&lt;/a&gt; available in the SDK. Please have a look at &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/12731/clocks-timers-rtc-why/48338#48338"&gt;this thread&lt;/a&gt; for more details.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>