<?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>Advertising and sleep</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45342/advertising-and-sleep</link><description>I tried searching for this response but cant find exact answer 
 SDK15.2 and API6.1 
 I am trying to have an advertiser but would like to put it in some sleep mode and advertise. if i do sd_power_system_off() it turns off until i hit the wake GPIO. I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 03 Apr 2019 15:33:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45342/advertising-and-sleep" /><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/180077?ContentTypeID=1</link><pubDate>Wed, 03 Apr 2019 15:33:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92bb4b26-36e7-4859-91a2-40302d58a041</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The only possible wakeup sources from System OFF is described in the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html?cp=2_1_0_17_1#unique_1707892264"&gt;documentation&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/180059?ContentTypeID=1</link><pubDate>Wed, 03 Apr 2019 14:49:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fb3cff1-6e13-4fd4-96ed-a6109339539b</guid><dc:creator>dmleone</dc:creator><description>&lt;p&gt;yes i think iwas able to correct this issue. I think this was an issue with being new to nRF and the examples. I was establishing 2 NRF_OBSERVERS to do the same thing. 1 in my _DEF() and 1 in the advertising_init(). After i removed the observer in the advertising_init() things cleared up.&lt;/p&gt;
&lt;p&gt;if i put the system in sd_power_off(), and never trigger the wake_on pin, is there anything else that can wake the system up to scan or anything? or the only way wake it up from sd_power_off() is a physical interaction of sorts. Meaning it just sitting there isnt going to wake up on its own randomly and then go back to power_off?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/180058?ContentTypeID=1</link><pubDate>Wed, 03 Apr 2019 14:44:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90333d16-66c2-40f4-89fa-d8fa817dbc5d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Did you configure the link conts using defines NRF_SDH_BLE_PERIPHERAL_LINK_COUNT and NRF_SDH_BLE_CENTRAL_LINK_COUNT in the sdk_config.h file? Did you also increase NRF_SDH_BLE_TOTAL_LINK_COUNT to the sum of the two last parameters? It is the last parameter that is used to configure the allowed link count for the softdevice. You get an event whenever a connection is established and disconnected, so you should be able to keep track of how many connections are active at any time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/179067?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 19:46:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7be7e6ca-bc57-4211-bdac-f7afbda5d011</guid><dc:creator>dmleone</dc:creator><description>&lt;p&gt;I got it to error in a way I am hoping can explain why it goes into this non shutdown state.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;System goes like this:&lt;/p&gt;
&lt;p&gt;2 boards: button board and motor board&lt;/p&gt;
&lt;p&gt;push button on button board and it scans, connects, sends turn motor command&lt;/p&gt;
&lt;p&gt;motor board after receiving turn motor command, turns motor and sends done command back to button board&lt;/p&gt;
&lt;p&gt;button board having received done command, disconnects.&lt;/p&gt;
&lt;p&gt;If the motor board remains connected for longer than 10 seconds, it will disconnect on its own.&lt;/p&gt;
&lt;p&gt;I have a debug LED that turns on when the motor board enters BLE_GAP_EVT_CONNECTED and it turns off when it calls BLE_GAP_EVT_DISCONNECTED.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The system appears to work if i do not turn the command. If i receive the command and respond ignoring the motor turn command&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the following section I get a&amp;nbsp;NRF_ERROR_CONN_COUNT&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void advertising_start(bool erase_bonds)
{
    ret_code_t err_code = NRF_ERROR_INVALID_STATE;

    if (erase_bonds == true){
        delete_bonds();
        // Advertising is started by PM_EVT_PEERS_DELETED_SUCEEDED event
    }else{
        if(!is_advertising){
          err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);      /**&amp;lt; Follows ble_app_blinky example */
          APP_ERROR_CHECK(err_code);

          is_advertising = true;
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have my peripheral count set to 7 and central count set to 1 in the sdk_config file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Am I making multiple connections or something that is eating into my connected count or is there a disconnect all function that will reset everything. Because once it goes into this state, even after brownout and reset, it does not go into low power mode again. I HAVE to disconnect power and restart it and it will start in low power mode (0.6mA) for a couple cycles but will always ned using 8mA eventually and only way to stop it is to remove power.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178880?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 10:21:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7939e33f-2b57-4aa4-acaa-6f796d78e816</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I&amp;#39;m not aware of any ways to detect that the device is restarted due to a brownout reset. &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html?cp=2_1_0_17_7#unique_832471788"&gt;All peripherals are reset&lt;/a&gt; similar to a power on reset. The device should still be able to enter low power mode by calling the correct sleep functions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178802?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 23:24:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97ba8cee-f634-4d6f-819b-5ff581113f7d</guid><dc:creator>dmleone</dc:creator><description>&lt;p&gt;Is there a way to check if the system did a brown out reset? When i turn the motor on it drops the input voltage a lot and sometimes causes the chip to reset. When it comes back from brown out reset though, it does not return to low power mode like if I turn power off and back on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178734?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 14:54:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c727d00-54b4-4676-9151-2528ae608977</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;&lt;span&gt;APP_ERROR_CHECK() can be used for final product as well, to reset the device if unexpected errors happen, but you should verify that your product does not generate errors during development phase.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;m not sure I understand, is there a connection between the button board and the motor board? I don&amp;#39;t see the point in calling the disconnect function on both sides, calling it on one side should be enough. Like you say, you could get in a situation where the softdevice receive disconnect from other side of link right after checking&amp;nbsp;m_conn_handle != BLE_CONN_HANDLE_INVALID, resulting in an error code being reported since no connection is available.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178676?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 13:09:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3e53a38-0994-45ef-bdb4-6a070e0737a4</guid><dc:creator>dmleone</dc:creator><description>&lt;p&gt;Are APP_ERROR_CHECK() simply for debugging and prototyping? I feel like i am getting in race conditions.&lt;/p&gt;
&lt;p&gt;I have 2 boards. button board and motor board.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void tb_ble_power_off(void)
{
    uint32_t err_code;
    
    if(m_conn_handle != BLE_CONN_HANDLE_INVALID){
        err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
        APP_ERROR_CHECK(err_code);
    }
&lt;/pre&gt;If they both try and power_off at the same time can they both pass through that if statement but only 1 succeed?&lt;/p&gt;
&lt;p&gt;I want to have the button board to do the disconnecting, but if something wonky happens and the motor boards remains connected for longer than 10 seconds, i want it to disconnect from whatever it is connected to.&lt;/p&gt;
&lt;p&gt;Also what would cause an NRF_ERROR_IVALID_STATE top be thrown on the scanner here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
            // Accept parameters requested by peer.
            if (m_conn_handle != BLE_CONN_HANDLE_INVALID){
                err_code = sd_ble_gap_conn_param_update(p_gap_evt-&amp;gt;conn_handle,
                                            &amp;amp;p_gap_evt-&amp;gt;params.conn_param_update_request.conn_params);
                APP_ERROR_CHECK(err_code);
            }
            break;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178428?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 14:37:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52ee9038-a9c9-47cc-8f77-330c346bcc22</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;If you pass an error to APP_ERROR_CHECK, the application will jump to the error handler function. If you have set the &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/10729/my-device-is-freezing-and-restarting"&gt;DEBUG flag&lt;/a&gt;, you will be stuck in a loop here until manually resetting the chip. This would explain your high current consumption.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178396?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 13:59:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14b5f75e-133b-4693-8ef2-0b3753e30f7c</guid><dc:creator>dmleone</dc:creator><description>&lt;p&gt;I am using the ble_app_blinky and ble_app_blinky_c examples as a base. I am not using an eval board but rather my PCB so have a custom bsp file. I have a button on 1 PCB and a motor on the other. I want to turn motor when i push the button. So the LED transfer data i changed to a uint8_t command. and that is pretty much it. Added some lines of code in the CONNECTED and DISCONNECTED ble_evt_handler to turn motor. but nothing that should keep it on.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i work off all handlers so my main for loop is still the same as the example. and the only thing I added to the idle_state_handler was the sd_app_evt_wait().&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I did reset the chip and it appears to drop to 0.6mA but after i do a couple connects and disconnects and turn the motor once or twice the current jumps back up to 8mA.&lt;/p&gt;
&lt;p&gt;also, it appears when the current does not drop i loose function in my button board until i do a hard reset on it. SO i think it does not fully disconnect. Even though DISCONNECTED gets called because LED turns off showing it reached DISCONNECTED in ble_evt_handler.&lt;/p&gt;
&lt;p&gt;Debugging more on the button PCB i keep getting NRF_ERROR_INVALID_STATE&amp;nbsp;in the following APP_ERROR_CHECK().&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I do the following. button board on button press wakesup from sd_power_off() and scans. after connecting, it sends command to motor PCB. motor PCB turns motor and and after completes sends a completed action command back to button board. button board should than disconnect. however when sending a repsonse back i get the param update error.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
            // Accept parameters requested by peer.
            if (m_conn_handle != BLE_CONN_HANDLE_INVALID){
                err_code = sd_ble_gap_conn_param_update(p_gap_evt-&amp;gt;conn_handle,
                                            &amp;amp;p_gap_evt-&amp;gt;params.conn_param_update_request.conn_params);
                APP_ERROR_CHECK(err_code);
            }
            break;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178369?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 13:12:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6644f819-49fc-404b-b65a-f0c2ebf7cba0</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Sounds like you are not going to sleep, the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/cpu.html?cp=2_1_0_6_1#topic"&gt;&lt;span&gt;CPU&lt;/span&gt;&lt;/a&gt; will consume ~7-8 mA when running if you have not enabled the DCDC converter. Try resetting the board before measuring current to make sure the chip is not in debug mode, this will give you increased current consumption, as the CPU is needed by debugger to read registers. Which example are you running, and what changes have you done?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178364?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 13:05:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28c8ea83-d73f-402d-b4e7-9ebc4f711e9f</guid><dc:creator>dmleone</dc:creator><description>&lt;p&gt;Is there something i am missing here. that may be mis representing actual results&lt;/p&gt;
&lt;p&gt;I am running the code in debug mode and i am pulling 8mA of current. I am re-writing some code and right now all it is doing is is sitting there advertising, yet i am pulling 8mA whereas before i was pulling 0.8mA. How do i adjust the advertising duration ands interval with respect to the scanner so as I can achieve an advertisement.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tried adjusting the APP_ADV_DURATION and APP_ADV_INTERVAL but if i adjust those from the values to shorter ones to reduce current draw, i cannot see them advertising in the nRF connect app.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How can i choose proper ADV and SCAN DURATION, INTERVALS and WINDOWS so that i can get best power consumption&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178316?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 11:44:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffdd7faf-7572-4e69-9e55-de8ebc97e5aa</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Put it in idle_state_handler. As long as you do not have any blocking loops in your application, the application will enter the idle_state_handler when there is no more work to be done, allowing the CPU to go to sleep. This is what we do in all our BLE examples in the SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178310?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 11:31:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f0c9d66-6775-46e5-aa79-13c92b73d89f</guid><dc:creator>dmleone</dc:creator><description>&lt;p&gt;Do i have to call sd_app_evt_wait() after each time i send advertising? or if during the BLE_GAP_EVT_DISCONNECTED call i do the following, would it go into semi sleep advertising cycles? or do i need to put it in the&amp;nbsp;idle_state_handle()?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;case BLE_GAP_EVT_DISCONNECTED:
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
            
            err_code = sd_app_evt_wait();
            APP_ERROR_CHECK(err_code);

            advertising_start(false);
            break;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advertising and sleep</title><link>https://devzone.nordicsemi.com/thread/178286?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 10:09:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24c4ddc6-2aeb-4f7f-9298-e72ffb8dc931</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It is not possible to advertise when you are in deep sleep. In system off mode, all clock sources will be turned off, and you will only be able to wake on certain peripherals (reset, GPIO, NFCT, LPCOMP).&lt;/p&gt;
&lt;p&gt;It is also not possible to &amp;quot;&lt;span&gt;advertise and sleep at the same time&amp;quot;. You can enter system on idle mode between advertising events, but the chip will wake up to process and prepare advertising, as the CPU is required to start the advertising and setup buffers, etc.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Running&amp;nbsp;sd_app_evt_wait() in the main-loop is the correct way to enter lowest possible sleep mode while doing advertising and receive connection events.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>