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

Missing Advertisements from Mesh proxy node

Hi,

I am using nrf mesh sdk v3.2.0 and I would like to combine our custom service within the mesh server example (includes the proxy service). Using info from other threads, I integrated the BLE NUS service and it seems to work. I can scan and connect to device with NUS service visible. After the device has been provisioned and configured, my windows BLE application is not able to  find the node all the time. My application identifies for the device using the "device name" and some manufacturer specific data. Below is the scanning results:

Sometimes the device is not found in the scan for 1 minutes or so. Is this normal behavior? I am new to BLE mesh and I am not very familiar how scanning works in mesh proxy application. 

Second question: Is it feasible to have an extra advertising packets every 1 second or so only containing the device name and some manufacturer data? My preference is to use passive scanning if possible. I already tried to make a method to create such advertising packet and call the method from mesh_adv_start function in mesh_adv.c file. However, I see the special advertising packet just once and not repeated on advertisement interval. See the sample code below

void mesh_adv_data_set2()
{
    memset(&m_gap_adv_data, 0, sizeof(m_gap_adv_data));
    m_gap_adv_data.adv_data.p_data      = m_advdata_raw[m_adv_set_index];
    m_gap_adv_data.scan_rsp_data.p_data = m_srdata_raw[m_adv_set_index];
    m_gap_adv_data.adv_data.len         = sizeof(m_advdata_raw[0]);
    m_gap_adv_data.scan_rsp_data.len    = sizeof(m_srdata_raw[m_adv_set_index]);
    m_adv_set_index = (m_adv_set_index + 1) & 1;

    ble_advdata_t advdata;
    memset(&advdata, 0, sizeof(advdata));
    advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

    advdata.name_type = BLE_ADVDATA_FULL_NAME;

        // Variables used for manufacturer specific data
    ble_advdata_manuf_data_t adv_manuf_data;
    uint8_array_t            adv_manuf_data_array;
    uint8_t                  adv_manuf_data_data[10];
    // ---------------------------------------------
        
    // Configuration of manufacturer specific data
    memcpy(adv_manuf_data_data, CustomData, 10);
    
    adv_manuf_data_array.p_data = adv_manuf_data_data;
    adv_manuf_data_array.size = 10;
    
    adv_manuf_data.company_identifier = 0x06CF;
    adv_manuf_data.data = adv_manuf_data_array;
    
    advdata.p_manuf_specific_data = &adv_manuf_data;

    APP_ERROR_CHECK(ble_advdata_encode(&advdata, m_gap_adv_data.adv_data.p_data, &m_gap_adv_data.adv_data.len));

#if NRF_SD_BLE_API_VERSION >= 6

    uint32_t err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_gap_adv_data, &m_adv_params);
    if (err_code == NRF_ERROR_INVALID_STATE)
    {
        err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_gap_adv_data, NULL);
    }
#else

    uint32_t err_code = sd_ble_gap_adv_data_set(m_gap_adv_data.adv_data.p_data,
                                                m_gap_adv_data.adv_data.len,
                                                m_gap_adv_data.scan_rsp_data.p_data,
                                                m_gap_adv_data.scan_rsp_data.len);
#endif  /* NRF_SD_BLE_API_VERSION >= 6 */
    APP_ERROR_CHECK(err_code);
}

void mesh_adv_start(void)
{
    mesh_adv_data_set2();
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "mesh_adv_start\n");

#if NRF_SD_BLE_API_VERSION >= 6
    APP_ERROR_CHECK(sd_ble_gap_adv_start(m_adv_handle,  MESH_SOFTDEVICE_CONN_CFG_TAG));
#else
    APP_ERROR_CHECK(sd_ble_gap_adv_start(&m_adv_params,  MESH_SOFTDEVICE_CONN_CFG_TAG));
#endif
    /* We restart the mesh timeslot to yield time for the softdevice advertiser to start. */
    timeslot_restart(TIMESLOT_PRIORITY_LOW);
}

Thanks for your support.

  • Hi,

    Sorry for the delayed answer on this one!

    With Bluetooth mesh and GATT Proxy, you do get quite a bit of radio activity already, and so any concurrent BLE activity will affect mesh operation and vice versa. One way to figure out how much time you get for beacon RX, as well as get a better understanding of what radio activity is going on, is to use a BLE Sniffer.

    In order for a scanner to detect your beacon, it must scan on the same channel and on the same time as the beacon transmits. Depending on advertising interval and scan interval, you may end up in a situation where scan windows and advertising events are "in sync" but "out of phase". Information on the scan parameters for the observer is therefore useful with regards to deciding the advertising parameters for the beacon. You can read more about scanner timing and advertiser timing in the SoftDevice Specification. Do note, however, that Bluetooth mesh uses the timeslot API for ADV bearer based operations.

    The SoftDevice currently only have max one advertising set. That means you are likely to get into trouble if you have copied the advertising functions from examples/common/src/mesh_adv.c and both the old and new functions are used from the application. If you are to send multiple beacons concurrently you may find that you need to set the advertising data for every advertising event.

    Regards,
    Terje

Related