<?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>hardware timer in nrf connect sdk</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89129/hardware-timer-in-nrf-connect-sdk</link><description>Hi, can anyone tell me how to configure hardware timers in nrf connect sdk. using nrfx_timer driver? not the kernel timers.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 30 Aug 2022 10:34:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89129/hardware-timer-in-nrf-connect-sdk" /><item><title>RE: hardware timer in nrf connect sdk</title><link>https://devzone.nordicsemi.com/thread/383863?ContentTypeID=1</link><pubDate>Tue, 30 Aug 2022 10:34:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7992414f-fded-4880-a39e-0bbe342480c1</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Could you open a new DevZone ticket about this issue?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: hardware timer in nrf connect sdk</title><link>https://devzone.nordicsemi.com/thread/383852?ContentTypeID=1</link><pubDate>Tue, 30 Aug 2022 10:00:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e55ed02f-df35-4690-84c4-7f3f5a1990e0</guid><dc:creator>noob_123</dc:creator><description>&lt;p&gt;Yes I am now using&amp;nbsp;&lt;span&gt;CONFIG_COUNTER=y and&amp;nbsp;CONFIG_COUNTER_TIMER2=y&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As I am also using BLE in this application the problem is now UART is not working, means I can&amp;#39;t see anything on nrf Terminal that I print using printk or printf.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: hardware timer in nrf connect sdk</title><link>https://devzone.nordicsemi.com/thread/383849?ContentTypeID=1</link><pubDate>Tue, 30 Aug 2022 09:54:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d11aa2af-50f8-4a79-ab6f-8e32e6d079fe</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Can you try to set CONFIG_COUNTER_TIMERx=y (where x is 1,2,3 or 4) instead. If you look in&amp;nbsp;/ncs/zephyr/drivers/counter/Kconfig.nrfx you can see that these Kconfig options will enable&amp;nbsp;&lt;span&gt;COUNTER_NRF_TIMER.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: hardware timer in nrf connect sdk</title><link>https://devzone.nordicsemi.com/thread/383727?ContentTypeID=1</link><pubDate>Mon, 29 Aug 2022 14:34:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecd42e6c-954d-4500-8bce-e4dbca87c028</guid><dc:creator>noob_123</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If I set&amp;nbsp;&lt;span&gt;CONFIG_COUNTER_NRF_TIMER=y&amp;nbsp;in prj.conf of this sample it gives following error&lt;br /&gt;&lt;br /&gt;error: COUNTER_NRF_TIMER (defined at drivers/counter/Kconfig.nrfx:4) is assigned in a configuration&lt;br /&gt;file, but is not directly user-configurable (has no prompt). It gets its value indirectly from other&lt;br /&gt;symbols.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: hardware timer in nrf connect sdk</title><link>https://devzone.nordicsemi.com/thread/373548?ContentTypeID=1</link><pubDate>Tue, 21 Jun 2022 22:48:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6c0a5df-7f46-47c5-8732-308979346814</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I would highly recommend you to use the Zephyr API (which actually uses the nrfx API under the hood), as it is much less complicated and easier to implement.&lt;/p&gt;
&lt;p&gt;Take a look at the &lt;a href="https://github.com/nrfconnect/sdk-zephyr/tree/v3.0.99-ncs1/samples/drivers/counter/alarm"&gt;Counter Alarm sample&lt;/a&gt;&amp;nbsp;and set&amp;nbsp;&lt;span&gt;CONFIG_COUNTER_NRF_TIMER=y in the prj.conf.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please let me know if this sample is not sufficient for you.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: hardware timer in nrf connect sdk</title><link>https://devzone.nordicsemi.com/thread/373275?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2022 13:52:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c15c705c-95f8-4f25-aa6d-9e4ffd1d5427</guid><dc:creator>shiva74638</dc:creator><description>&lt;p&gt;I implemented this code in the blinky with the example you mentioned using NRFX API&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;const nrfx_timer_t timer_led = NRFX_TIMER_INSTANCE(0);

static void wait_timer_handler(nrf_timer_event_t event_type, void *context)
{
	printk(&amp;quot;timer expired&amp;quot;);
}

static int timer_init(void)
{
	nrfx_err_t err;
	nrfx_timer_config_t timer_cfg = {
		.frequency = NRF_TIMER_FREQ_1MHz,
		.mode = NRF_TIMER_MODE_TIMER,
		.bit_width = NRF_TIMER_BIT_WIDTH_16,
	};

	err = nrfx_timer_init(&amp;amp;timer_led, &amp;amp;timer_cfg, wait_timer_handler);
	if (err != NRFX_SUCCESS) {
		printk(&amp;quot;nrfx_timer_init failed with: %d\n&amp;quot;, err);
		return -EAGAIN;
	}
	
	IRQ_CONNECT(TIMER1_IRQn, 3,
		    nrfx_timer_1_irq_handler, NULL, 0);

	nrfx_timer_compare(&amp;amp;timer_led,
		NRF_TIMER_CC_CHANNEL0,
		nrfx_timer_ms_to_ticks(&amp;amp;timer_led, 1000000),
		true);

	nrfx_timer_enable(&amp;amp;timer_led);
	
	return 0;
}


void main(void)
{
	int err;
	
	err = timer_init();
	if (err) {
		return;
		printk(&amp;quot;timer init failed\n&amp;quot;);
	}
	
	printk(&amp;quot;timer initialized\n&amp;quot;);
	for(;;)
	{
		k_msleep(1000);
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;added all the config options too, as in dtm example and flashed it to the nrf52840 dk board. it just keeps resetting like this&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1655733044395v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: hardware timer in nrf connect sdk</title><link>https://devzone.nordicsemi.com/thread/373207?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2022 11:43:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae90f3af-348e-448c-bb6f-eab1351da251</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;There are different ways to use the TIMER peripheral in the nRF Connect SDK:&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;Using the Zephyr API&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Take a look at the counter Alarm Sample and set CONFIG_COUNTER_NRF_TIMER=y. It will make the counter driver&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.99-ncs1/drivers/counter/CMakeLists.txt#L10"&gt;use Timer peripheral&lt;/a&gt; &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.0.99-ncs1/drivers/counter/counter_nrfx_timer.c#L7"&gt;through the NRF HAL&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;Using the NRFX API&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Take a look at the Direct Test Mode sample, which &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.0.0/samples/bluetooth/direct_test_mode/src/dtm.c#L24"&gt;uses the Timer peripheral through the nrfx api&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>