<?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>Timers in nRF9160 SOC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59950/timers-in-nrf9160-soc</link><description>Hi, 
 
 Could you please help me how to configure Timer-0/1/2 in timer mode with periodic interval. 
 With regards, 
 Praveen P</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Apr 2020 09:06:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59950/timers-in-nrf9160-soc" /><item><title>RE: Timers in nRF9160 SOC</title><link>https://devzone.nordicsemi.com/thread/246427?ContentTypeID=1</link><pubDate>Fri, 24 Apr 2020 09:06:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d18f9a31-5c92-4d3b-ad62-be7af52568c7</guid><dc:creator>Didrik Rokhaug</dc:creator><description>[quote user="hng"]16bits counter can count to 65535 x32us =&amp;nbsp;2,09712‬ s, is it correct?[/quote]
&lt;p&gt;&amp;nbsp;Yes, that is correct.&lt;/p&gt;
&lt;p&gt;cc_value is the number of ticks you count up to. You can get this value by multiplying the TIMEOUT with the frequency (assuming you are working with s and Hz as units, if not apply correct scaling).&lt;/p&gt;
&lt;p&gt;You can find the calculations done in nrfx_timer_ms_to_ticks here: &lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/blob/master/nrfx/hal/nrf_timer.h#L715"&gt;https://github.com/zephyrproject-rtos/hal_nordic/blob/master/nrfx/hal/nrf_timer.h#L715&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers in nRF9160 SOC</title><link>https://devzone.nordicsemi.com/thread/246352?ContentTypeID=1</link><pubDate>Thu, 23 Apr 2020 20:26:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06a9cc03-ff75-4b1e-8035-e1361ce4f6e6</guid><dc:creator>Hoang</dc:creator><description>&lt;p&gt;Dear &lt;a href="https://devzone.nordicsemi.com/members/didrik-rokhaug"&gt;Didrik Rokhaug&lt;/a&gt;,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;the counter 16bits, xFFFF = 65 535 max value and with the&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;my_timer_config.frequency = NRF_TIMER_FREQ_31250Hz;&lt;/p&gt;
&lt;p&gt;--&amp;gt; T = 32us&amp;nbsp;&lt;/p&gt;
&lt;p&gt;16bits counter can count to 65535 x32us =&amp;nbsp;2,09712‬ s, is it correct?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I checked on the document:&amp;nbsp;&lt;/p&gt;
&lt;table class="memname"&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="memname" colspan="1" rowspan="1"&gt;void nrfx_timer_compare&lt;/td&gt;
&lt;td colspan="1" rowspan="1"&gt;(&lt;/td&gt;
&lt;td class="paramtype" colspan="1" rowspan="1"&gt;&lt;a class="el" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/structnrfx__timer__t.html"&gt;nrfx_timer_t&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;const *const&amp;nbsp;&lt;/td&gt;
&lt;td class="paramname" colspan="1" rowspan="1"&gt;&lt;em&gt;p_instance&lt;/em&gt;,&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="paramkey" colspan="1" rowspan="1"&gt;&lt;/td&gt;
&lt;td colspan="1" rowspan="1"&gt;&lt;/td&gt;
&lt;td class="paramtype" colspan="1" rowspan="1"&gt;&lt;a class="el" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrf__timer__hal.html#ga21336e3aff87c90e95f08eff763d91a8"&gt;nrf_timer_cc_channel_t&lt;/a&gt;&amp;nbsp;&lt;/td&gt;
&lt;td class="paramname" colspan="1" rowspan="1"&gt;&lt;em&gt;cc_channel&lt;/em&gt;,&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="paramkey" colspan="1" rowspan="1"&gt;&lt;/td&gt;
&lt;td colspan="1" rowspan="1"&gt;&lt;/td&gt;
&lt;td class="paramtype" colspan="1" rowspan="1"&gt;uint32_t&amp;nbsp;&lt;/td&gt;
&lt;td class="paramname" colspan="1" rowspan="1"&gt;&lt;em&gt;cc_value&lt;/em&gt;,&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="paramkey" colspan="1" rowspan="1"&gt;&lt;/td&gt;
&lt;td colspan="1" rowspan="1"&gt;&lt;/td&gt;
&lt;td class="paramtype" colspan="1" rowspan="1"&gt;bool&amp;nbsp;&lt;/td&gt;
&lt;td class="paramname" colspan="1" rowspan="1"&gt;&lt;em&gt;enable_int&lt;/em&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan="1" rowspan="1"&gt;&lt;/td&gt;
&lt;td colspan="1" rowspan="1"&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;cc_value is the ticks/ms, is it right ? how can we calculate this value from the TIMEOUT (as&amp;nbsp;nrfx_timer_ms_to_ticks(&amp;amp;my_timer, TIMEOUT);)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks so much&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hoang Nguyen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers in nRF9160 SOC</title><link>https://devzone.nordicsemi.com/thread/246288?ContentTypeID=1</link><pubDate>Thu, 23 Apr 2020 13:43:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbf79afb-0570-46fe-a0b2-72fb2647e3b9</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/hng"&gt;Hoang&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The counter only has 16 bits, so it is not able to count up to 300000 * ticks/ms.&lt;/p&gt;
&lt;p&gt;However, I am not sure if I would use a timer for that in the first place. Instead, I would take a look delayed work items: &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.2.0/zephyr/reference/kernel/threads/workqueue.html#delayed-work"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.2.0/zephyr/reference/kernel/threads/workqueue.html#delayed-work&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers in nRF9160 SOC</title><link>https://devzone.nordicsemi.com/thread/246234?ContentTypeID=1</link><pubDate>Thu, 23 Apr 2020 11:35:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0410954f-a7ed-4bb7-a010-de473d7bdfa2</guid><dc:creator>Hoang</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/didrik-rokhaug"&gt;Didrik Rokhaug&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;How can I create a timer, with the timeout is 5mn, after 5mn, it will enable GPS - THINGY:91?&lt;/p&gt;
&lt;p&gt;In your code, I changed the TIMEOUT = 300000 // 5mn, but the interrupt always happened every second.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hoang&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers in nRF9160 SOC</title><link>https://devzone.nordicsemi.com/thread/244070?ContentTypeID=1</link><pubDate>Wed, 08 Apr 2020 11:45:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0c65048-6615-447b-b00a-3d9074584564</guid><dc:creator>praveenpalaparthi</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;/p&gt;
&lt;p&gt;Thank you for sharing me sample code.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;regards,&lt;/p&gt;
&lt;p&gt;Praveen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers in nRF9160 SOC</title><link>https://devzone.nordicsemi.com/thread/244049?ContentTypeID=1</link><pubDate>Wed, 08 Apr 2020 10:57:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:176ed8ec-af7b-4523-be15-7656d6ebb759</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;First, you might also want to take a look at Zephyr&amp;#39;s timer API, even though these are software timers: &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/timing/timers.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/timing/timers.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Other than that, I do not know about any other Zephyr API that access to timers. However, you can still use the nrfx drivers from the nRF5 SDK.&lt;/p&gt;
&lt;p&gt;You can find the available API in &amp;lt;NCS&amp;gt;/modules/hal/nordic/nrfx/drivers/include/nrfx_timer.h.&lt;/p&gt;
&lt;p&gt;Attached is a quick sample application that sets up an interrupt to happen every second.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-f2146bfc2fa54252a61acc139b68203c/timer.zip"&gt;devzone.nordicsemi.com/.../timer.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>