<?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 of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71977/how-to-use-of-rtc-to-wake-up-from-sleep</link><description>Hello, 
 I am after an example for nRF5340 showing how to use RTC to wake up from sleep. 
 I have a couple of timers running few tasks at regular intervals in a forever loop then I send the chip to sleep. At this point everything stops including the timers</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 Jul 2024 13:05:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71977/how-to-use-of-rtc-to-wake-up-from-sleep" /><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/496015?ContentTypeID=1</link><pubDate>Mon, 29 Jul 2024 13:05:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94d4edee-2a15-4452-adef-f6f4b247c7c6</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;k_sleep will sleep for the specified amount of time regardless of what happens. But it is only the thread with the k_sleep that will sleep. interrupts can still be processed, and other threads will still run. If you may need to process something in the sleeping thread it may be better to wait for a message queue with a timeout or similar (depending on your specific needs). You may find the first module in the &lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/"&gt;nRF Connect SDK Intermediate course&lt;/a&gt;&amp;nbsp;relevant.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/493765?ContentTypeID=1</link><pubDate>Sun, 14 Jul 2024 16:04:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ad45ae7-a4fe-4bc2-9dc6-ed0bfe724394</guid><dc:creator>zsn</dc:creator><description>&lt;p&gt;&amp;nbsp;Hi,&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/eith"&gt;Einar Thorsrud&lt;/a&gt;&amp;nbsp; I see&amp;nbsp;3 years already passed since your discussion here. But I have a question for rtc. You suggested here to use ksleep instead of rtc.&amp;nbsp; I was wondering if I use a k_sleep, dont i have to wait until the ksleep timer expires to use that thread? If i have an interrupt and need to process it in that thread, then how can I cancel k_sleep and claim back that thread?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296584?ContentTypeID=1</link><pubDate>Fri, 26 Feb 2021 14:14:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84016811-c864-421f-84d8-46429c7e5e09</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Mohamed,&lt;/p&gt;
