<?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>Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76568/can-i-use-two-rtc-in-nrf5340</link><description>Hello, 
 
 In nRF5340 I use one RTC and it works. Here is my code: 
 1) in prj.conf: 
 CONFIG_NRFX_RTC=y CONFIG_NRFX_RTC0=y 
 2) in the code: 
 a) define: nrfx_rtc_t sti_period_rtc_0 = NRFX_RTC_INSTANCE(0); 
 b): 
 IRQ_CONNECT(DT_IRQN(DT_NODELABEL(rtc0</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 19 Mar 2025 16:18:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76568/can-i-use-two-rtc-in-nrf5340" /><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/528061?ContentTypeID=1</link><pubDate>Wed, 19 Mar 2025 16:18:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baa92c53-7e03-44ab-86ad-b6cad47e4c8d</guid><dc:creator>AP</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/carl-sun"&gt;Carl Sun&lt;/a&gt;&amp;nbsp; &lt;a href="https://devzone.nordicsemi.com/members/sigurdon"&gt;Sigurd&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;I am facing similar issue here, not able to use RTC, i tried all you suggestions and attached same code as well, getting below error-&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000080;"&gt;&lt;em&gt;error: NRFX_RTC (defined at C:/ncs/v2.9.0/zephyr/modules/hal_nordic\nrfx/Kconfig:443,&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&lt;em&gt;modules\hal_nordic\nrfx/Kconfig:443) is assigned in a configuration file, but is not directly user-&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&lt;em&gt;configurable (has no prompt). It gets its value indirectly from other symbols. See&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&lt;em&gt;&lt;a href="http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NRFX_RTC"&gt;docs.zephyrproject.org/.../kconfig.html&lt;/a&gt; and/or look up NRFX_RTC in the&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&lt;em&gt;menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&lt;em&gt;and Kconfig - Tips and Best Practices sections of the manual might be helpful too.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;Please support!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;Thank you!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/317600?ContentTypeID=1</link><pubDate>Tue, 29 Jun 2021 06:58:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de702786-ef22-453a-a63d-fa8ebf8d968b</guid><dc:creator>Carl Sun</dc:creator><description>&lt;p&gt;Thanks a lot for your help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This case can be closed.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Carl&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/317572?ContentTypeID=1</link><pubDate>Mon, 28 Jun 2021 21:15:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4333a1df-467a-478a-9703-13767780dc5b</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Carl Sun"]&lt;p&gt;Do you have some code example on how to use one RTC with two or several compare channels?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;&amp;nbsp;Here is an simple example:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrfx_5F00_rtc.zip"&gt;devzone.nordicsemi.com/.../nrfx_5F00_rtc.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/317217?ContentTypeID=1</link><pubDate>Fri, 25 Jun 2021 11:39:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:202fbaf1-01ad-43fd-92f0-d4054e8a3b12</guid><dc:creator>Carl Sun</dc:creator><description>&lt;p&gt;Does that mean: if the content of the &lt;span&gt;CC Compare register is different, then the duration(period) is different?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/317213?ContentTypeID=1</link><pubDate>Fri, 25 Jun 2021 11:29:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09537446-16d5-4a8f-898a-063f6c15d59a</guid><dc:creator>Carl Sun</dc:creator><description>&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do you have some code example on how to use one RTC with two or several compare channels?&lt;/p&gt;
&lt;p&gt;enable, disable, start, stop, update, or event handler of the channels.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Carl.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/317169?ContentTypeID=1</link><pubDate>Fri, 25 Jun 2021 09:41:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:863a2716-3522-4fe9-beab-3fae516596d1</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, you have 4 CC Compare register,&amp;nbsp;CC[n] (n=0..3), so you can get 4 different events, EVENTS_COMPARE[n] (n=0..3) , based on what CC register you are using.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/317125?ContentTypeID=1</link><pubDate>Fri, 25 Jun 2021 07:31:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7370b1b-889e-472c-b767-ae24664129a9</guid><dc:creator>Carl Sun</dc:creator><description>&lt;p&gt;Hi, understood, Thanks for your help.&lt;/p&gt;
&lt;p&gt;In this one RTC, do we have two channels? Can I use two channels?&lt;/p&gt;
&lt;p&gt;If yes, can the two channels have two different period( generate two enents)?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/316402?ContentTypeID=1</link><pubDate>Tue, 22 Jun 2021 08:08:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ba6c136-8d10-4b44-af5c-12d5aa4af3c8</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;You are getting this error because RTC1 is reserved and used by the Zephyr RTOS kernel&amp;nbsp;timer:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.0-ncs1-rc3/drivers/timer/Kconfig#L158"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.0-ncs1-rc3/drivers/timer/Kconfig#L158&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I would recommend looking into using the Zephyr RTOS kernel timer for implementing application timers:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.zephyrproject.org/latest/reference/kernel/timing/timers.html"&gt;https://docs.zephyrproject.org/latest/reference/kernel/timing/timers.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/316369?ContentTypeID=1</link><pubDate>Tue, 22 Jun 2021 03:13:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a4ecbc6-785a-42b5-a702-b40a5f5332a7</guid><dc:creator>Carl Sun</dc:creator><description>&lt;p&gt;By the way, I already used 3 timers and 1 GPIO as below:&lt;/p&gt;
&lt;p&gt;IRQ_CONNECT(DT_IRQN(DT_NODELABEL(timer0)),&lt;br /&gt; DT_IRQ(DT_NODELABEL(timer0), priority),&lt;br /&gt; nrfx_isr, nrfx_timer_0_irq_handler, 0);&lt;/p&gt;
&lt;p&gt;IRQ_CONNECT(DT_IRQN(DT_NODELABEL(timer1)),&lt;br /&gt; DT_IRQ(DT_NODELABEL(timer1), priority),&lt;br /&gt; nrfx_isr, nrfx_timer_1_irq_handler, 0);&lt;/p&gt;
&lt;p&gt;IRQ_CONNECT(DT_IRQN(DT_NODELABEL(timer2)),&lt;br /&gt; DT_IRQ(DT_NODELABEL(timer2), priority),&lt;br /&gt; nrfx_isr, nrfx_timer_2_irq_handler, 0);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;IRQ_CONNECT(DT_IRQN(DT_NODELABEL(gpiote)),&lt;br /&gt; DT_IRQ(DT_NODELABEL(gpiote), priority),&lt;br /&gt; nrfx_isr, nrfx_gpiote_irq_handler, 0);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is this the reason why I got those errors when I tried to register the second RTC?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Carl..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/316368?ContentTypeID=1</link><pubDate>Tue, 22 Jun 2021 02:56:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07bf5dc6-2b5b-45ac-ba0e-5adfc7000a2f</guid><dc:creator>Carl Sun</dc:creator><description>&lt;p&gt;Hi, I tried your code and got the same error as before.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/316251?ContentTypeID=1</link><pubDate>Mon, 21 Jun 2021 11:35:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e59b5bc6-2c12-4442-a304-68cbaa3f5754</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Maybe you can try this instead, snippet:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;	
	IRQ_CONNECT(RTC0_IRQn, NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY,
		nrfx_rtc_0_irq_handler, NULL, 0);

			IRQ_CONNECT(RTC1_IRQn, NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY,
		nrfx_rtc_1_irq_handler, NULL, 0);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(If this does not work either, then please upload your project.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I use two RTC in nRF5340?</title><link>https://devzone.nordicsemi.com/thread/316234?ContentTypeID=1</link><pubDate>Mon, 21 Jun 2021 10:58:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d74fb650-9a11-4bd0-98f5-f2e4ee9915a7</guid><dc:creator>Carl Sun</dc:creator><description>&lt;p&gt;Modified:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I run Project-&amp;gt;run CMake in SEGGER EMbedded studio&lt;/span&gt;&lt;br /&gt;&lt;span&gt;and rebuild the solution, then I got this error:&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>