This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
  • I see from the event log that you have replied, edited something and deleted a reply. Also I noticed that the original ticket text is gone. I am not sure whether this was on purpose or not, but just as you know, I can't see anything more in this ticket now, and consider it closed until you update it or reply. 

    NB: We can only see that something is edited, and not what the edit actually was, so the best is to reply instead of editing existing replies.

    Best regards,

    Edvin

  • Hi. Long time no see.  

    Thanks to you,

    we have confirmed the connection between the < ble_app_lbs_nus_its_multi_role> example and

    <ble_app_lbs_nus> examples.  

    I would like to ask another issue.

    I connect the < ble_app_lbs_nus_its_multi_role> example to a mobile phone (nrf toolbox / ios) and the data entered in the uart terminal does not reach the mobile phone (nrf toolbox / ios).

    Connecting the example to a mobile phone (nrf toolbox / ios) and entering data into the uart terminal is successfully sent.

    A. Example <ble_app_lbs_nus_its_multi_role> and the Mobile Connection Screen

    <UART>

    (Tx "DATA SEND")

    <NRF TOOLBOX(ios)>

    not reveive 

    B. Example <ble_app_lbs_nus> and the Mobile Connection Screen

    (Tx "DATA SEND")

    <NRF TOOLBOX(ios)>

    reveived "data send"

    as above I wonder why the ble_app_lbs_nus_its_multi_role example doesn't work.

    Below is the project file I used.

    I used sdk 15.3

    nrf5-ble-multiple-role-example-master.zip

    Thank you. Please.

  • In the case where it doesn't work, what does ble_nus_data_send() return?

  • Hi

    A. <ble_app_lbs_nus_its_multi_role> example  

    Returns 5

    B. <ble_app_lbs_nus> example >   [Normal operation example]

    Returns 0
  • As long as it doesn't return 0, the message is not sent.

    Can you check where in ble_nus_data_send it returns 5? 5 = NRF_ERROR_NOT_FOUND. It should be in ble_nus.c. Either it is 

        if ((conn_handle == BLE_CONN_HANDLE_INVALID) || (p_client == NULL))
        {
            return NRF_ERROR_NOT_FOUND;
        }

    or the softdevice call:

    return sd_ble_gatts_hvx(conn_handle, &hvx_params);

    It may be easiest to debug and set breakpoints to figure out which one it is, since NRF_LOG is not enabled by default. Alternatively you can enable it by setting BLE_NUS_CONFIG_LOG_ENABLED to 1 in sdk_config.h to be able to use NRF_LOG_INFO in ble_nus.c.

    It is a bit tricky to port the ble_app_uart example to support multiple connections. You have to handle all your connection handles correctly. I suggest you take a look in the ble_app_multiperipheral example in SDK\examples\ble_peripheral\experimental\ble_app_multiperipheral.

    Especially in the on_connected() funtion in main, where nrf_ble_qwr_conn_handle_assign() is called in this example. The conn handles is an array. It should be the same in your example. You can also see how it uses the connection handle in led_status_send_to_all().

    Best regards,

    Edvin

Related