&lt;p&gt;To you use nrfx_saadc API directly you need to include nrfx_saadc.h. You can see a few examples of its usage here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx/wiki/SAADC-Simple-blocking-mode"&gt;Example code for SAADC in simple blocking mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx/wiki/SAADC-Simple-mode-with-IRQs"&gt;Example code for SAADC in simple mode with IRQs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx/wiki/SAADC-Advanced-mode-with-IRQs"&gt;Example code for SAADC in advanced mode with IRQs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You need to have CONFIG_ADC_NRFX_SAADC=y for this. That should be implicitly set, though as you allready have CONFIG_ADC=y.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296490?ContentTypeID=1</link><pubDate>Fri, 26 Feb 2021 11:01:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f371685-42e5-4292-9b8a-2f2612b56b09</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hello Einar,&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;You are right, I am using functions adc_read() to read adc results. So, I am using Zephyr ADC NOT nrfx_saadc API. These are the header files I am currently including in my adc.c file.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;#include &amp;lt;zephyr.h&amp;gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;#include &amp;lt;kernel.h&amp;gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;#include &amp;lt;sys/printk.h&amp;gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;#include &amp;lt;drivers/adc.h&amp;gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;#include &amp;lt;hal/nrf_saadc.h&amp;gt; /*ADC definitions and includes*/&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;#include &amp;lt;device.h&amp;gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;#include &amp;lt;drivers/gpio.h&amp;gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Which header files should I be including for nrfx_saadc APIs and which one ones should I remove from the ones currently included above or can they co-exist?&lt;/p&gt;
&lt;p&gt;Also, do I have to change the prj.conf file?&lt;/p&gt;
&lt;p&gt;it currently contains this line&amp;nbsp;&lt;strong&gt;CONFIG_ADC=y.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Finally, do you an example you can share with me that uses nrfx_saadc APIs&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296479?ContentTypeID=1</link><pubDate>Fri, 26 Feb 2021 10:38:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f8d31b3-c728-4dd9-b2c4-aeb0f8197edb</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Mohamed,&lt;/p&gt;
[quote user="Learner"]I am not sure.&amp;nbsp;How do I know for sure if I am using nrfx_saadc API?[/quote]
&lt;p&gt;You can know by looking at the functions you call to use the SAADC. Do you for instance call functions that look like&amp;nbsp;nrfx_saadc_() or do they look like adc_*()? I assume the latter as you get&amp;nbsp;undefined reference to nrfx_saadc_uninit().&lt;/p&gt;
&lt;p&gt;If you want to use the nrfx API instead then you should include the nrfx_saadc.h file. This may be useful if you are not able to get the ADC current consumption down without disabling it, as the Zephyr ADC API does not have any API for that.&lt;/p&gt;
&lt;p&gt;Br,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296393?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 22:00:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d72fa19c-0e3f-4450-a053-3a8046de69ec</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Thank you for the tips.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/71977/how-to-use-of-rtc-to-wake-up-from-sleep/296321#296321"]Are you using the nrfx_saadc API? [/quote]
&lt;p&gt;I am not sure.&amp;nbsp;How do I know for sure if I am using nrfx_saadc API?&lt;/p&gt;
&lt;p&gt;I looked in the build.emProject file and I can see the following which suggests I am using nrfx_saadc API. An extract from build.emProject is included below. The file &lt;strong&gt;nrfx_saadc_uninit()&lt;/strong&gt;&amp;nbsp;is declared in the header file&amp;nbsp;&lt;strong&gt;C:\Zypher\v1.5.0-rc1\modules\hal\nordic\nrfx\drivers\include\nrfx_saadc.h&lt;/strong&gt; which is included in the project file below. However,&amp;nbsp;I cannot&amp;nbsp;build the project because it returns the error &lt;strong&gt;undefined reference to&amp;nbsp;nrfx_saadc_uninit()&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt; &amp;lt;/project&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;lt;project Name=&amp;quot;app/libapp.a&amp;quot;&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;lt;configuration&lt;/em&gt;&lt;br /&gt;&lt;em&gt; Name=&amp;quot;Common&amp;quot;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; build_output_file_name=&amp;quot;app\libapp.a&amp;quot;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; project_dependencies=&amp;quot;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;cmake_object_order_depends_target_app;zephyr/driver_validation_h_target;zephyr/kobj_types_h_target;zephyr/syscall_list_h_target;zephyr/zephyr_generated_headers&amp;quot;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; project_directory=&amp;quot;&amp;quot;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; project_type=&amp;quot;Externally Built Library&amp;quot; /&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;lt;folder Name=&amp;quot;C_COMPILER__app_&amp;quot;&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;lt;file file_name=&amp;quot;../src/adc/pid4_adc.c&amp;quot;&amp;gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; &amp;lt;configuration&lt;/em&gt;&lt;br /&gt;&lt;em&gt; Name=&amp;quot;Common&amp;quot;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; build_dependency_file_name=&amp;quot;$(ProjectDir)/CMakeFiles\app.dir\src\adc\pid4_adc.c.obj.d&amp;quot;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; build_object_file_name=&amp;quot;CMakeFiles/app.dir/src/adc/pid4_adc.c.obj&amp;quot;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; c_only_additional_options=&amp;quot;-DBUILD_VERSION=v2.4.99-ncs1-rc1;-DKERNEL;-DNRF5340_XXAA_APPLICATION;-DUSE_PARTITION_MANAGER=0;-D_FORTIFY_SOURCE=2;-D__LINUX_ERRNO_EXTENSIONS__;-D__PROGRAM_START;-D__ZEPHYR__=1;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; &lt;span style="background-color:#ffff00;color:#0000ff;"&gt;&lt;strong&gt;-IC:/Zypher/v1.5.0-rc1/modules/hal/nordic/nrfx/drivers/include&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -IC:/Zypher/v1.5.0-rc1/zephyr/include;-Izephyr/include/generated;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -IC:/Zypher/v1.5.0-rc1/zephyr/soc/arm/nordic_nrf/nrf53;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -IC:/Zypher/v1.5.0-rc1/zephyr/lib/libc/newlib/include;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -IC:/Zypher/v1.5.0-rc1/nrf/include;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -IC:/Zypher/v1.5.0-rc1/modules/hal/cmsis/CMSIS/Core/Include;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -IC:/Zypher/v1.5.0-rc1/modules/hal/nordic/nrfx;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -IC:/Zypher/v1.5.0-rc1/modules/hal/nordic/nrfx/drivers/include;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -IC:/Zypher/v1.5.0-rc1/modules/hal/nordic/nrfx/mdk;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -IC:/Zypher/v1.5.0-rc1/zephyr/modules/hal_nordic/nrfx/.;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -IC:/Zypher/v1.5.0-rc1/modules/debug/segger/rtt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -isystem;C:/Zypher/v1.5.0-rc1/nrfxlib/crypto/nrf_cc312_platform/include;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; -Og;-imacros;&lt;/em&gt;&lt;br /&gt;&lt;em&gt; ...&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I have this config line in my &lt;strong&gt;prj.conf&lt;/strong&gt; file&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CONFIG_ADC=y&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Which&amp;nbsp;header file should I be including?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296321?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 14:53:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6478171-eb99-487b-a240-4885498c46d8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Mohamed,&lt;/p&gt;
&lt;p&gt;Are you using the nrfx_saadc API? If so you can call&amp;nbsp;nrfx_saadc_uninit() after finishing the conversion. If current consumption is still high after uninitializing then you can use the following as well:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    *(volatile uint32_t *)0x40007FFC = 0;
    *(volatile uint32_t *)0x40007FFC = 1;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The above snippet uses an undocumented register to reset the SAADC peripheral.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296313?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 14:39:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b0461b8-0bd9-4f0d-9bb4-dee6c0f2f0e3</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Thank you Einar.&lt;/p&gt;
