<?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>ble_nus_string_send error</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39779/ble_nus_string_send-error</link><description>Hi, I am merging the Thingy app (Segger with softdevice s132_nrf52_4.0.5) with the UART example (taken from ble_app_uart in SDK 11). I have been fixing some errors before getting this error with ble_nus_string_send(&amp;amp;m_nus,data,length). I tracked in the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 24 Oct 2018 12:36:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39779/ble_nus_string_send-error" /><item><title>RE: ble_nus_string_send error</title><link>https://devzone.nordicsemi.com/thread/154286?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 12:36:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6fd4ad1-d0d1-4ee0-8ac8-37eb3d29370c</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;and I already suggested how to approach the problem - but you said you couldn&amp;#39;t do that because of &amp;quot;different SDKs&amp;quot; !?&lt;br /&gt;&lt;br /&gt;I am confused!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error</title><link>https://devzone.nordicsemi.com/thread/154277?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 12:02:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b67c598-0437-46ca-a146-1434a465cafa</guid><dc:creator>Nhiphuc</dc:creator><description>&lt;p&gt;yes, I used the same sdk and it works fine except that i cannot send data with ble_nus_string_send. I have already described the error&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error</title><link>https://devzone.nordicsemi.com/thread/154274?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 11:44:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e96e46d-c44c-499b-85bb-e4f2d5791ce0</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;If you&amp;#39;re merging with the Thingy code, then you&amp;#39;ll need to use the same SDK that the Thingy uses.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error</title><link>https://devzone.nordicsemi.com/thread/154272?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 11:38:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a05ee0c-3641-4379-9c54-ec346bdc8a09</guid><dc:creator>Nhiphuc</dc:creator><description>&lt;p&gt;I do use the uart example in SDK v11 to integrate into thingy app.&lt;/p&gt;
&lt;p&gt;Can you give me a clue on solving my problem with ble_nus_string_send?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error</title><link>https://devzone.nordicsemi.com/thread/154270?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 11:34:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:142214d6-daa6-4e43-8d05-23e585c64892</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Eh??&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;em&gt;each&lt;/em&gt; SDK includes a UART example!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;SDK v11:&amp;nbsp; &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/ble_sdk_app_nus_eval.html?cp=4_0_10_4_2_2_18"&gt;infocenter.nordicsemi.com/.../ble_sdk_app_nus_eval.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error</title><link>https://devzone.nordicsemi.com/thread/154266?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 11:26:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ff89f9b-c356-43a4-a9bc-dc72dff8b819</guid><dc:creator>Nhiphuc</dc:creator><description>&lt;p&gt;Yes, that is what i did. But the problem is the thingy app and the uart example use different SDKs. Even the uart examples themselves are different between different SDKs. In my problem, i used SDK 11 because it is best suit for the thingy app I am using downloaded from this link: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/33599/thingy52-debugging-under-ses"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/33599/thingy52-debugging-under-ses&lt;/a&gt;. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error</title><link>https://devzone.nordicsemi.com/thread/154263?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 11:20:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:096688da-3f31-42b6-aad3-ae53dc7d3ad6</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;You said&amp;nbsp;&lt;span&gt;the ble_app_uart example works alone.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So look at what that&amp;#39;s doing, compare with what &lt;em&gt;your&lt;/em&gt; system is doing ...&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error</title><link>https://devzone.nordicsemi.com/thread/154255?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 11:05:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02a2bd63-57e9-4c51-969a-fd15e47e5612</guid><dc:creator>Nhiphuc</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void thingy_init(void)
{
    uint32_t                 err_code;
    m_ui_init_t              ui_params;
    m_environment_init_t     env_params;
    m_motion_init_t          motion_params;
    m_ble_init_t             ble_params;
    batt_meas_init_t         batt_meas_init = BATT_MEAS_PARAM_CFG;

    ble_nus_init_t nus_init;
    memset(&amp;amp;nus_init, 0, sizeof(nus_init));

    nus_init.data_handler = nus_data_handler;
    
    

    /**@brief Initialize the TWI manager. */
    err_code = twi_manager_init(APP_IRQ_PRIORITY_THREAD);
    APP_ERROR_CHECK(err_code);

    /**@brief Initialize LED and button UI module. */
    ui_params.p_twi_instance = &amp;amp;m_twi_sensors;
    err_code = m_ui_init(&amp;amp;m_ble_service_handles[THINGY_SERVICE_UI],
                         &amp;amp;ui_params);
    APP_ERROR_CHECK(err_code);

    /**@brief Initialize environment module. */
    env_params.p_twi_instance = &amp;amp;m_twi_sensors;
    err_code = m_environment_init(&amp;amp;m_ble_service_handles[THINGY_SERVICE_ENVIRONMENT],
                                  &amp;amp;env_params);
    APP_ERROR_CHECK(err_code);

    /**@brief Initialize motion module. */
    motion_params.p_twi_instance = &amp;amp;m_twi_sensors;

    err_code = m_motion_init(&amp;amp;m_ble_service_handles[THINGY_SERVICE_MOTION],
                             &amp;amp;motion_params);
    APP_ERROR_CHECK(err_code);

    err_code = m_sound_init(&amp;amp;m_ble_service_handles[THINGY_SERVICE_SOUND]);
    APP_ERROR_CHECK(err_code);

    /**@brief Initialize the battery measurement. */
    batt_meas_init.evt_handler = m_batt_meas_handler;
    err_code = m_batt_meas_init(&amp;amp;m_ble_service_handles[THINGY_SERVICE_BATTERY], &amp;amp;batt_meas_init);
    APP_ERROR_CHECK(err_code);    

    err_code = m_batt_meas_enable(BATT_MEAS_INTERVAL_MS);
    APP_ERROR_CHECK(err_code);

    /**@brief Initialize BLE handling module. */
    ble_params.evt_handler       = thingy_ble_evt_handler;
    ble_params.p_service_handles = m_ble_service_handles;
    ble_params.service_num       = THINGY_SERVICES_MAX;

    err_code = m_ble_init(&amp;amp;ble_params);
    APP_ERROR_CHECK(err_code);     

    err_code = m_ui_led_set_event(M_UI_BLE_DISCONNECTED);
    APP_ERROR_CHECK(err_code);

    err_code = ble_nus_init(&amp;amp;m_nus, &amp;amp;nus_init);
    APP_ERROR_CHECK(err_code);

}

