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

BLE DEVICE_NAME not showing

Hi,

I am facing problem while developing code for the application.

I am working on the "ble_app_uart" example code to develop my one of the application, But after making some custom changes into the code it stops showing the "DEVICE_NAME" in nRF Connect Nordic application.

I have added some of the code from the "Beacon" project to advertise the company and devices type & all.

Here after adding all these line of code into the "ble_app_uart" from the "Beacon" project it stop showing the DEVICE_NAME in the application. I don't know why is it so.

Can you please guide to resolve this error.

For more I am sharing code which i have used for advertising:

#define DEVICE_NAME                     "SSLBL" 

#define APP_ADV_INTERVAL 64 /**< The advertising interval (in units of 0.625 ms. This value corresponds to 40 ms). */
#define APP_ADV_TIMEOUT_IN_SECONDS 60 /**< The advertising timeout (in units of seconds). */


#define MIN_CONN_INTERVAL MSEC_TO_UNITS(20, UNIT_1_25_MS) /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(75, UNIT_1_25_MS) /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */
#define SLAVE_LATENCY 0 /**< Slave latency. */
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) /**< Connection supervisory timeout (4 seconds), Supervision Timeout uses 10 ms units. */
#define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER) /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). */
#define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(30000, APP_TIMER_PRESCALER) /**< Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */
#define MAX_CONN_PARAMS_UPDATE_COUNT 3 /**< Number of attempts before giving up the connection parameter negotiation. */

#define UART_TX_BUF_SIZE 256 /**< UART TX buffer size. */
#define UART_RX_BUF_SIZE 256 /**< UART RX buffer size. */


#define APP_TAG_INFO_LENGTH 0x17 /**< Total length of information advertised by the TAG. */
#define APP_ADV_DATA_LENGTH 0x16 /**< Length of manufacturer specific data in the advertisement. */
#define APP_COMPANY_IDENTIFIER 0x02A1 /**< Company identifier for ASA. as per www.bluetooth.org. */
#define APP_FM_VER 0x02, 0x03 /**< Firmware Version */
#define APP_HW_VER 0x04, 0x05 /**< Hardware Version */

static void advertising_init(void)
{
uint32_t err_code;
ble_advdata_t advdata;
ble_advdata_t scanrsp;
ble_adv_modes_config_t options;

uint8_t flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;

ble_advdata_manuf_data_t manuf_specific_data;

manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;


// 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;

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;

manuf_specific_data.data.p_data = (uint8_t *) m_tag_info;
manuf_specific_data.data.size = APP_TAG_INFO_LENGTH;

// Build and set advertising data.
memset(&advdata, 0, sizeof(advdata));

advdata.name_type = BLE_ADVDATA_FULL_NAME;
advdata.flags = flags;
advdata.p_manuf_specific_data = &manuf_specific_data;

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));

memset(&options, 0, sizeof(options));
options.ble_adv_fast_enabled = true;
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);
}

And also I am sharing the screenshot of my application more clarification.

  • then you add manufacture data in advertising packet and the device name in the scan response or vice versa.

  • Code("my code" in above) available, I have added the manufacturer details to it, but after it stop advertising the Device_Name at the time of broadcasting.

    I have added those manufacturer details to it to do the same. But after your reply I have commented those lines to make the code advertising.

    So, Is there any way to add the those details or any lines which I have to add into the code to advertise the manufacturer data.

    Thanks 

  • Then instead of BLE_ADVDATA_NO_NAME you need to put BLE_ADVDATA_FULL_NAME.   use below and try it out.

    static void advertising_init(void)
    {
        uint32_t      err_code;
        ble_advdata_t advdata;
        ble_advdata_t scanrsp;
    	  ble_adv_modes_config_t options;
    
    		uint8_t       flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;
    
    	  ble_advdata_manuf_data_t manuf_specific_data;
    
    		manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
    	
    		
    		// 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;
    
        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;
    
    		manuf_specific_data.data.p_data = (uint8_t *) m_tag_info;
        manuf_specific_data.data.size   = APP_TAG_INFO_LENGTH;
    
        // Build and set advertising data.
        memset(&advdata, 0, sizeof(advdata));
    
        advdata.name_type             = BLE_ADVDATA_FULL_NAME;
        advdata.flags                 = flags;
        advdata.p_manuf_specific_data = &manuf_specific_data;
    
        // Initialize advertising parameters (used when starting advertising).
        memset(&m_adv_params, 0, sizeof(m_adv_params));
    
        
    
        memset(&options, 0, sizeof(options));
        options.ble_adv_fast_enabled  = true;
        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);
    	
    }
    

    Make sure that you actually have space in the adv packet + scan response data to send "device_name+manufacture data+uuids list. It sounds to me that you might not have that much space

    You will most likely get an error NRF_ERROR_DATA_SIZE in ble_advertising_init. You need to calculate the available space in packets and organise the data to be sent accordingly.

  • Hi Susheel,

    First of all Thank you very much for the quick replies ... :-)

    I have copied your whole code of  void advertising_init(void) to my main code, but once it stop advertising.

    Best Regards

  • Hey,

    This is what was saying. You may not have enough space to advertise all this data. Check the response of the "ble_advertising_init" function.

Related