<?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>nrf9160dk: using HFCLK with Zephyr SDK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68017/nrf9160dk-using-hfclk-with-zephyr-sdk</link><description>I wanted to use HFCLK for the nrf9160 in nrf9160DK board. I am using the latest nrf SDK and tried the below Kconfig entries, but no luck, 
 
 
 Command for compilation: west build -b nrf9160dk_nrf9160ns 
 I am able to compile and run hello_world samples</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Nov 2020 19:05:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68017/nrf9160dk-using-hfclk-with-zephyr-sdk" /><item><title>RE: nrf9160dk: using HFCLK with Zephyr SDK</title><link>https://devzone.nordicsemi.com/thread/279811?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 19:05:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3a0d72f-10cf-4c55-86aa-2b4708257c8c</guid><dc:creator>parthitce</dc:creator><description>&lt;p&gt;Thank you very much &lt;a href="https://devzone.nordicsemi.com/members/jonathanll"&gt;JONATHAN LL&lt;/a&gt;. Opened a issue in Zephyr mainline: &lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/29977"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/29977&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160dk: using HFCLK with Zephyr SDK</title><link>https://devzone.nordicsemi.com/thread/279769?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 14:50:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:395679ba-e00c-4210-8b98-3631c9abfaa9</guid><dc:creator>JONATHAN LL</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;The SYS_CLOCK in Zephyr uses RTC and not a timer, so using these configs&lt;br /&gt; CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=64000000&lt;br /&gt;CONFIG_SYS_CLOCK_TICKS_PER_SEC=64000000&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Will not work. I did some testing and even the&amp;nbsp;&lt;span&gt;hello_world example does not behave properly even though&amp;nbsp;it looks like it worked at first&amp;nbsp;glance. The same goes for Blinky and other basic examples. Something strange is going on when setting&amp;nbsp;those values and it is not stable.&lt;br /&gt;&lt;br /&gt;Using TIMER (max 16MHz) but I don&amp;#39;t&amp;nbsp;believe&amp;nbsp;there is a implementation&amp;nbsp;for this yet, or Systick (maybe 64MHz). This is not low power options so as far as i know it has not been considered by nordic as the RTC preforms&amp;nbsp;well in this regard. Maybe looking at a different&amp;nbsp;way to solve the problem&amp;nbsp;could be better. I would recommend&amp;nbsp;to take the question to &lt;a href="https://docs.zephyrproject.org/latest/guides/getting-help.html"&gt;Zephyr community&amp;nbsp;an ask for help&lt;/a&gt;&amp;nbsp;there.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Jonathan&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160dk: using HFCLK with Zephyr SDK</title><link>https://devzone.nordicsemi.com/thread/279310?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 14:40:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f677ea3c-762c-47ae-85d2-b44d925bf631</guid><dc:creator>parthitce</dc:creator><description>&lt;p&gt;Good day &lt;a href="https://devzone.nordicsemi.com/members/jonathanll"&gt;JONATHAN LL&lt;/a&gt;, No I am not trying to get nano second resolution. As in the above example, if I set 10 timers expiring at the same time (eg. 20 seconds), I don&amp;#39;t see all of them not expiring at 20 seconds.&lt;/p&gt;
