<?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>nrf5340 Low Frequency Timer (RTC)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93306/nrf5340-low-frequency-timer-rtc</link><description>Hi, 
 
 Is there a known issue with the startup of the LF clock on the nrf5340 app core? I have scanned the nrf5340 errata but do not see anything of note. 
 I have this code snippet in the Bluetooth stack from our stack vendor: 
 
 With the above code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Nov 2022 11:37:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93306/nrf5340-low-frequency-timer-rtc" /><item><title>RE: nrf5340 Low Frequency Timer (RTC)</title><link>https://devzone.nordicsemi.com/thread/394655?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 11:37:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dffe35ec-d7b8-43ae-b3ce-8733d39e4dba</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see any issues with the code snippet.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Maybe you can try to update the nrfx version that&amp;nbsp;you are using.&lt;/p&gt;
&lt;p&gt;Also maybe debug, set a breakpoint before/after nrfx_clock_lfclk_start(), and check that the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/clock/doc/clock.html#unique_951155164"&gt;CLOCK registers&lt;/a&gt;&amp;nbsp;are as you expect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Low Frequency Timer (RTC)</title><link>https://devzone.nordicsemi.com/thread/394121?ContentTypeID=1</link><pubDate>Fri, 04 Nov 2022 10:58:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6447f38-1420-4b5b-a676-98a3e438c4c7</guid><dc:creator>skajam66</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;Here is my code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;  NRF_P0-&amp;gt;PIN_CNF[0] = GPIO_PIN_CNF_MCUSEL_Peripheral &amp;lt;&amp;lt; GPIO_PIN_CNF_MCUSEL_Pos;
  NRF_P0-&amp;gt;PIN_CNF[1] = GPIO_PIN_CNF_MCUSEL_Peripheral &amp;lt;&amp;lt; GPIO_PIN_CNF_MCUSEL_Pos;

  err = nrfx_clock_init(palSysWakeupClockEvent);
  PAL_SYS_ASSERT(err == NRFX_SUCCESS);
  nrfx_clock_enable();

  /* Use 128 MHz clock. */
  //err = nrfx_clock_divider_set(NRF_CLOCK_DOMAIN_HFCLK, NRF_CLOCK_HFCLK_DIV_1);
  //PAL_SYS_ASSERT(err == NRFX_SUCCESS);
  // FIXME: Replace following with nrfx_clock_divider_set()
  NRF_CLOCK-&amp;gt;HFCLKCTRL = CLOCK_HFCLKCTRL_HCLK_Div1;
  nrfx_clock_hfclk_start();
  while (!nrfx_clock_hfclk_is_running());

  /* FIXME workaround for LF OSC startup. */
  // Amp modified (AC) - set source to external crystal
//  nrf_clock_lf_src_set(NRF_CLOCK, NRF_CLOCK_LFCLK_Synth);
  nrf_clock_lf_src_set(NRF_CLOCK, NRF_CLOCK_LFCLK_Xtal);
  nrfx_clock_lfclk_start();
  while (!nrfx_clock_lfclk_is_running());
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is a custom board but take note that the vendor uses the PCA10095 as their hardware platform so the notation about the workaround is relating to the PCA10095 board.&lt;/p&gt;
&lt;p&gt;As mentioned previously, the code blocks on&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;b&gt;while&lt;/b&gt;&lt;/span&gt; (!nrfx_clock_lfclk_is_running());&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span style="text-decoration:underline;"&gt;when using either the synth or external source for the LF oscillator.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When using the external crystal as the clock source, it is using external capacitors:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot-2022_2D00_11_2D00_04-at-10.55.26.png" /&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;AC&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Low Frequency Timer (RTC)</title><link>https://devzone.nordicsemi.com/thread/393173?ContentTypeID=1</link><pubDate>Mon, 31 Oct 2022 09:21:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ae45240-7e1c-42ec-bc7c-630bd5f65adc</guid><dc:creator>Sigurd</dc:creator><description>[quote user=""]Is there a known issue with the startup of the LF clock on the nrf5340 app core?[/quote]
&lt;p&gt;No.&lt;/p&gt;
[quote user="skajam66"]Yes, exactly.[/quote]
&lt;p&gt;Try calling this if you are using LFXO.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define PIN_XL1 0
#define PIN_XL2 1

nrf_gpio_pin_control_select(PIN_XL1, NRF_GPIO_PIN_SEL_PERIPHERAL);
nrf_gpio_pin_control_select(PIN_XL2, NRF_GPIO_PIN_SEL_PERIPHERAL);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1) Are you using external or internal load caps? ref:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/oscillators/doc/oscillators.html?cp=3_0_0_3_11_1#concept_osc_lfxo"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/oscillators/doc/oscillators.html?cp=3_0_0_3_11_1#concept_osc_lfxo&lt;/a&gt;&lt;br /&gt;2) Is this a DK or a custom board?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Low Frequency Timer (RTC)</title><link>https://devzone.nordicsemi.com/thread/393133?ContentTypeID=1</link><pubDate>Sun, 30 Oct 2022 17:31:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5458161b-2a7e-4594-9860-aa1249968cd8</guid><dc:creator>skajam66</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;nbsp;&lt;span&gt;You are stuck in&amp;nbsp;nrfx_clock_lfclk_is_running() ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Yes, exactly.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;AC&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Low Frequency Timer (RTC)</title><link>https://devzone.nordicsemi.com/thread/393020?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2022 12:25:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31b8967-1aa3-4fe4-9191-ca61565655ce</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you explain more about the issue you are seeing? You are stuck in&amp;nbsp;nrfx_clock_lfclk_is_running() ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Low Frequency Timer (RTC)</title><link>https://devzone.nordicsemi.com/thread/392963?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2022 08:57:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44584085-b725-4962-a3df-7944710b1ecd</guid><dc:creator>skajam66</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
&lt;p&gt;Thank you for your reply. I&amp;#39;m not using Zephyr - this is a bare metal implementation.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;AC&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf5340 Low Frequency Timer (RTC)</title><link>https://devzone.nordicsemi.com/thread/392797?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2022 11:15:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb932f94-0803-4930-8f81-0305142009ff</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]Is there a known issue with the startup of the LF clock on the nrf5340 app core?[/quote]
&lt;p&gt;No.&lt;/p&gt;
[quote user=""]Do you have any insights in how to start the LF clock cleanly?[/quote]
&lt;p&gt;The Zephyr kernel system clock starts the LF clock for you at PRE_KERNEL_2 level. If you for some reason wants to use i&lt;span&gt;nternal 32 kHz synthesizer from HFCLK system clock as the LF clock soruce, then set&amp;nbsp;CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y in your prj.conf file&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>