<?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>Generating a pulse with RTC1 and PPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6822/generating-a-pulse-with-rtc1-and-ppi</link><description>Hi there, 
 I am trying to generate a pulse on a pin using RTC1 and PPI. Using a TIMER this works fine but my goal is to incur minimum current consumption by using only the LFCLK. Here&amp;#39;s my code: 
 NRF_RTC1-&amp;gt;TASKS_STOP = 1;
 NRF_RTC1-&amp;gt;TASKS_CLEAR </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 Apr 2015 21:32:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6822/generating-a-pulse-with-rtc1-and-ppi" /><item><title>RE: Generating a pulse with RTC1 and PPI</title><link>https://devzone.nordicsemi.com/thread/24030?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 21:32:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8aa9d9b5-1093-4497-9c02-d6bde36f4e03</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;updated code for you, it wont compile as i dont remember API now, but you get the idea&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generating a pulse with RTC1 and PPI</title><link>https://devzone.nordicsemi.com/thread/24029?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 21:17:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcf1dc0f-26b6-4da9-8268-58f64dd1d5c7</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I am really sorry, I actually got confused looking at your use of GPIOTE, We do not have to use GPIOTE at all.
Just toggle the pin in the interrupt handler. remove GPIOTE and PPI, then we just keep LFCLK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generating a pulse with RTC1 and PPI</title><link>https://devzone.nordicsemi.com/thread/24028?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 18:53:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d681b77-bc1a-4b5e-9840-85d59a048e57</guid><dc:creator>Florin</dc:creator><description>&lt;p&gt;I see. Is there actually any way to generate such pulse using less power than the method above?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generating a pulse with RTC1 and PPI</title><link>https://devzone.nordicsemi.com/thread/24027?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 13:11:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:562d5859-316b-47f4-a293-24a506e4b109</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;i think you can use timer as you are using gpiote anyways that uses HFCLK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generating a pulse with RTC1 and PPI</title><link>https://devzone.nordicsemi.com/thread/24026?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 13:07:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:265fb5c3-a1eb-4c71-b66b-f653ad3bb078</guid><dc:creator>Florin</dc:creator><description>&lt;p&gt;Thanks Aryan for the quick answer, now it works.&lt;/p&gt;
&lt;p&gt;So I guess that there&amp;#39;s no way to avoid using RTC1_IRQHandler. A similar solution using TIMER1 doesn&amp;#39;t require IRQ handling.&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generating a pulse with RTC1 and PPI</title><link>https://devzone.nordicsemi.com/thread/24025?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 11:36:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79a9547c-62c6-4fc6-afc7-f23463cef86e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;pre&gt;&lt;code&gt;void RTC1_IRQHandler(void)
{ 
  static volatile bool pin_state_high = true:

  if ( (NRF_RTC1-&amp;gt;EVENTS_COMPARE[0] == 1) &amp;amp;&amp;amp;
      ((NRF_RTC1-&amp;gt;INTENCLR &amp;amp; (1 &amp;lt;&amp;lt; RTC_INTENCLR_COMPARE0_Pos)) != 0 ) )
	{
		NRF_RTC1-&amp;gt;TASKS_CLEAR = 1;
		NRF_RTC1-&amp;gt;EVENTS_COMPARE[0] = 0;

            if(pin_state_high)
            {
               NRF_GPIO-&amp;gt;OUTCLR = (1 &amp;lt;&amp;lt; PIN_NO);
            }
            else
            {
               NRF_GPIO-&amp;gt;OUTSET = (1 &amp;lt;&amp;lt; PIN_NO);
            }
            pin_state_high = !pin_state_high;
	}
}

/**
 * @brief Function for application main entry.
 */
int main(void)
{
	
	NRF_CLOCK-&amp;gt;LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART    = 1;

    while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
		
  NRF_RTC1-&amp;gt;TASKS_STOP = 1;
  NRF_RTC1-&amp;gt;TASKS_CLEAR = 1;               // clear the task first to be usable for later

  NRF_RTC1-&amp;gt;PRESCALER = 32; //1kHz
  NRF_RTC1-&amp;gt;CC[0] = 1000;  //1s interval
  NRF_RTC1-&amp;gt;EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
  NRF_RTC1-&amp;gt;INTENSET = RTC_INTENSET_COMPARE0_Msk;
  NVIC_ClearPendingIRQ(RTC1_IRQn);
  NVIC_EnableIRQ(RTC1_IRQn);
  NRF_RTC1-&amp;gt;TASKS_START = 1;

  nrf_gpio_set_dir_as_output_something (API not top of my head)

    while (true)
    {
        __SEV();
	    __WFE();

	    __WFE();            
        // Do Nothing - GPIO can be toggled without software intervention.
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generating a pulse with RTC1 and PPI</title><link>https://devzone.nordicsemi.com/thread/24024?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 10:50:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4dadced8-5141-492d-af76-86412ccf04e2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;you are using GPIOTE module, this uses HFCLK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>