This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
Parents
  • Hello,

    What SDK version do you use? Can you check what the on_adv_report() does when it picks up the advertisements from the phone? You can also see inside this function what it is looking for, whether it is a UUID or an advertising name (or something else). 

    It is a bit hard to pinpoint exactly where it checks for this, as it differs between the different SDK versions, but do a search for "on_adv_rep" in your project, and see if you can find out what function that is called when the scanner receives an advertisement report.

  • Thank you for answer.
    I am using s132 on pca10040 in version 15.3.
    I am using the nrf52832 chip.
    
    It is difficult to verify that the on_adv_rep function works
    Peripheral is the uart, Central is the.
    I tried to match UUID and device_name but it does not work. Help
  • I assume that you use the Segger Embedded Studio (SES) projects?

    Do you see the logging information in SES?

     

    cjb21 said:

    I have built and tested a peripheral example on another dk board,

    My dk board does not connect to central mode.

     What do you mean? It doesn't connect to a central or it doesn't connect to a peripheral? I have tested both cases, and it does. Not the phone advertising, but the ble_app_lbs_nus_its_multi_role example connects to both the ble_app_lbs_nus and the ble_app_lbs_nus_c example.

    Did you do any changes to any of the examples?

    You use the correct projects, right? The pca10040 ones?

  • 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
Reply Children
  • 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

  • Thank you for answer.

    Found a place to return 5. Within the ble_nus.c file.

    This is the statement in the ble_nus_data_send () function.

    err_code = blcm_link_ctx_get (p_nus-> p_link_ctx_storage, conn_handle, (void *) & p_client);

    See the screenshot below.

    Thank you

  • Yes. It is the reason I explained in the previous answer. You are not sending a valid connection handle into ble_nusdata_send(). Look at the multiperipheral example how it should be done.

  • Thank you. Where can I get a multiperipheral example?

  • Edvin said:
    SDK\examples\ble_peripheral\experimental\ble_app_multiperipheral.
Related