<?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>Using PPI to enable/disable HFCLK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8721/using-ppi-to-enable-disable-hfclk</link><description>Is it possible to use PPI and RTC to turn the HFCLK on or off ? (external Xtal) 
 Example - something like this ...
NRF_PPI-&amp;gt;CH[9].EEP = (uint32_t) &amp;amp;NRF_RTC0-&amp;gt;EVENTS_COMPARE[1];
NRF_PPI-&amp;gt;CH[9].TEP = (uint32_t) &amp;amp;NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART;
NRF_PPI</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Aug 2015 17:14:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8721/using-ppi-to-enable-disable-hfclk" /><item><title>RE: Using PPI to enable/disable HFCLK</title><link>https://devzone.nordicsemi.com/thread/31985?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2015 17:14:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a681721-1b40-4285-928c-abfaa12f4870</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Yes, you are correct. Thank you for the correction. I have edited my answer to correct myself.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using PPI to enable/disable HFCLK</title><link>https://devzone.nordicsemi.com/thread/31984?ContentTypeID=1</link><pubDate>Fri, 14 Aug 2015 14:52:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2460ed0-2f28-4197-b92d-5b0b336dcfd2</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Stefan, I thought the SET and CLR (CHENSET) registers in peripherals are for avoiding doing the operation that you mentioned?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using PPI to enable/disable HFCLK</title><link>https://devzone.nordicsemi.com/thread/31986?ContentTypeID=1</link><pubDate>Fri, 14 Aug 2015 14:28:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c4041ba-1fd1-42e5-b799-34ca6d985bb6</guid><dc:creator>shyam</dc:creator><description>&lt;p&gt;Hi Stephan&lt;/p&gt;
&lt;p&gt;I tried your suggestion. See below. This code doesn&amp;#39;t work. It asserts in the end (last line).&lt;/p&gt;
&lt;p&gt;==========&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ASSERT(((NRF_CLOCK-&amp;gt;HFCLKSTAT &amp;amp; CLOCK_HFCLKSTAT_STATE_Msk) == (CLOCK_HFCLKSTAT_STATE_NotRunning &amp;lt;&amp;lt; CLOCK_HFCLKSTAT_STATE_Pos) ) || \
               ((NRF_CLOCK-&amp;gt;HFCLKSTAT &amp;amp; CLOCK_HFCLKSTAT_SRC_Msk) == (CLOCK_HFCLKSTAT_SRC_RC &amp;lt;&amp;lt; CLOCK_HFCLKSTAT_SRC_Pos))); /* ensure clock is stopped */

NRF_RTC0-&amp;gt;INTENCLR = RTC_INTENCLR_COMPARE1_Msk;
NRF_RTC0-&amp;gt;EVTENCLR = RTC_EVTENCLR_COMPARE1_Msk;
NRF_PPI-&amp;gt;CH[9].EEP = (uint32_t) &amp;amp;NRF_RTC0-&amp;gt;EVENTS_COMPARE[1];
NRF_PPI-&amp;gt;CH[9].TEP = (uint32_t) &amp;amp;NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART;
NRF_PPI-&amp;gt;CHENSET |= PPI_CHENSET_CH9_Msk;
#define TEST_TICKS (3)
#define TICKS_TO_US(ticks) ((uint64_t)ticks*(uint64_t)1000000/32768)
NRF_RTC0-&amp;gt;CC[1] = NRF_RTC0-&amp;gt;COUNTER + TEST_TICKS;
nrf_delay_us(TICKS_TO_US(TEST_TICKS)); /* wait until RTC fires TEST_TICKS */
nrf_delay_us(TICKS_TO_US(TEST_TICKS)); /* a little extra wait to make sure */
nrf_delay_ms(2); /* Wait 1 ms of warmup time and an extra 1 ms to make sure */
ASSERT(((NRF_CLOCK-&amp;gt;HFCLKSTAT &amp;amp; CLOCK_HFCLKSTAT_STATE_Msk) == (CLOCK_HFCLKSTAT_STATE_Running &amp;lt;&amp;lt; CLOCK_HFCLKSTAT_STATE_Pos) ) &amp;amp;&amp;amp; \
             ((NRF_CLOCK-&amp;gt;HFCLKSTAT &amp;amp; CLOCK_HFCLKSTAT_SRC_Msk) == (CLOCK_HFCLKSTAT_SRC_Xtal &amp;lt;&amp;lt; CLOCK_HFCLKSTAT_SRC_Pos)));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;===============&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using PPI to enable/disable HFCLK</title><link>https://devzone.nordicsemi.com/thread/31983?ContentTypeID=1</link><pubDate>Fri, 14 Aug 2015 11:39:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8d1b9fc-5974-4992-a007-dee0b41b8c82</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi shyam&lt;/p&gt;
&lt;p&gt;Your assumption is correct, shortcuts are only to use within the same peripheral. With PPI, you can connect an event of one peripheral with a task of another peripheral.&lt;/p&gt;
&lt;p&gt;There should be no problem with using PPI to stop the 16MHz crystal. The PPI does not need the 16MHz crystal, it only needs 16MHz RC. The RTC uses either 32kHz RC or crystal.&lt;/p&gt;
&lt;p&gt;You can see peripheral resource dependency in table 33 in nRF51822_PS v3.1. The PPI is not listed in this table, but it uses 16MHz RC.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 18.8.2015&lt;/strong&gt;
I have attached a code below to show how this is possible&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/rtc0_5F00_triggering_5F00_HFLCK_5F00_start_5F00_and_5F00_stop_5F00_via_5F00_ppi.zip"&gt;rtc0_triggering_HFLCK_start_and_stop_via_ppi.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>