&lt;p&gt;I experimented with the ADC and stopped reading the ADC results to see what effect it has on current consumption. To my disbelief the current consumption increased. How can this be?&lt;/p&gt;
&lt;p&gt;Note, the ADC was still initialised and bound.&amp;nbsp;For the ADC peripheral there must be a disable or power down procedure to go through.&lt;/p&gt;
&lt;p&gt;I have not played with the SPI yet.&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296255?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 12:46:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e79f9efd-99ed-46e5-83c4-83b2022cfd9f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Mohamed,&lt;/p&gt;
&lt;p&gt;That is different for different peripherals and also sometimes depending on which driver you use. Often it is enough to not have an active transaction or stopping it (so essentially not use it). In some other cases you may need to uninit the driver in order to properly shut down. You can refer to the API of the relevant drivers to see how.&lt;/p&gt;
&lt;p&gt;Also, it may be useful to experiment by commenting out initialization and usage of peripherals and gradually include again if you have a unexpected current consumption and want to narrow down where what causes it. Then you can look at that peripheral and the related code specifically.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296088?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 16:16:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdc1959f-a8d0-46f6-bade-2a1d85dd6efe</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;OK, thank you.&lt;/p&gt;
&lt;p&gt;Your answer has led me to my next question.&lt;/p&gt;
&lt;p&gt;How do I disable or power down the peripherals e.g. ADC, SPI...?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296083?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 16:10:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73bb662c-ccfb-4672-a4b1-f4758235b6d5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Mohamed,&lt;/p&gt;
&lt;p&gt;You will have to disable peripherals such as ADC, SPI etc explicitly. This makes sense in a practical use case as you often would need to keep some peripherals active but not the CPU (as most peripherals operate on DMA so the CPU is typically only needed to start an operation and then in the end to process the result).&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296051?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 14:08:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1698a10a-20d4-4ca0-91a7-288d1be12dba</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Thank you Einar.&lt;/p&gt;
&lt;p&gt;I got it.&lt;/p&gt;
&lt;p&gt;You are right I do not need to use RTC, k_sleep() will do the job.&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;am trying to optimise power usage, will k_sleep() put peripheral devices such as ADC, SPI in low power mode?&lt;/p&gt;
&lt;p&gt;Or do I have to do this separately before calling k_sleep()?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296039?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 13:37:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:381bfcab-e114-4dd5-805f-59191f20abbc</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Mohamed,&lt;/p&gt;
&lt;p&gt;The sample is located under &lt;code&gt;&amp;lt;ncs&amp;gt;/zephyr/samples/basic/threads/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296037?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 13:35:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34217a60-d91a-49c2-bed8-7d571d6df0dc</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;I get it that my main() function is an implicit thread running under Zephyr.&lt;/p&gt;
&lt;p&gt;I tried to get to the source code of the basic thread example but I could not. All I could see was the README.html file.&lt;/p&gt;
&lt;p&gt;How can I view and download the project?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296035?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 13:25:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2959a9e8-2c0a-414f-8e7b-f2f9b9ee006b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Mohamed,&lt;/p&gt;
[quote user="Learner"]I am not using threads for now. I may be&amp;nbsp;using threads at some point in the near future.[/quote]
&lt;p&gt;If you are using Zephyr you are using threads, even if you may not be aware of it. Your main function is a thread (see &lt;a href="https://docs.zephyrproject.org/1.9.0/kernel/threads/system_threads.html#system-threads"&gt;system threads documentation&lt;/a&gt; for more). So using k_sleep is still the most appropriate.&lt;/p&gt;
[quote user="Learner"]Could you please provide an example where the RTC is used to come out of sleep?[/quote]
&lt;p&gt;There are no official simple RTC sample in the NCS, but you can refer to &lt;a href="https://github.com/Rallare/fw-nrfconnect-nrf/tree/nrf9160_samples/samples/nrf9160/nrfx/rtc"&gt;this unofficial sample&lt;/a&gt; (it is for the nRF9160 but the code is equally relevant for the nRF53).&lt;/p&gt;
[quote user="Learner"]Are you saying there are few good reasons for NOT using the built-in thread and work queues?[/quote]
&lt;p&gt;Yes.&lt;/p&gt;
[quote user="Learner"]In other ways you are discouraging me from using threads. Is this what you meant to say?[/quote]
&lt;p&gt;No, I am discouraging you from using the RTC driver and handling this yourself as the appropriate way to do this is to use what Zephyr provides for you. To expand on this: Using an RTC directly will work, and it is not complicated. But it is just not clean to use a special approach in place of a core feature of the RTOS you are using which does exactly the same thing.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296024?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 13:04:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1372b2e8-9075-4f95-965e-f9bcc7338126</guid><dc:creator>Learner</dc:creator><description>&lt;p&gt;Thank you Einar for the quick response.&lt;/p&gt;
&lt;p&gt;I am not using threads for now. I may be&amp;nbsp;using threads at some point in the near future.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/71977/how-to-use-of-rtc-to-wake-up-from-sleep/296014#296014"]You are free to use an RTC peripheral directly and do it that way,[/quote]
&lt;p&gt;Could you please provide an example where the RTC is used to come out of sleep?&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/71977/how-to-use-of-rtc-to-wake-up-from-sleep/296014#296014"]but there are few good reasons for not using the build in thread and work queues support in Zephyr as suggested above.[/quote]
&lt;p&gt;Are you saying there are few good reasons for NOT using the built-in thread and work queues?&lt;/p&gt;
&lt;p&gt;In other ways you are discouraging me from using threads. Is this what you meant to say?&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Mohamed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use of RTC to wake up from sleep</title><link>https://devzone.nordicsemi.com/thread/296014?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 12:30:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51b8a33d-84f3-4b41-9e90-0a2b63d5685d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Mohamed,&lt;/p&gt;
&lt;p&gt;The Zephyr RTOS handles this for you. In the &lt;a href="https://docs.zephyrproject.org/1.9.0/kernel/threads/system_threads.html#system-threads"&gt;idle thread&lt;/a&gt; it will essentially call WFE, to enter system on low power mode. If you want to wake up after some time to do some work, you can use &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/index.html?highlight=k_sleep#c.k_sleep"&gt;k_sleep()&lt;/a&gt;&amp;nbsp;or similar. You can refer to the &lt;a href="https://docs.zephyrproject.org/latest/samples/basic/threads/README.html#basic-thread-example"&gt;basic thread example&lt;/a&gt; to see how this is done.&lt;/p&gt;
&lt;p&gt;You are free to use an RTC peripheral directly and do it that way, but there are few good reasons for not using the build in thread and work queues support in Zephyr as suggested above.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>