esp-idf: esp_bt_dev_set_device_name() not working (IDFGH-8425)

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

origin/release/v4.4.2

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

CMD

Development Kit.

ESP32-D0WDQ6-V3 (revision 3)

Power Supply used.

USB

What is the expected behavior?

esp_bt_dev_set_device_name() should make the ESP32 display the name.

What is the actual behavior?

Using NRFConnect I can see the device advertising my Beacon but the name is shown as NA (Not available).

Steps to reproduce.

    esp_err_t status;

	ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT));
    esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
    esp_bt_controller_init(&bt_cfg);
    esp_bt_controller_enable(ESP_BT_MODE_BLE);
    
    esp_bluedroid_init();
    
    
    esp_bluedroid_enable();
    
    esp_err_t err=esp_bt_dev_set_device_name("ho");
    ESP_LOGI("main", "Set name result: %s", esp_err_to_name(err));

I have also tried to:

static esp_ble_adv_data_t esp_ble_adv_data={
    .include_name=true
};

And then:

    err= esp_ble_gap_config_adv_data(&esp_ble_adv_data);
    ESP_LOGI("main", "config adv data result: %s", esp_err_to_name(err));

With no success.

Debug Logs.

I (558) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (617) BTDM_INIT: BT controller compile version [5688ed5]
I (617) system_api: Base MAC address is not set
I (617) system_api: read default base MAC address from EFUSE
I (627) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (1047) main: Set name result: ESP_OK
I (1047) main: config adv data result: ESP_OK
I (1047) AltBeacon_HAL: register callback
I (61047) AltBeacon_HAL: Stop adv successfully

More Information.

Everything compiles and the log doesn’t show any error.

Could it be related to this?: https://github.com/espressif/esp-idf/issues/8071

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (3 by maintainers)

Most upvoted comments

@mbastida123 have a try:

static esp_ble_adv_params_t adv_params = {
    .adv_int_min         = 0x20,
    .adv_int_max         = 0x40,
    .adv_type            = ADV_TYPE_SCAN_IND,
    .own_addr_type       = BLE_ADDR_TYPE_PUBLIC,
    .channel_map         = ADV_CHNL_ALL,
    .adv_filter_policy   = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
};