This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nrf tools on iphone can not find device

app: nrf tool uart on iphone 5s

sdk: v8.1.0

softdevice: s110

example: ble_app_uart.

i have modify it based on the answer : link text

my advertsing init as follow:

uint32_t      err_code;
ble_advdata_t advdata;
ble_advdata_t scanrsp;

// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type          = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance = false;
advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

// add scan response data
memset(&scanrsp, 0, sizeof(scanrsp));
scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
scanrsp.uuids_complete.p_uuids  = m_adv_uuids;

ble_adv_modes_config_t options = {0};
options.ble_adv_fast_enabled  = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);

but it not usage for iOS nrf tools uart, are there some situations that i not see?

Parents
  • Hi Liu,

    You have to make sure you included the 128bit UUID of the UART service in the advertising packet. The UUID should be included in m_adv_uuids that you added to scanrsp.

    You can try to test again with the ble_app_uart example with no modification. I don't know why you need to modify anything.

  • yes, the example worked. but there is another problem, because i want to have dfu function, so i add files in the project, and modify the define

    #define IS_SRVC_CHANGED_CHARACT_PRESENT 0  
    

    as

    #define IS_SRVC_CHANGED_CHARACT_PRESENT 1
    

    it can also connect,but data can not transfer. debug, the write handle is wrong:

    static void on_write(ble_nus_t * p_nus, ble_evt_t * p_ble_evt)
    

    { ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;

    if (
        **(p_evt_write->handle == p_nus->rx_handles.cccd_handle)**
        &&
        (p_evt_write->len == 2)
       )
    {
        if (ble_srv_is_notification_enabled(p_evt_write->data))
        {
            p_nus->is_notification_enabled = true;
        }
        else
        {
            p_nus->is_notification_enabled = false;
        }
    }
    else if (
             **(p_evt_write->handle == p_nus->tx_handles.value_handle)**
             &&
             (p_nus->data_handler != NULL)
            )
    {
        p_nus->data_handler(p_nus, p_evt_write->data, p_evt_write->len);
    }
    else
    {
        // Do Nothing. This event is not relevant for this service.
    }
    

    }

Reply
  • yes, the example worked. but there is another problem, because i want to have dfu function, so i add files in the project, and modify the define

    #define IS_SRVC_CHANGED_CHARACT_PRESENT 0  
    

    as

    #define IS_SRVC_CHANGED_CHARACT_PRESENT 1
    

    it can also connect,but data can not transfer. debug, the write handle is wrong:

    static void on_write(ble_nus_t * p_nus, ble_evt_t * p_ble_evt)
    

    { ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;

    if (
        **(p_evt_write->handle == p_nus->rx_handles.cccd_handle)**
        &&
        (p_evt_write->len == 2)
       )
    {
        if (ble_srv_is_notification_enabled(p_evt_write->data))
        {
            p_nus->is_notification_enabled = true;
        }
        else
        {
            p_nus->is_notification_enabled = false;
        }
    }
    else if (
             **(p_evt_write->handle == p_nus->tx_handles.value_handle)**
             &&
             (p_nus->data_handler != NULL)
            )
    {
        p_nus->data_handler(p_nus, p_evt_write->data, p_evt_write->len);
    }
    else
    {
        // Do Nothing. This event is not relevant for this service.
    }
    

    }

Children
No Data
Related