<?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>Timeslot API - low power optimization</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6869/timeslot-api---low-power-optimization</link><description>Hello, 
 I&amp;#39;m working with timeslot API (basing on github.com/.../observer) . I have an advertising and active scanning running concurrently. However, I want to completly switch off scanning functionality for some period of time. For example, I want to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 May 2015 06:23:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6869/timeslot-api---low-power-optimization" /><item><title>RE: Timeslot API - low power optimization</title><link>https://devzone.nordicsemi.com/thread/24212?ContentTypeID=1</link><pubDate>Thu, 14 May 2015 06:23:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:473ee7e3-b79c-4f80-a223-8d7747a6899f</guid><dc:creator>adriand</dc:creator><description>&lt;p&gt;@hungbui: ok. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timeslot API - low power optimization</title><link>https://devzone.nordicsemi.com/thread/24211?ContentTypeID=1</link><pubDate>Wed, 13 May 2015 12:16:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bf8e7ff-3459-4643-91f7-c953c75fa509</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@adriand: I am not aware of similar issue.
I suggest you to create a new case for the issue and accept the answer for this case.
You can try to debug by checking if the radio is on when scaning is enabled when issue occurs by measuring the current consumption.&lt;/p&gt;
&lt;p&gt;In your question for this issue, you may need to add more information on how you configure the radio, the scanning window, the timeslot interval and the advertising interval.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timeslot API - low power optimization</title><link>https://devzone.nordicsemi.com/thread/24210?ContentTypeID=1</link><pubDate>Wed, 13 May 2015 07:29:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1ef6e31-a186-44e4-a57c-f0cb2147b4ea</guid><dc:creator>adriand</dc:creator><description>&lt;p&gt;@hungbui: ok, thanks! I also overlooked that. However I have one more question - sometimes scanning stops. Advertising is working, disabling / enabling scanning is being performed however scanner doesn&amp;#39;t &amp;quot;see&amp;quot; any packets and no errors are produced (asserts are ok). Event radio events (8, 4) are showing. I don&amp;#39;t know to debug it. I know this is not so specific description of the problem, but maybe you came across that kind of issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timeslot API - low power optimization</title><link>https://devzone.nordicsemi.com/thread/24207?ContentTypeID=1</link><pubDate>Tue, 12 May 2015 12:41:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29c51b95-1ee0-4e90-b8b9-0939b300bb74</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Adriand: I&amp;#39;m sorry that I didn&amp;#39;t noticed it before. The reason you got high power consumption was due to issue #39 described in the nRF51822 PAN (Product Anomaly product) document where GPIO_TASK would consume higher power than it should.&lt;/p&gt;
&lt;p&gt;This issue&amp;#39;s fixed on chip version 3. The chip on your PCA10004 is most likely chip version 2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timeslot API - low power optimization</title><link>https://devzone.nordicsemi.com/thread/24209?ContentTypeID=1</link><pubDate>Fri, 08 May 2015 10:53:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31b9398d-9f84-4ae1-88d9-5b9fb248cdf2</guid><dc:creator>adriand</dc:creator><description>&lt;p&gt;Ok, I suppose I found the problem, but I doubt if I solved it correctly. In the file ll_scan.c in function ll_scan_start() I commented out every line that has GPIOTE-&amp;gt;CONFIG:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  /* Toggle pin when radio reaches END (RX or TX) */
  // NRF_GPIOTE-&amp;gt;CONFIG[DBG_RADIO_END] = ..

  /* Toggle pin when radio reaches READY (RX or TX) */
  // NRF_GPIOTE-&amp;gt;CONFIG[DBG_RADIO_READY]= ..

   /* Toggle pin when timer triggers radio START (TX) */
   // NRF_GPIOTE-&amp;gt;CONFIG[DBG_RADIO_TIMER] = ..
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;maybe it&amp;#39;s strange but it works (only several minutes test): advertising works, disabling / enabling scanner works, connecting works. And current consumption is ok.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timeslot API - low power optimization</title><link>https://devzone.nordicsemi.com/thread/24208?ContentTypeID=1</link><pubDate>Fri, 08 May 2015 09:51:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d97dfb2-0bbd-4f7a-9ea5-71a09b21277c</guid><dc:creator>adriand</dc:creator><description>&lt;p&gt;Thanks. Ok, I tried your last hint, but it seems that HFCLK is enabled after scanner is enabled and disabled after scanning stops. So it&amp;#39;s rather not HFCLK. I also checked debug (I disconnect jlink and manage power reset), uart for logging is also disabled. I tried multiactivity beacon with hrs and it seems to be ok - power consumption is about 0.01mA after scanning stops. I will try to compare source codes. The first diffrence I can see is that GPIOTE is being used (&lt;strong&gt;ll_scan_start()&lt;/strong&gt;) in the observer example and there&amp;#39;s not in multiactivity+hrs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timeslot API - low power optimization</title><link>https://devzone.nordicsemi.com/thread/24206?ContentTypeID=1</link><pubDate>Thu, 07 May 2015 14:05:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4abf624-29bf-4d83-80af-eabb50fae3ef</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@adriand: I would suggest you to use the register directly to control the HFCLK instead of using sd_* api because the application has full control of radio, HFCLK when in its timeslot.
What you can do is to start the HFCLK crystal using this code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (!(NRF_CLOCK-&amp;gt;HFCLKSTAT &amp;amp; CLOCK_HFCLKSTAT_SRC_Msk))