&lt;p&gt;I have even tried with `&lt;span class="n"&gt;k_timer_remaining_get&lt;/span&gt;&lt;span class="p"&gt;&lt;/span&gt;` to filter within the margin of 100 mill seconds but no luck still. This means that I am not getting even millisecond resolution.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;gt; CONFIG_SYS_CLOCK_TICKS_PER_SEC is not able to go to 64MHz, maybe try&amp;nbsp;&amp;nbsp;&lt;span&gt;32768&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This means nrf9160 timer can&amp;#39;t run at 64Mhz or in other words it can run only at 32868Hz?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160dk: using HFCLK with Zephyr SDK</title><link>https://devzone.nordicsemi.com/thread/279062?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 15:02:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0de46fd1-61cd-48c5-8162-7b3366eb3fc1</guid><dc:creator>JONATHAN LL</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;CONFIG_SYS_CLOCK_TICKS_PER_SEC is not able to go to 64MHz, maybe try&amp;nbsp;&amp;nbsp;&lt;span&gt;32768&lt;/span&gt;&lt;br /&gt;&lt;a href="https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_SYS_CLOCK_TICKS_PER_SEC.html"&gt;https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_SYS_CLOCK_TICKS_PER_SEC.html&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Do you need Nano second accuracy?&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Jonathan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160dk: using HFCLK with Zephyr SDK</title><link>https://devzone.nordicsemi.com/thread/278655?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2020 15:56:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23f89790-fe2a-4b0c-9dba-01ddd37a8f7a</guid><dc:creator>parthitce</dc:creator><description>&lt;p&gt;I am using NRF Zephyr SDK and toolchain. I did clone and compile based on : &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_installing.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_installing.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Use case:&lt;/p&gt;
&lt;p&gt;I have an application logic which needs multiple timers for managing various interface reading over modbus TCP. For example, I have 5 timers out of which 3 of them expires periodically every 10 seconds and remaining 2 at 20 seconds interval (implemented using &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;). I have a general timer (other than the 5) which runs at the lowest timer expiration value of all 5 and scans on all the 5 timers whether it&amp;#39;s expired or not using &lt;span class="n"&gt;k_timer_status_get&lt;/span&gt;&lt;span class="p"&gt;&lt;/span&gt;. So I expect to see all 5 of them expires every 20 seconds.&lt;br /&gt;&lt;br /&gt;As timer callback is in ISR context and I have a work thread which offloads all the primary interface reading. So every time the timer expires, the work is submitted and scheduled to offload. In the specific example above, during the 20 second interval, I wanted to process all 5 of them. But what I observed is, not all of them aren&amp;#39;t expiring at the exact same time (&lt;span class="n"&gt;k_timer_status_get&lt;/span&gt;&lt;span class="p"&gt;&lt;/span&gt;).&lt;/p&gt;
&lt;p&gt;So the idea is to process all the expired timers in work thread and read the interfaces.&lt;/p&gt;
&lt;p&gt;I did try to compile and flash the hello_world example and it works with 64MHz clock. But not any other sample, like multi thread or mqtt.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void reader_work(struct k_work *w)
{
        SYS_SLIST_FOR_EACH_CONTAINER(&amp;amp;gt-&amp;gt;aq, aq, node) {
                if (k_timer_status_get(&amp;amp;aq-&amp;gt;param.sec) &amp;gt; 0) {
                    /* application logic here */
                    
                    /* restart the timer */
                    k_timer_start(&amp;amp;aq-&amp;gt;param.timer, K_SECONDS(aq-&amp;gt;param.sec), K_NO_WAIT);
                }
        }
}

K_WORK_DEFINE(reader, reader_work);
static void periodic_reader(struct k_timer *t)
{
        k_work_submit(&amp;amp;reader);
}

void main(void) {
        SYS_SLIST_FOR_EACH_CONTAINER(&amp;amp;x-&amp;gt;aq, aq, node) {
                if (period &amp;gt; aq-&amp;gt;param.sec)
                        period = aq-&amp;gt;param.sec;

                k_timer_init(&amp;amp;aq-&amp;gt;param.timer, NULL, NULL);
                k_timer_start(&amp;amp;aq-&amp;gt;param.timer, K_SECONDS(aq-&amp;gt;param.sec), K_NO_WAIT);
        }

        k_timer_init(&amp;amp;reader, periodic_reader, NULL);
        k_timer_start(&amp;amp;reader, K_SECONDS(period), K_SECONDS(period));
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I am expecting all the 5 timers to expire inside the worker thread. In reality there could be 100 timers in my use case.&lt;/p&gt;
&lt;p&gt;My observation with the above logic is that the resolution of the timer is based on RTC at 32KHz. I would like to check the same logic with 64MHz clock (HFCLK). But enabling it leaving the target not booting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160dk: using HFCLK with Zephyr SDK</title><link>https://devzone.nordicsemi.com/thread/278648?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2020 15:23:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06424d7b-7b22-4306-bfa7-7e071845a191</guid><dc:creator>JONATHAN LL</dc:creator><description>&lt;p&gt;Hi parthitce,&lt;br /&gt;&lt;br /&gt;I am going to focus on this first:&lt;/p&gt;
[quote user=""]I am able to compile and run hello_world samples, but not other samples or custom application.[/quote]
&lt;p&gt;Did you use the &lt;a href="https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Connect-for-desktop"&gt;nrf connect for desktop&lt;/a&gt; &lt;strong&gt;Toolchain Manager&lt;/strong&gt; app to install NCS v1.4.0 or are you using git and west pulling from master?&lt;br /&gt;Is this statement related to Kconfig edits?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To clarify:&lt;br /&gt;Are you not able to build and run any other applications then &lt;span&gt;hello_world&lt;/span&gt; when you edit the kconfig file?&lt;br /&gt;&lt;br /&gt;If you describe your end goal and&amp;nbsp;use case then it might be easier to propose solutions&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Jonathan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>