<?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>RTC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65187/rtc</link><description>Hai, 
 We are using RTC in one of our project (in nrf52832). 
 RTC is working fine. I am waking up by every 30 mins once. But I am not able to configure same RTC instance 
 into a different wake up time. (example 15 mins ,60 mins and 120 mins). 
 How</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Aug 2020 08:49:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65187/rtc" /><item><title>RE: RTC</title><link>https://devzone.nordicsemi.com/thread/266401?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2020 08:49:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76ff532c-fc9d-4fa9-b05f-6d00cc98d5db</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Meghana,&lt;/p&gt;
&lt;p&gt;I do not see any problems with your code that should cause this, and when I test your code (with some additions from the RTC example to make it work as you have stripped down the snippet in your previous post), it works as expected. This code gives a compare event every second:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-3354cb157d734d44a7662c4f12af7416/main.c"&gt;devzone.nordicsemi.com/.../main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Perhaps there is an issue in how you test this?&lt;/p&gt;
&lt;p&gt;Also, if you want to use the RTC for getting various delays you may want to look at the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.0/lib_timer.html"&gt;app timer library&lt;/a&gt;, which is used for this purpose all over the SDK. This use RTC1 under the hood&amp;nbsp;but handles all the details for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTC</title><link>https://devzone.nordicsemi.com/thread/266255?ContentTypeID=1</link><pubDate>Tue, 25 Aug 2020 13:28:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef5434cb-cee5-45ff-a517-7948525c1202</guid><dc:creator>meghana</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;kindly look into the attached&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;
#define COMPARE_COUNTERTIME  60UL //60seconds once wakeup



void rtc_handler(nrf_drv_rtc_int_type_t int_type)
{
    if (int_type == NRF_DRV_RTC_INT_COMPARE0)
    {
      RTC_Flag=1;
     // nrf_gpio_pin_toggle(18);//RED_LED
       nrf_drv_rtc_counter_clear(&amp;amp;rtc); //nrf_gpio_pin_toggle(COMPARE_EVENT_OUTPUT);
      nrf_drv_rtc_int_enable(&amp;amp;rtc, NRF_RTC_INT_COMPARE0_MASK);
    }
    else if (int_type == NRF_DRV_RTC_INT_TICK)
    {
      // nrf_gpio_pin_toggle(18);
    }
}


void rtc_config(void)
{
    uint32_t err_code;

    //Initialize RTC instance
    nrf_drv_rtc_config_t config = NRF_DRV_RTC_DEFAULT_CONFIG;
    config.prescaler = 4095;
    err_code = nrf_drv_rtc_init(&amp;amp;rtc, &amp;amp;config, rtc_handler);
    APP_ERROR_CHECK(err_code);

    //Enable tick event &amp;amp; interrupt
    nrf_drv_rtc_int_enable(&amp;amp;rtc, NRF_RTC_INT_COMPARE0_MASK); 
    //nrf_drv_rtc_tick_enable(&amp;amp;rtc,true);

    //Set compare channel to trigger interrupt after COMPARE_COUNTERTIME seconds
    err_code = nrf_drv_rtc_cc_set(&amp;amp;rtc,0,COMPARE_COUNTERTIME * 8,true);
    APP_ERROR_CHECK(err_code);

    //Power on RTC instance
    nrf_drv_rtc_enable(&amp;amp;rtc);
}

int main()
{
    // code...........
    //code....
   rtc_config();
   while(10
   {
       __WFE;
       // code...........
       //code....
   }
}&lt;/pre&gt; code.&lt;/p&gt;
&lt;p&gt;In the above code device is waking up for every 60 secs once. In same code and in same instance of rtc.&lt;/p&gt;
&lt;p&gt;i need to wake up at different interval....and i tried by changing&amp;nbsp;COMPARE_COUNTERTIME..&lt;/p&gt;
&lt;p&gt;But its not working..&lt;/p&gt;
&lt;p&gt;Note: In our application, we want to use rtc as a delay for different interval.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Meghana&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTC</title><link>https://devzone.nordicsemi.com/thread/266238?ContentTypeID=1</link><pubDate>Tue, 25 Aug 2020 12:47:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad3cd61c-289a-45b8-88b9-f6b44c739f76</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Meghana,&lt;/p&gt;
&lt;p&gt;Can you show your code so that I can suggest exactly what you need to change? Generally, as you use it for wakeup, I assume you wake up once the timer reaches a value in the compare register. So to change the time you either need to change the value of your CC register, or the Prescaler (or a combination). I would also like to mention that you could consider using the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.0/lib_timer.html"&gt;app timer library&lt;/a&gt; for this purpose.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>