{

  NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;

  NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;

  while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0);

}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then stop the HFCLK after you finish scanning using :&lt;/p&gt;
&lt;p&gt;NRF_CLOCK-&amp;gt;TASKS_HFCLKSTOP = 1;&lt;/p&gt;
&lt;p&gt;Another thing can cause high current consumption is the debug mode. You need to make sure you power off and on the device at least once after you program the chip, otherwise it will remain in debug mode.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timeslot API - low power optimization</title><link>https://devzone.nordicsemi.com/thread/24205?ContentTypeID=1</link><pubDate>Thu, 07 May 2015 12:05:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd4fc607-4a38-484a-a908-9db4d17fb2bc</guid><dc:creator>adriand</dc:creator><description>&lt;p&gt;@hungbui thank you for your input. I didn&amp;#39;t think about it before. However, it looks like HFCLK is always disable.
I put following code into while in the main:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while(1){ 
	btle_err_code = sd_clock_hfclk_is_running(&amp;amp;hf);	
	ASSERT (btle_err_code == NRF_SUCCESS);			
	if(hf==0)
		__LOG(&amp;quot;DISABLED&amp;quot;);
	else
		__LOG(&amp;quot;ENABLED&amp;quot;);

	sd_app_evt_wait();

	if(sw_interrupt()){
           		//handling adv and resp packets
     }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and &lt;strong&gt;hf&lt;/strong&gt; is always 0. Is there any other way to check HFCLK (when SD is being used)? However, regardless of checking if HFCLK is working, I tried to invoke &lt;strong&gt;sd_clock_hfclk_release()&lt;/strong&gt; after scanning disable, but it didn&amp;#39;t change anything.&lt;/p&gt;
&lt;p&gt;Maybe I should mention that I changed BLE stack initialization than it is made in timeslot example. I&amp;#39;m using: SOFTDEVICE_HANDLER_INIT(20ppm, false); defined BLE_STACK_SUPPORT_REQD&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timeslot API - low power optimization</title><link>https://devzone.nordicsemi.com/thread/24204?ContentTypeID=1</link><pubDate>Tue, 05 May 2015 12:22:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a6ad512-e0f3-46f6-993a-9b3cdd100392</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@adriand : Have you tried to disable the HFCLK crystal after you disable scaning ?&lt;/p&gt;
&lt;p&gt;It seemed that when you request the timeslot with earliest possible type, the HFCLK crystal was kept running and hadn&amp;#39;t been turned off after you finish.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>