<?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>Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50694/proximity-example---power-profiling-sits-at-baseline-2-7ma-and-does-not-sleep-between-advertisements</link><description>Hi, 
 My stack is 
 
 s112 
 SDK 15.3 
 Segger 
 nrfConnect 
 nrf52832 DK 
 Power profiler kit connected via USB to my MAC to get the traces to run. 
 CR2032 batter removed 
 SB9 solder jumper cut 
 
 I have my code effectively running on the uP as I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 Aug 2019 19:17:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50694/proximity-example---power-profiling-sits-at-baseline-2-7ma-and-does-not-sleep-between-advertisements" /><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/203684?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2019 19:17:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e659ffa1-5fb1-412a-8a75-6dec2a38668d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Glad to hear! We prefer if you post your questions as separate threads on DevZone. If you would like to avoid posting the question in public, there is a private option when you create the ticket. If you want to ask something specific to me, you can mention that in the case, but we normally distribute the tickets internally based on who is most capable to answer the specific topic!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/203671?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2019 16:48:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f2a9fa7-88a5-4120-9799-4007eb3b9f9f</guid><dc:creator>DW</dc:creator><description>&lt;p&gt;Thank you &lt;em&gt;J&amp;oslash;rgen&lt;/em&gt;. Everything has fallen into place. I should be able to reduce that current draw on PIN 16 as per the&amp;nbsp;discussion board &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/10970/decrease-i-o-pull-up-current-consumption"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Testing tonight!&lt;/p&gt;
&lt;p&gt;&lt;em&gt;J&amp;oslash;rgen&amp;nbsp;&lt;/em&gt;- Could I reach out to you with another question, privately?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/203617?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2019 13:36:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57a9d78f-33f2-40fa-8450-e936b0c52d4b</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The size of the current sounds like it could correspond to a current flowing through your pullup resistor (~13kOhm, which would give ~230 uA @ 3.0V).&lt;/p&gt;
&lt;p&gt;By default, the DK has BUTTON4 connected to P0.16. Have you connected anything else to the pin? The switch on the DK is active low.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/203417?ContentTypeID=1</link><pubDate>Sat, 10 Aug 2019 02:27:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3857c180-e7b7-4656-a4fa-308e4d12d5c1</guid><dc:creator>DW</dc:creator><description>&lt;p&gt;&lt;span&gt;Once again thank you J&amp;oslash;rgen,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have&amp;nbsp;implemented the&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;    NRF_POWER-&amp;gt;DCDCEN = 1;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;to select the lower power use of DCDC and understand that if it drops below 2.1v I should&amp;nbsp;switch it off. I can see that the individual advertising spikes are lower, which is great. However I was still at 230uA. So for the past evening I thought I must, by process of elimination, work out what is doing it.&amp;nbsp;&lt;/span&gt;So I started completely fresh, with the ble_app_template app and added my services one by one, testing the power profile as each service was added. The lls and bas services were added and power behaved beautifully. It is when I added my GPIOTE event, that the current runs high.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The specific lines of code that do it are&amp;nbsp;in the gpio initialisation done in switch_int()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void switch_init(void)
{
    ret_code_t err_code;

	//Initialize gpiote module
    //NRF_LOG_INFO(&amp;quot;Initialize gpiote module&amp;quot;);
    if(!nrf_drv_gpiote_is_init())
        {
        err_code = nrf_drv_gpiote_init();
        APP_ERROR_CHECK(err_code);  
        }    
    //Configure sense input pin
    nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);                                //Configure to generate interrupt and go to system_off on pin signal high. &amp;quot;false&amp;quot; means that gpiote will use the PORT event, which is low power, i.e. does not add any noticable current consumption (&amp;lt;&amp;lt;1uA). Setting this to &amp;quot;true&amp;quot; will make the gpiote module use GPIOTE-&amp;gt;IN events which add ~8uA for nRF52 and ~1mA for nRF51.
    in_config.pull = NRF_GPIO_PIN_PULLUP;                                                                       //Configure pullup for input pin to prevent it from floating. Pin is pulled down when button is pressed on nRF5x-DK boards, see figure two in http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52/dita/nrf52/development/dev_kit_v1.1.0/hw_btns_leds.html?cp=2_0_0_1_4		
    err_code = nrf_drv_gpiote_in_init(SWITCH_PIN, &amp;amp;in_config, in_pin_debounce_handler);  				//Initialize the pin with interrupt handler in_pin_handler

    //NRF_LOG_INFO(&amp;quot;Intiate the PIN to detect switch opening: Error code on gpiote_in_init is %d..&amp;quot;, err_code);
    //APP_ERROR_CHECK(err_code);                                                          			//Check potential error
    //nrf_drv_gpiote_in_event_enable(SWITCH_PIN, true);                                                           //Enable event and interrupt for the wakeup pin
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I have not enabled the switch detection in the final line, as it is specifically the&amp;nbsp;nrf_drv_gpiote_in_init command, configured as I have configured it above, that sends the current usage up.&lt;/p&gt;
&lt;p&gt;I understood that by setting&amp;nbsp;GPIOTE_CONFIG_IN_SENSE_LOTOHI(false) to &amp;quot;false&amp;quot; I was using a low power PORT event.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I call this gpio initialisation from main&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
/**@brief Function for application main entry.
 */
