<?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>how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95344/how-to-use-hfclk-in-zephyr-with-nrf52840</link><description>I want to use HFCLK for 52840 in nrf21540dk, I change the prj.conf like this ,but it didn&amp;#39;t compile.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Jan 2023 09:02:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95344/how-to-use-hfclk-in-zephyr-with-nrf52840" /><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/404741?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2023 09:02:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c301ff84-1348-4928-8224-ae9c9b0242b6</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you probe the SD lines, are data going in/out any different when you run one thread versus running two? How are they different?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403951?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2023 01:20:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac4e4b7f-7e11-4d01-b1ea-539eae68b510</guid><dc:creator>andy</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think so.If only the thread for writing to the SD card is kept, writing random values to it for a long time will not return an error, but if the SPI receive thread is also enable, it will return an error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403899?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2023 15:11:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e1f834f-cc90-49ff-a1f7-256841ad58df</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It seems like this is the same issue as you were facing &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/92166/fs-file-write-error--5/390572"&gt;here&lt;/a&gt;. Can you try to do as my colleague Jørgen already suggested:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Can you check the connections, and have a look at the SPI signals with a scope/logic analyzer, to see if there are noise or signal issues that can explain the behavior?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The -5 error is a IO error, so it could be related to the communication between the SD card and the chip.&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403677?ContentTypeID=1</link><pubDate>Sat, 07 Jan 2023 09:51:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:632566bc-7799-421c-ab71-81eeeca772a5</guid><dc:creator>andy</dc:creator><description>[quote userid="73165" url="~/f/nordic-q-a/95344/how-to-use-hfclk-in-zephyr-with-nrf52840/403576"]Yes, error -5 is a IO error. Are you able to reproduce the issue when you use the HFINT instead?[/quote]
&lt;p&gt;Yes, this is reproducible, sometimes the program runs a few minutes to appear, sometimes half an hour to appear&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403576?ContentTypeID=1</link><pubDate>Fri, 06 Jan 2023 12:44:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c6041f2-dc05-423d-8b65-f4a45e0aa094</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
[quote user="yhua"]Tanks for your reply,The HFCLK has two source the HFINT and the HFXO,the HFINT work in normally.If you need a more accurate clock you can use the HFXO, for exanple radio, is right?[/quote]
&lt;p&gt;Yes, HFXO is more accurate and is mandatory if using the radio.&amp;nbsp;&lt;/p&gt;
[quote user="yhua"]Now there is two threads in my project,one thread receive 32bytes data from spi every 160us and put into a ringbuf, another thread get data from the ringbuf and use fs_write to save data to sd card.Do I need to use&amp;nbsp;the&amp;nbsp;HFXO?[/quote]
&lt;p&gt;If you&amp;#39;re not using the radio for this then no, using HFINT should be ok.&lt;/p&gt;
[quote user="yhua"]&lt;p&gt;Now i found the fs_write return error -5 from time to time,what is the reason of this error?&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sure the IO connection is correct, because&amp;nbsp;the program does not&amp;nbsp;return an error at first, but only after running for a while.&lt;/p&gt;[/quote]
&lt;p&gt;Yes, error -5 is a IO error. Are you able to reproduce the issue when you use the HFINT instead?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403513?ContentTypeID=1</link><pubDate>Fri, 06 Jan 2023 05:06:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb48ecfc-7ed0-43ac-aa0e-45bd52434f51</guid><dc:creator>andy</dc:creator><description>&lt;p&gt;Hi Jared:&lt;/p&gt;
&lt;p&gt;Tanks for your reply,The HFCLK has two source the HFINT and the HFXO,the HFINT work in normally.If you need a more accurate clock you can use the HFXO, for exanple radio, is right?&lt;/p&gt;
&lt;p&gt;Now there is two threads in my project,one thread receive 32bytes data from spi every 160us and put into a ringbuf, another thread get data from the ringbuf and use fs_write to save data to sd card.Do I need to use&amp;nbsp;the&amp;nbsp;HFXO?&lt;/p&gt;
&lt;p&gt;Now i found the fs_write return error -5 from time to time,what is the reason of this error?&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sure the IO connection is correct, because&amp;nbsp;the program does not&amp;nbsp;return an error at first, but only after running for a while.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403506?ContentTypeID=1</link><pubDate>Fri, 06 Jan 2023 02:49:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ddc3e28-ac20-48fe-bce1-15fa947dd50c</guid><dc:creator>andy</dc:creator><description>[quote userid="73165" url="~/f/nordic-q-a/95344/how-to-use-hfclk-in-zephyr-with-nrf52840/403363"]Have you reproduced this on the nRF21540 DK or are you using a custom board?[/quote]
&lt;p&gt;Yes, I test on the nRF21540 DK.&lt;/p&gt;
[quote userid="73165" url="~/f/nordic-q-a/95344/how-to-use-hfclk-in-zephyr-with-nrf52840/403363"]Also, it would be great if you can specify where in your code the error happens.[/quote]
&lt;p&gt;the error happen when write data to sd card.This is the debug info,the fs_write() return -5,I think it&amp;#39;s hardware IO except the problem,So I handed the problem over to the&amp;nbsp;HW engineer.&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1672738451490v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    int res;
    res = fs_write(&amp;amp;file, (char *)buf, len);
    // res = f_write(&amp;amp;file, buf, len, &amp;amp;bw);
    if(res &amp;lt; 0)
    {
        printk(&amp;quot;rb_length = %d, back_length = %d\n&amp;quot;, len, res);
        
        send_message_spi(MES_ERR);
        fs_close(&amp;amp;file);
    }
    res = fs_sync(&amp;amp;file);
    return res;&lt;/pre&gt;&lt;/p&gt;
