<?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>regarding the sleep mode</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40464/regarding-the-sleep-mode</link><description>hi.......... 
 i am using nrf42840 ...segger 15.2 version 
 i am facing the problem in sleep mode 
 i used the command to sleep 
 static void power_manage( void ) { ret_code_t err_code = sd_app_evt_wait(); APP_ERROR_CHECK(err_code); } but it doesn&amp;#39;t going</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Nov 2018 12:43:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40464/regarding-the-sleep-mode" /><item><title>RE: regarding the sleep mode</title><link>https://devzone.nordicsemi.com/thread/157501?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 12:43:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8375db68-11b9-467f-a31b-bf8285399ffb</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;you do not check the return code, so you are not guaranteed that the function will run successfully.&lt;/p&gt;
&lt;p&gt;A quick workaround can be while(ble_nus_data_send(&amp;amp;m_nus, &amp;quot;hello&amp;quot;, 6, m_conn_handle) != NRF_SUCCESS); within the for loop. Also, I recommend that you use braces to see your scope. ie;&lt;/p&gt;
&lt;p&gt;for(int i=0;i&amp;lt;some_size;i++) &lt;strong&gt;{&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; some_function();&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: regarding the sleep mode</title><link>https://devzone.nordicsemi.com/thread/157428?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 08:59:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40215d68-00d0-4db5-bf90-1cb23fdc223d</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;ok fine .... if i want to send the data for 6 times and it should go to sleep ...for this case shall i use (for loop condition) pls see the code below&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    // Enter main loop.
   for(;;)
    {
    for(i=0;i&amp;lt;=5;i++)
    ble_nus_data_send(&amp;amp;m_nus, &amp;quot;hello&amp;quot;, 6, m_conn_handle);
       power_manage();
        idle_state_handle();
     }
     }
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: regarding the sleep mode</title><link>https://devzone.nordicsemi.com/thread/157422?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 08:50:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:604ccdd6-6436-4fac-b166-c737740085f1</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;You need to be in a connection before sending data over BLE. If your application goes to sleep, without having any wakeup-condition, it will remain in sleep.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: regarding the sleep mode</title><link>https://devzone.nordicsemi.com/thread/157403?ContentTypeID=1</link><pubDate>Thu, 15 Nov 2018 06:18:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b14f61d-5bb9-46b0-8d16-17d151c18d0c</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;ok ..inplace of while(1) .... can i able to put the for condition&amp;nbsp; .i have executed this statement, only one time data executed&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void power_manage( void )
{
    ret_code_t err_code = sd_app_evt_wait();
    APP_ERROR_CHECK(err_code);
	
}





/**@brief Application main function.
 */
int main(void)
{
    bool erase_bonds;

    // Initialize.
    uart_init();
    log_init();
    timers_init();
    buttons_leds_init(&amp;amp;erase_bonds);
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();
    uint32_t i;
     

    // Start execution.
    printf(&amp;quot;\r\nUART started.\r\n&amp;quot;);
    NRF_LOG_INFO(&amp;quot;Debug logging for UART over RTT started.&amp;quot;);
    advertising_start();
     // Enter main loop.
   for(;;)
    {
    for(i=0;i&amp;lt;=5;i++)
    ble_nus_data_send(&amp;amp;m_nus, &amp;quot;hello&amp;quot;, 6, m_conn_handle);
       power_manage();
        idle_state_handle();
     }
     }
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: regarding the sleep mode</title><link>https://devzone.nordicsemi.com/thread/157304?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 13:22:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4180e5bb-3943-47d4-8dca-8d2618815d89</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;for(;;)
{
    while(1)
    ble_nus_data_send(&amp;amp;m_nus, &amp;quot;hello&amp;quot;, 6, m_conn_handle);
    power_manage();
    idle_state_handle();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You have a while-loop inside your main loop, that will continue to send data. You will not enter power_manage or idle_state_handle with the &amp;quot;while(1)&amp;quot; being present.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>