<?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>nRF52840 custom board k_sleep()</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/86932/nrf52840-custom-board-k_sleep</link><description>Dear nRF DevZone, 
 I have question regarding Zephyr k_sleep() function and NRF52840 timers. 
 I am developing an application for nRF52840 SOC and for that I am using nRF Connect SDK V1.9.1. in VS Code IDE. As this is a custom board that was developed</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 18 Apr 2022 07:29:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/86932/nrf52840-custom-board-k_sleep" /><item><title>RE: nRF52840 custom board k_sleep()</title><link>https://devzone.nordicsemi.com/thread/363339?ContentTypeID=1</link><pubDate>Mon, 18 Apr 2022 07:29:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2150cd6-d98e-483c-9624-5303e8e27f53</guid><dc:creator>qwertynoon</dc:creator><description>&lt;p&gt;If you don&amp;#39;t have 32kHz&lt;pre class="ui-code" data-mode="text"&gt;#CLOCK_CONTROL
CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n&lt;/pre&gt; on board then that makes a difference. Add the following lines to config&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 custom board k_sleep()</title><link>https://devzone.nordicsemi.com/thread/363328?ContentTypeID=1</link><pubDate>Sun, 17 Apr 2022 22:06:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78b1033f-05c2-4697-aab1-0979944c0826</guid><dc:creator>zic123</dc:creator><description>&lt;p&gt;Thank you for providing the code.&lt;br /&gt;I have tested it but I get the same result.&lt;br /&gt;&lt;br /&gt;Do you maybe have any other tips?&amp;nbsp;&lt;br /&gt;I would like to add that the board only has a 32Mhz external oscillator and not an additional 32.768 kHz oscillator, which I see is optional, as it can use an HF clock for the LF clock. Is this maybe the problem? I just do not know if I should change something in .dts files or somewhere else.&lt;br /&gt;&lt;br /&gt;Could you provide additional comment on why this k_sleep() &amp;quot;Arduino only way&amp;quot;, as I see it being used in multiple examples and on boards that are not from Arduino, like nrf52840 DK?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Thank you in advance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 custom board k_sleep()</title><link>https://devzone.nordicsemi.com/thread/363235?ContentTypeID=1</link><pubDate>Wed, 13 Apr 2022 17:40:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c213ab33-e2d7-4a8b-a2d4-12ba9f3cadbf</guid><dc:creator>qwertynoon</dc:creator><description>&lt;p&gt;Hi!!!&lt;/p&gt;
&lt;p&gt;Actually this way you go is for Arduino only.&lt;/p&gt;
&lt;p&gt;Zephyr is RTOS - cool system.&lt;/p&gt;
&lt;p&gt;Please try to use Zephyrs timers and use next code&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void FLASH_handler()
{
    //do something every 1000ms
}

K_WORK_DEFINE(FLASH_timer_work, FLASH_handler);

void FLASH_timer_handler(struct k_timer *dummy)
{
    k_work_submit(&amp;amp;FLASH_timer_work);
}

K_TIMER_DEFINE(k_FLASH_timer, FLASH_timer_handler, NULL);

void main()
{
    k_timer_start(&amp;amp;k_FLASH_timer,  K_MSEC(1000), K_MSEC(1000));
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>