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

nrf51 BLE DeviceName in Beacon app SDK10

Hello there,

I'm facing inconsistency across two nrf51 PCB boards in term of sending the device name. I'm running the same exact code on both. One is advertising the device name but the other on is not (it appears as N/A on the nerf Connect app). I'm using SDK10 with 110 soft device. 

In the code, I'm sending 20 bytes in the advertisement here is my setup code 

static void advertising_init(void)

{   uint32_t      err_code;
    ble_advdata_t advdata;
    ble_advdata_manuf_data_t manuf_specific_data;
     //an advertising packet can consist of no more than 31 bytes! a header of 2 bytes (length and type) for each field in the advertising packet (appearance, name, service UUID, and so on).
    
    // Build advertising data struct.
    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type = BLE_ADVDATA_NO_NAME; 
 
    // Load user data into manufacturer struct -- Currently, can take 24 bytes max instead of 29
    manuf_specific_data.data.p_data = (uint8_t *) m_rx_buf;
    manuf_specific_data.data.size   = BUF_SIZE;
    
    
    advdata.p_manuf_specific_data = &manuf_specific_data;
    advdata.include_appearance    = false; // False to free additional 4 bytes of space. 2 for the appearance characteristic and 2 for its header
    advdata.flags                 = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; //3 bytes 1 for the flag and two for its header
     advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
     advdata.uuids_complete.p_uuids  = m_adv_uuids;


    
    err_code = ble_advdata_set(&advdata, NULL);
    APP_ERROR_CHECK(err_code);

    // Initialize advertising parameters (used when starting advertising).
    memset(&m_adv_params, 0, sizeof(m_adv_params));

    m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
    m_adv_params.p_peer_addr = NULL;                // Undirected advertisement.
    m_adv_params.fp          = BLE_GAP_ADV_FP_ANY;
    m_adv_params.interval    = NON_CONNECTABLE_ADV_INTERVAL;
    m_adv_params.timeout     = APP_CFG_NON_CONN_ADV_TIMEOUT;

    // Set the Advertising device name
    ble_gap_conn_sec_mode_t sec_mode;

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
    err_code = sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *)DEVICE_NAME, strlen(DEVICE_NAME));
}

here is what I received on nerf Connect app from device 1 (showing the device Name):

Here is what I received on nerf Connect from device 2(showing N/A device Name): Note there is "Optek" word in the manufacture data  which I don't know what does it mean and why it is showing ?

any idea why the device name appears as N/A when using one nrf51 board but with other nrf51 the device name is been advertise where the same code is running on both nrf devices?

I appreciate your help.

Related