<?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 create a timer ms on nRF Connect SDK ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82919/how-to-create-a-timer-ms-on-nrf-connect-sdk</link><description>Hi, 
 as follow is nRF5 SDK code to create a timer ms. 
 how to create a timer ms on nRF Connect SDK ? 
 
 APP_TIMER_DEF(m_timer_speed_1ms); int timer_lms=0; 
 static void timer_1ms_handler(void * p_context) { timer_lms++; 
 } 
 void main（） 
 { 
 ret_code_t</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 22 Dec 2021 07:44:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82919/how-to-create-a-timer-ms-on-nrf-connect-sdk" /><item><title>RE: how to create a timer ms on nRF Connect SDK ?</title><link>https://devzone.nordicsemi.com/thread/344728?ContentTypeID=1</link><pubDate>Wed, 22 Dec 2021 07:44:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7680961f-62ba-4ae8-8f60-bc469a22427b</guid><dc:creator>yoyou</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 create a timer ms on nRF Connect SDK ?</title><link>https://devzone.nordicsemi.com/thread/344607?ContentTypeID=1</link><pubDate>Tue, 21 Dec 2021 13:22:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0951ea72-2da1-4aa1-90a7-cf4b8ae69a77</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Oh, sorry. I didn&amp;#39;t catch that you were doing this in NCS.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The app_timer is not present in the nRF Connect SDK (NCS). You can look into the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/zephyr/reference/kernel/timing/timers.html"&gt;k_timer documentation&lt;/a&gt;&amp;nbsp;which in many ways is the equivalent of app_timer in NCS.&lt;/p&gt;
&lt;p&gt;I can recommend&amp;nbsp;the section &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/zephyr/reference/kernel/timing/timers.html#using-a-timer-expiry-function"&gt;Using a Timer Expiry Function&lt;/a&gt;, as this also shows you how to implement the k_work. It may not be needed in your case, but if you have some interrupt dependent work you need to do in your app_timer, you can use this.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on your snippet above, you shouldn&amp;#39;t need the k_work, but you can increment the ms_timer directly in your &amp;quot;my_timer_handler()&amp;quot; interrupt.&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><item><title>RE: how to create a timer ms on nRF Connect SDK ?</title><link>https://devzone.nordicsemi.com/thread/344458?ContentTypeID=1</link><pubDate>Tue, 21 Dec 2021 01:02:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5778353c-6db0-4435-a5b1-effd75cf18df</guid><dc:creator>yoyou</dc:creator><description>&lt;p&gt;&lt;span style="font-size:150%;"&gt;Hello, Edvin,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;thanks for reply.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;These codes work well on nRF SDK17.02,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;but i&amp;#39;m using&amp;nbsp;&lt;strong&gt;&lt;span style="color:#000080;"&gt;nRF Connect SDK 1.8.0.&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#ff0000;font-size:150%;"&gt;build error:&amp;nbsp; app_timer.h: No such file or directory&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;strong&gt;is it need cross use nRF SDK17?&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;strong&gt;what does the text in the red box mean？&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;strong&gt;what shall I do?&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;strong&gt;thanks&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1640047872319v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to create a timer ms on nRF Connect SDK ?</title><link>https://devzone.nordicsemi.com/thread/344363?ContentTypeID=1</link><pubDate>Mon, 20 Dec 2021 13:00:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70c4255-9dc8-4bca-a0dc-ce2c67971779</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;It looks like you are on the right track. Does it work? If not, what does app_timer_create() and app_timer_start return?&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>