[quote userid="73165" url="~/f/nordic-q-a/95344/how-to-use-hfclk-in-zephyr-with-nrf52840/403363"]Can you specify what error the HW engineer found?[/quote]
&lt;p&gt;The HW engineer said the&amp;nbsp;&amp;nbsp;that the oscilloscope can not monitor the 32M crystal,and I found no clk signal detected on X1 oscilator.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403363?ContentTypeID=1</link><pubDate>Thu, 05 Jan 2023 11:21:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a45a6fff-1cf3-4a63-8483-35e954ca4791</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you specify what error the HW engineer found?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, it would be great if you can specify where in your code the error happens.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you reproduced this on the nRF21540 DK or are you using a custom board?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403311?ContentTypeID=1</link><pubDate>Thu, 05 Jan 2023 08:24:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e561d3e2-9105-4808-b289-770b577e7145</guid><dc:creator>andy</dc:creator><description>&lt;p&gt;I want to receive data from spi and save to sd card, and after a random time the file write error, the&amp;nbsp;Hardware Engineer found the 32M is not working, So I guess the error has something to do with the 32M crystal not working?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403306?ContentTypeID=1</link><pubDate>Thu, 05 Jan 2023 08:18:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af3ae467-74b6-41d5-959d-f59af7b16c97</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you elaborate?&lt;/p&gt;
&lt;p&gt;What are you trying to do and how are observing that the 32 MHz doesn&amp;#39;t work?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403274?ContentTypeID=1</link><pubDate>Thu, 05 Jan 2023 01:53:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3dcb3db5-ece9-49ba-b71b-c4c9b4fc1288</guid><dc:creator>andy</dc:creator><description>&lt;p&gt;I just found the 32M oscilator is not working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to use HFCLK in zephyr with nrf52840</title><link>https://devzone.nordicsemi.com/thread/403136?ContentTypeID=1</link><pubDate>Wed, 04 Jan 2023 10:24:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23552aa1-5388-460c-b768-36f268e9fbbf</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The HFCLK is normally configured to be used by default. What exactly are you trying to do with the HFCLK? Are you getting any errors that it hasn&amp;#39;t been enabled when you try to use it?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>