<?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>GetTick ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71076/gettick</link><description>Dear Members, 
 
 How can I GetTick from the CPU? similar to HAL_GetTick() ? 
 
 nrf_drv_systick_get ? 
 
 Thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Feb 2021 08:49:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71076/gettick" /><item><title>RE: GetTick ?</title><link>https://devzone.nordicsemi.com/thread/292137?ContentTypeID=1</link><pubDate>Mon, 01 Feb 2021 08:49:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aed16743-00f9-433b-ba6c-3adbf58f2be1</guid><dc:creator>Edvin</dc:creator><description>[quote user="RixtronixLAB"]&lt;p&gt;I want to get :&lt;/p&gt;
&lt;p&gt;LastTime=HAL_GetTick();&lt;/p&gt;[/quote]
&lt;p&gt;&amp;nbsp;Where is this snippet from?&amp;nbsp; Where did you find this function?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="RixtronixLAB"]I always get zero, do I miss something ?[/quote]
&lt;p&gt;&amp;nbsp;Yes. You need to start the RTC and the LFCLK. Please see my original answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GetTick ?</title><link>https://devzone.nordicsemi.com/thread/292015?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2021 14:18:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f820eb0-8538-4156-9368-63a8dd9a85fa</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;or , how to use this function ? &amp;nbsp;nrf_drv_systick_get() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;nrfx_systick_get(nrfx_systick_state_t * p_state) , what&amp;#39;s nrfx_systick_state_t * p_state&amp;nbsp; ?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GetTick ?</title><link>https://devzone.nordicsemi.com/thread/292010?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2021 13:49:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac53b4dc-8330-4ebf-b895-231bcda490ee</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;Hi Edvin, thanks for the reply,&lt;/p&gt;
&lt;p&gt;I want to get :&lt;/p&gt;
&lt;p&gt;LastTime=HAL_GetTick();&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
  * @brief Provides a tick value in millisecond.
  * @note This function is declared as __weak to be overwritten in case of other 
  *       implementations in user file.
  * @retval tick value
  */
__weak uint32_t HAL_GetTick(void)
{
  return uwTick;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;is it equal with LastTime = &amp;nbsp;nrf_systick_val_get();&lt;/p&gt;
&lt;p&gt;I need to be in ms (mili Second)&lt;/p&gt;
&lt;p&gt;?&lt;/p&gt;
&lt;p&gt;Test code,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;tick =  nrf_systick_val_get();
NRF_LOG_INFO(&amp;quot;Systick value = %u.\r\n&amp;quot;,tick);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I always get zero, do I miss something ?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GetTick ?</title><link>https://devzone.nordicsemi.com/thread/292007?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2021 13:36:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30b9dc67-9071-4f34-96a0-40c931bfde13</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;That is not that trivial. What do you intend to use this for? Do you want to measure something in ms? If so, what you need to do is to start either a timer or an rtc.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to create a timer with a timeout, then you can use e.g. the app_timer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What sort of resolution do you need? minutes? seconds? ms? µs?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I recommend that you check out the app_timer, which is used e.g. in the example ble_app_hrs.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Look at how&amp;nbsp;battery_level_meas_timeout_handler() which is a timeout handler is set up to time out every 2 seconds.&lt;/p&gt;
&lt;p&gt;If you set up and start the app_timer, you can also use the function&amp;nbsp;app_timer_cnt_get() to get the tick number for the RTC (in fact, it uses the function&amp;nbsp;drv_rtc_counter_get(), which you mentioned). But please note that the amount of time that these ticks represents depends on how the RTC is set up (frequency and prescaler)&lt;/p&gt;
&lt;p&gt;Also, this function app_timer_cnt_diff_compute() or drv_rtc_counter_get() only works if the RTC (and app_timer in the app_timer case) is initialized and started.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>