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

Related to BLE lon range

Dear nordic

I changed my BLE application to coded phy for long range (chip used nrf52840) . application works fine(debug). 

But i cant see any advertising  in smart phone BLE appliation's 

I need a help to see my device advertising packet . I think device advertising has no problem but its not seen in smart phones  

can you help me to find out why smart phone not detect the advertisings.

is it any other way to find device properly advertise or not?

need some helps

Parents Reply Children
  • Thanks for your reply i need one more help i tested BLE central relay example for long range 

    i dont know it is right procedure to setting

    can you check that?

    I changed in ble_advertising .c like below(bolded below)

    uint32_t ble_advertising_init(ble_advertising_t * const p_advertising,
    ble_advertising_init_t const * const p_init)
    {
    uint32_t ret;
    if ((p_init == NULL) || (p_advertising == NULL))
    {
    return NRF_ERROR_NULL;
    }
    if (!config_is_valid(&p_init->config))
    {
    return NRF_ERROR_INVALID_PARAM;
    }

    p_advertising->adv_mode_current = BLE_ADV_MODE_IDLE;
    p_advertising->adv_modes_config = p_init->config;
    p_advertising->conn_cfg_tag = BLE_CONN_CFG_TAG_DEFAULT;
    p_advertising->evt_handler = p_init->evt_handler;
    p_advertising->error_handler = p_init->error_handler;
    p_advertising->current_slave_link_conn_handle = BLE_CONN_HANDLE_INVALID;
    p_advertising->p_adv_data = &p_advertising->adv_data;

    memset(&p_advertising->peer_address, 0, sizeof(p_advertising->peer_address));

    // Copy advertising data.
    if (!p_advertising->initialized)
    {
    p_advertising->adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;
    }
    p_advertising->adv_data.adv_data.p_data = p_advertising->enc_advdata;
    p_advertising->adv_data.adv_data.len = BLE_GAP_ADV_SET_DATA_SIZE_MAX;

    ret = ble_advdata_encode(&p_init->advdata, p_advertising->enc_advdata, &p_advertising->adv_data.adv_data.len);
    VERIFY_SUCCESS(ret);

    if (&p_init->srdata != NULL)
    {
    p_advertising->adv_data.scan_rsp_data.p_data = p_advertising->enc_scan_rsp_data;
    p_advertising->adv_data.scan_rsp_data.len = BLE_GAP_ADV_SET_DATA_SIZE_MAX;

    ret = ble_advdata_encode(&p_init->srdata,
    p_advertising->adv_data.scan_rsp_data.p_data,
    &p_advertising->adv_data.scan_rsp_data.len);
    VERIFY_SUCCESS(ret);
    }
    else
    {
    p_advertising->adv_data.scan_rsp_data.p_data = NULL;
    p_advertising->adv_data.scan_rsp_data.len = 0;
    }

    // Configure a initial advertising configuration. The advertising data and and advertising
    // parameters will be changed later when we call @ref ble_advertising_start, but must be set
    // to legal values here to define an advertising handle.
    p_advertising->adv_params.primary_phy = BLE_GAP_PHY_CODED;
    p_advertising->adv_params.duration = p_advertising->adv_modes_config.ble_adv_fast_timeout;
    p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
    p_advertising->adv_params.p_peer_addr = NULL;
    p_advertising->adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
    p_advertising->adv_params.interval = p_advertising->adv_modes_config.ble_adv_fast_interval;

    ret = sd_ble_gap_adv_set_configure(&p_advertising->adv_handle, NULL, &p_advertising->adv_params);
    VERIFY_SUCCESS(ret);

    p_advertising->initialized = true;
    return ret;
    }

    above two line i changed 

     is it any wrong in my procedure i need some help

  • uint32_t ble_advertising_init(ble_advertising_t            * const p_advertising,
                                  ble_advertising_init_t const * const p_init)
    {
        uint32_t ret;
        if ((p_init == NULL) || (p_advertising == NULL))
        {
            return NRF_ERROR_NULL;
        }
        if (!config_is_valid(&p_init->config))
        {
            return NRF_ERROR_INVALID_PARAM;
        }
    
        p_advertising->adv_mode_current               = BLE_ADV_MODE_IDLE;
        p_advertising->adv_modes_config               = p_init->config;
        p_advertising->conn_cfg_tag                   = BLE_CONN_CFG_TAG_DEFAULT;
        p_advertising->evt_handler                    = p_init->evt_handler;
        p_advertising->error_handler                  = p_init->error_handler;
        p_advertising->current_slave_link_conn_handle = BLE_CONN_HANDLE_INVALID;
        p_advertising->p_adv_data                     = &p_advertising->adv_data;
    
        memset(&p_advertising->peer_address, 0, sizeof(p_advertising->peer_address));
    
        // Copy advertising data.
        if (!p_advertising->initialized)
        {
            p_advertising->adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;
        }
        p_advertising->adv_data.adv_data.p_data = p_advertising->enc_advdata;
        p_advertising->adv_data.adv_data.len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX;
    
        ret = ble_advdata_encode(&p_init->advdata, p_advertising->enc_advdata, &p_advertising->adv_data.adv_data.len);
        VERIFY_SUCCESS(ret);
    
        if (&p_init->srdata != NULL)
        {
            p_advertising->adv_data.scan_rsp_data.p_data = p_advertising->enc_scan_rsp_data;
            p_advertising->adv_data.scan_rsp_data.len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX;
    
            ret = ble_advdata_encode(&p_init->srdata,
                                      p_advertising->adv_data.scan_rsp_data.p_data,
                                     &p_advertising->adv_data.scan_rsp_data.len);
            VERIFY_SUCCESS(ret);
        }
        else
        {
            p_advertising->adv_data.scan_rsp_data.p_data = NULL;
            p_advertising->adv_data.scan_rsp_data.len    = 0;
        }
    
        // Configure a initial advertising configuration. The advertising data and and advertising
        // parameters will be changed later when we call @ref ble_advertising_start, but must be set
        // to legal values here to define an advertising handle.
        p_advertising->adv_params.primary_phy     = BLE_GAP_PHY_CODED;
        p_advertising->adv_params.duration        = p_advertising->adv_modes_config.ble_adv_fast_timeout;
        p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
        p_advertising->adv_params.p_peer_addr     = NULL;
        p_advertising->adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
        p_advertising->adv_params.interval        = p_advertising->adv_modes_config.ble_adv_fast_interval;
    
        ret = sd_ble_gap_adv_set_configure(&p_advertising->adv_handle, NULL, &p_advertising->adv_params);
        VERIFY_SUCCESS(ret);
    
        p_advertising->initialized = true;
        return ret;
    }
    

    just change phy and type.

  • Hi,

    I think this will work. Have you try to test it?

    And if you haven't had a look at it I will post the link to our long range demo with nRF52840 DK here.

    In the demo the secondary phy was also set to BLE_GAP_PHY_CODED. You can read more about advertising in Bluetooth 5 in this blog post.

    If it doesn't work just let med know and I will try to implement long range with the relay example myself on Monday.

    Best Regards,

    Marjeris

  • Thanks for your support i tested but its not working so i debugged the program and check current phy

    I found that the phy automatically changes to 1mb phy i need some help to solve this 

    The problem i have no DK board i have only my own custom board i tested with my custom board so i want to change in relay application to get long range if any wrong in my procedure(code)  it is very difficult to find because i have no DK board. so need some help to implement long range

Related