//And my main function is like this:
// Initialize.
    APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);
   
    err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);
    
    uart_init();
    
    board_init();     
    thingy_init(); 

    for (;;)
    {
    
        app_sched_execute();       
       
        err_code=ble_nus_string_send(&amp;amp;m_nus,data,length);
  
        if ((err_code != NRF_SUCCESS) &amp;amp;&amp;amp; (err_code != NRF_ERROR_BUSY))
          {
              NRF_LOG_ERROR(&amp;quot;Failed receiving NUS message. Error 0x%x.\n &amp;quot;, err_code);                   
          } 
       
       
        if (!NRF_LOG_PROCESS()) // Process logs
        { 
            power_manage();
        }
    }
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is my initialization failed somewhere and nus service cannot get a good conn_handle?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error</title><link>https://devzone.nordicsemi.com/thread/154248?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 10:51:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b0b4b6a-decc-4101-b8df-7476e15612b3</guid><dc:creator>awneil</dc:creator><description>[quote userid="74735" url="~/f/nordic-q-a/39779/ble_nus_string_send-error"] p_nus-&amp;gt;conn_handle = 0xFFFF[/quote]
&lt;p&gt;I think that means you are not connected (or have lost the connection).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;How to properly post source code:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/1273.Insert-Code-_2D00_-Nordic.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>