int main(void)
{
    bool erase_bonds;

    // Initialize.
    
    NRF_POWER-&amp;gt;DCDCEN = 1;
    log_init();
    timers_init();
    //buttons_leds_init(&amp;amp;erase_bonds);
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    advertising_init();
    services_init();
    conn_params_init();
    peer_manager_init();

    // Start execution.
    NRF_LOG_INFO(&amp;quot;Template example started.&amp;quot;);
    application_timers_start();
    tx_power_set();
    advertising_start(erase_bonds);
    switch_init();

    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Looking further tonight and analysing the Power Profiler Kit, by running switch_init() the 230uA level is I think caused by something &amp;nbsp;triggering every 25ms resulting in the jagged baseline?&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/something_2D00_is_2D00_triggering_2D00_every_2D00_25ms.png" /&gt;&lt;/p&gt;
&lt;p&gt;Have also used the online power profiler kindly provided by Nordic&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/online_2D00_power_2D00_profiler.png" /&gt;&lt;/p&gt;
&lt;p&gt;using the variables of&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;voltage : 3&lt;/li&gt;
&lt;li&gt;DCDC regulator now enabled&lt;/li&gt;
&lt;li&gt;LF Clock on the development board is External crystal as set in the sdk_config.h
&lt;ul&gt;
&lt;li&gt;
&lt;pre&gt;#define NRF_SDH_CLOCK_LF_SRC 1&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;pre&gt;#define NRFX_CLOCK_CONFIG_LF_SRC 1&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;pre&gt;#define CLOCK_CONFIG_LF_SRC 1&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Advertising interval is 2.022 seconds
&lt;ul&gt;
&lt;li&gt;
&lt;pre&gt;#define APP_ADV_INTERVAL                3236                                    /**&amp;lt; The advertising interval 2.022 seconds. */&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;TX Payload I have yet to calculate so I&amp;#39;ve maxed it out to 31&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The anticipated current should be 7.8uA. It&amp;#39;s definitely this 25ms tick that my code has which is creating the unwanted 230uA. As I added the lls and bas the baseline was smooth&lt;/p&gt;
&lt;p&gt;Any advice gratefully received.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Best DW&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/202990?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 09:01:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6220fd13-5f6e-456e-a722-b724267cfef2</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;If it is not initialized in the code, those peripherals should not cause increased current consumption from being enabled in the sdk_config.h file.&lt;/p&gt;
&lt;p&gt;I would recommend that you check if your average current is in line with the expected currents from the &lt;a href="https://devzone.nordicsemi.com/nordic/power/"&gt;Online Power Profiler&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Enabling the DCDC converter would also reduce the average current quite a lot.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/202958?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 06:44:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7b78da1-c1e5-41a6-a6e4-2cac579db321</guid><dc:creator>DW</dc:creator><description>&lt;p&gt;Once again thank you. The power profile kit is now averaging 230uA. Can I disable other things I think I&amp;#39;m just not using scuh as the the UART, CRYPTO,&amp;nbsp;CLOCK peripheral driver, Peripheral Resource Sharing module, FPRINTF module?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/202850?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 13:37:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:605d574f-124e-461a-8e1a-6f5468262944</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Try to also disable the logger:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// &amp;lt;e&amp;gt; NRF_LOG_ENABLED - nrf_log - Logger
//==========================================================
#ifndef NRF_LOG_ENABLED
#define NRF_LOG_ENABLED 0
#endif&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/202849?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 13:34:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca042098-ec6f-4f4a-9bcd-d1e6a18dc37d</guid><dc:creator>DW</dc:creator><description>&lt;p&gt;Thank you J&amp;oslash;rgen,&lt;/p&gt;
&lt;p&gt;This is a huge improvement to circa 750uA (ish). The advertising, connecting and connected trace is below.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ADVinterval_2D00_6000ticks_2B00_SL_2D00_0_2B00_TX_2D002D00_20db.png" /&gt;&lt;/p&gt;
&lt;p&gt;Any other suggestions to further reduce the current draw?&lt;/p&gt;
&lt;p&gt;Best,&lt;/p&gt;
&lt;p&gt;DW&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/202774?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 09:19:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:441a5267-d809-4189-91af-a5aef20bb825</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I believe this is caused by the SAADC that is used for battery voltage measurement in the example.&lt;/p&gt;
&lt;p&gt;Please try enabling low power mode by setting the following in your sdk_config.h file:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// &amp;lt;q&amp;gt; SAADC_CONFIG_LP_MODE  - Enabling low power mode
 

#ifndef SAADC_CONFIG_LP_MODE
#define SAADC_CONFIG_LP_MODE 1
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/202705?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 22:07:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d98289c5-1258-4d4a-a138-ca8596f72020</guid><dc:creator>DW</dc:creator><description>&lt;p&gt;Hi cbd,&lt;/p&gt;
&lt;p&gt;Thanks for the super fast response.&lt;/p&gt;
&lt;p&gt;I have updated the following setting and re-run&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;#define APP_ADV_INTERVAL 3236 /**&amp;lt; The advertising interval 2.022 seconds. */&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/ADVinterval_2D00_3236ticks_2B00_SL_2D00_0_2B00_TX_2D002D00_20db.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So advertising seems to idle the CPU at 2.5mA&lt;/p&gt;
&lt;p&gt;It is almost as though the sd_app_evt_wait(); never sends the CPU to sleep and prefers to run the CPU at 2.5mA between advertising transmissions?&lt;/p&gt;
&lt;p&gt;i.e.&lt;br /&gt; __WFE();&lt;br /&gt; // Clear the internal event register.&lt;br /&gt; __SEV();&lt;br /&gt; __WFE();&lt;/p&gt;
&lt;p&gt;is never called in the SDK code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proximity Example - Power profiling sits at baseline 2.7mA and does not sleep between advertisements</title><link>https://devzone.nordicsemi.com/thread/202610?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 12:26:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64018e35-a6c1-4c26-bddc-2d16ae85e588</guid><dc:creator>cbd</dc:creator><description>&lt;p&gt;Your advertising rate seems pretty fast. This could be the issue.&lt;/p&gt;
&lt;p&gt;To save power you should extend your advertising period out. Try setting setting it to something like 350 - 500ms and you&amp;#39;ll probably see the average consumption drop.&lt;/p&gt;
&lt;p&gt;When advertising, not only are you drawing power to transmit, but also for the period immediately after where your are listening for a response requesting a connection. This differs to a beacon which doesn&amp;#39;t expect a response. This is why advertising is typically limited to 30 seconds or less.&lt;/p&gt;
&lt;p&gt;If the advertising rate is fast enough the soft device will never put the chip into a low power mode as the transmit and receive periods will merge.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>