<?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>High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23068/high-power-consumption-after-disconnect</link><description>Hi, 
 I&amp;#39;ve just hit a strange issue with SDK 12.1 on nRF52832. 
 Usually on BLE_GAP_EVT_DISCONNECTED , sd_ble_gap_adv_start gets called to start advertising and everything&amp;#39;s great. 
 However, if I don&amp;#39;t call sd_ble_gap_adv_start , advertising stops</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Jun 2017 11:22:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23068/high-power-consumption-after-disconnect" /><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90788?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2017 11:22:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf4cc163-8f02-4ffa-8831-00453e0dfe81</guid><dc:creator>Gordon</dc:creator><description>&lt;p&gt;Found it... I think I&amp;#39;d been distracted by the fact that my devkit was using an early chip, which had some erratas and was exhibiting different behaviour to the production devices.&lt;/p&gt;
&lt;p&gt;The actual issue seemed to be that I called &lt;code&gt;ble_nus_string_send&lt;/code&gt; from &lt;code&gt;SWI1_IRQHandler&lt;/code&gt; if I had data to send. While there was a check for the connection status, the global connection state variable wasn&amp;#39;t volatile, and I &lt;em&gt;think&lt;/em&gt; what was happening was &lt;code&gt;ble_nus_string_send&lt;/code&gt; was getting called during the disconnect.&lt;/p&gt;
&lt;p&gt;Something about that and not enabling the advertising got it into a situation where it wasn&amp;#39;t able to sleep properly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90787?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2017 09:53:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd643eb3-6ccb-4bbf-9c33-0a107ca10b46</guid><dc:creator>Gordon</dc:creator><description>&lt;p&gt;Hmm - that&amp;#39;s strange. I was doing this on an nRF52DK before (it could have been an engineering one), but now doing it on my device the behaviour is different. Normally it&amp;#39;s 0.03mA, then I connect to the UART service via BLE (0.27mA) and send &lt;code&gt;&amp;quot;NRF.sleep()\n&amp;quot;&lt;/code&gt; - 3.75mA. If I send &lt;code&gt;&amp;quot;NRF.disconnect()\n&amp;quot;&lt;/code&gt; it goes through basically the same code path but enables advertising - it drops back to 0.03mA.&lt;/p&gt;
&lt;p&gt;If I comment out the DCDC lines, now the same thing happens (just with ~50% more power draw as you&amp;#39;d expect).&lt;/p&gt;
&lt;p&gt;However, I think I found the issue - I&amp;#39;ll post it up as the answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90779?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2017 08:03:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:646dc25f-f647-41fc-af76-7f5c40f05eac</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Q: So the DCDC converter would still draw the 3mA even if it was just kept on because of some on-chip peripheral?&lt;/p&gt;
&lt;p&gt;A: No, the DCDC convert itself would not draw 3mA, but if some peripheral is waking the CPU up from IDLE mode by generating interrupt constantly, this could explain the current consumption being so high.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;So, when you are testing with and without DCDC, the only difference is &lt;a href="https://github.com/espruino/Espruino/blob/master/targets/nrf5x/bluetooth.c#L1447"&gt;this line 1447 and 1448&lt;/a&gt; ? If you comment out both these lines, what current consumption do you measure then?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90784?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2017 07:10:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7325a7d-30e3-4d06-a332-02ea5c2b94fe</guid><dc:creator>Gordon</dc:creator><description>&lt;p&gt;So the DCDC converter would still draw the 3mA even if it was just kept on because of some on-chip peripheral? Is it a matter of checking every peripheral&amp;#39;s registers individually, or is there one register which aggregates what peripherals are on? As I said above, it&amp;#39;s still spending the same amount of time in &lt;code&gt;sd_app_evt_wait&lt;/code&gt; - so presumably there won&amp;#39;t be any difference in the NVIC registers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90778?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 18:08:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:318d0858-60cf-4fdf-a1bd-6b970f2373e1</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;The &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.Rev1.errata/anomaly_832_79.html?cp=2_1_1_0_1_19"&gt;NFC errata&lt;/a&gt; is still valid on rev.1&lt;/p&gt;
&lt;p&gt;Check what peripherals are active before entering sleep mode (check the peripherals registers). In order to check if a peripheral is waking the CPU up, check for pending interrupts in the NVIC register when you wake up.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90776?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 15:04:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:814e3a73-5527-4b89-b31e-3bdd7a90e450</guid><dc:creator>Gordon</dc:creator><description>&lt;p&gt;Ok, but I am still affected by the NFC errata for some reason? I definitely have the correct components, yes - it will works perfectly normally - it&amp;#39;s just this one instance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90777?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 14:52:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ec63bc2-9336-427c-ab10-4e29710c339c</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;AAB0 is revision 1, so then you should not be affected by the DC/DC errata.&lt;/p&gt;
&lt;p&gt;Are you sure that you have the DC/DC components on your board? [ L3(15 nH), L2(10 µH) and C14(1.0 µF) )?
See page 23 &lt;a href="http://www.raytac.com/download/MDBT42/MDBT42V%20&amp;amp;%20MDBT42V-P-Version%20A.PDF"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90786?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 14:28:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2745c9c-7e4e-4360-8465-9c5e903f9030</guid><dc:creator>Gordon</dc:creator><description>&lt;p&gt;Sorry, but which exact FICR register? I can&amp;#39;t see the top because the module is in a tin can. Reading 0x10000104 (FICR) INFO.VARIANT gives 0x41414230 (AAB0) - but I&amp;#39;m not sure which bits are part, hardware and product. Both the old one and a newer one made just a month ago have the same number though!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90785?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 14:18:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e84b138-a66a-4a7b-817e-2d85f4220907</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;There is an overview &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52%2Fdita%2Fnrf52%2Fcompatibility_matrix%2Fic_revision_overview.html&amp;amp;cp=2_1_2_0"&gt;here&lt;/a&gt;. Packet variant and build code can be read from markings on top of the nRF52 IC.&lt;/p&gt;
&lt;p&gt;Alternatively, it could also be found be reading the FICR register.( &lt;code&gt;NRF_FICR-&amp;gt;INFO.VARIANT&lt;/code&gt; )&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90782?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 14:12:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dfa2957-c0ad-4c3c-97c3-acf047cb7594</guid><dc:creator>Gordon</dc:creator><description>&lt;p&gt;Is there an address I can check to find out exactly which one? The devices that are hit are actually using Raytac MDBT42 modules - there are ~6000 of them out there so I&amp;#39;d hoped they wouldn&amp;#39;t be engineering models. Having said that they definitely require the HAL_NFC_ENGINEERING_BC_FTPAN_WORKAROUND definition for NFC, so it looks like they are either B or C.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90783?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 14:03:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49d402f5-7931-4cce-a070-a5ab6bb9d627</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;What revision of the nRF52832 are you using? If you are using an old revision, it could be &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.EngB.errata/anomaly_832_63.html?cp=2_1_1_2_1_10"&gt;this errata&lt;/a&gt; that is causing the issue. &lt;em&gt;(Engineering B and older)&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90781?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 11:42:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd1a9282-b73b-424e-85c2-3e4f6af8a8c9</guid><dc:creator>Gordon</dc:creator><description>&lt;p&gt;Thanks! Yes, DC/DC is enabled. It seems to stay inside &lt;code&gt;sd_app_evt_wait&lt;/code&gt; most of the time (the same as usual)  so I&amp;#39;m pretty sure that&amp;#39;s not it. The code is based on a whole mix of examples, so I can&amp;#39;t track down one in particular. If it helps, it&amp;#39;s all online (mainly in &lt;a href="https://github.com/espruino/Espruino/blob/master/targets/nrf5x/bluetooth.c)."&gt;github.com/.../bluetooth.c).&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I just tested with/without DC/DC and that&amp;#39;s the problem it seems. Without it&amp;#39;s fine, but when turned on the power usage jumps up when disconnecting and not starting advertising right after. Is there a way around this - Short of turning it off?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High power consumption after disconnect</title><link>https://devzone.nordicsemi.com/thread/90780?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2017 10:53:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e04f606c-0030-41bc-b8a8-8a625301e5d5</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Is this with DC/DC mode enabled?  What example in the SDK is your code based on ? Could be that the CPU is not entering sleep mode, or some interrupt is constantly waking the CPU up from sleep.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>