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

NCS change BLE device name during runtime

Hello,

I'm developing an BLE application with NCS where I want to be able to change the BLE device name during runtime. Therefore I enabled CONFIG_BT_DEVICE_NAME_DYNAMIC in the prj.conf.

It works but I always get this warning message when I change the device name:

<wrn> bt_hci_core: Unable to store name

So I'm curious why this warning says that the name couldn't be stored but it still changes?

Thanks in advance.

Parents
  • Hi,

    So I'm curious why this warning says that the name couldn't be stored but it still changes?

    Changing the name, and then storing it persistently in flash are 2 different operations. It tries to save the name persistently since you have CONFIG_BT_SETTINGS=y

    If you set these configs, you might be able to store it successfully

    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y

  • Hi Sigurd,

    thank you for your answer.

    When I understand you right, I can ignore the warning if I don't need to store the device name in the NVM?

    The strange thing is I actually have the config entries that you mentioned in my proj.conf and still getting this warning.

    My proj.conf:

    CONFIG_DEBUG_OPTIMIZATIONS=y
    CONFIG_CPLUSPLUS=y
    
    # Enable the UART driver
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_UARTE0=y
    CONFIG_SERIAL=y
    
    CONFIG_GPIO=y
    
    # Make sure printk is not printing to the UART console
    CONFIG_CONSOLE=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_UART_CONSOLE=n
    
    CONFIG_HEAP_MEM_POOL_SIZE=2048
    
    # Configuration required by Event Manager
    CONFIG_EVENT_MANAGER=y
    CONFIG_LINKER_ORPHAN_SECTION_PLACE=y
    CONFIG_REBOOT=y
    
    # Configuration BT general
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Test"
    CONFIG_BT_DEVICE_NAME_DYNAMIC=y
    CONFIG_BT_DEVICE_APPEARANCE=0
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_MAX_PAIRED=1
    CONFIG_BT_DEBUG_LOG=n
    
    CONFIG_BT_CTLR_PHY_2M=n
    CONFIG_BT_CTLR_PHY_CODED=n
    
    CONFIG_BT_PERIPHERAL_PREF_MIN_INT=12
    CONFIG_BT_PERIPHERAL_PREF_MAX_INT=24
    CONFIG_BT_PERIPHERAL_PREF_SLAVE_LATENCY=0
    CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
    
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_L2CAP_TX_MTU=247
    CONFIG_BT_L2CAP_RX_MTU=247
    
    # Enable the device information service
    CONFIG_BT_DIS=y
    CONFIG_BT_DIS_PNP=n
    CONFIG_BT_DIS_FW_REV=y
    
    # Below is setup to let DIS information be read from settings
    CONFIG_BT_SETTINGS=y
    CONFIG_BT_GATT_CACHING=n
    CONFIG_SETTINGS_RUNTIME=y
    CONFIG_SETTINGS=y
    CONFIG_SETTINGS_NONE=y
    
    CONFIG_BT_DIS_SETTINGS=y
    CONFIG_BT_DIS_STR_MAX=21
    
    # Enable the NUS service
    CONFIG_BT_NUS=n
    
    # Enable bonding
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    
    # This example requires more workqueue stack
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Config logger
    CONFIG_LOG=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    CONFIG_ASSERT=y

    Best regards.

  • Could you try to remove CONFIG_SETTINGS_NONE=y , and see if that solves the issue ?

    db_lw said:
    When I understand you right, I can ignore the warning if I don't need to store the device name in the NVM?

    Yes.

    Here is the code-line where you get the warning: https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.99-ncs1/subsys/bluetooth/host/hci_core.c#L6724

    If removing CONFIG_SETTINGS_NONE does not work, you could try to print the error that is returned

    change
    BT_WARN("Unable to store name");
    
    to
    BT_WARN("Unable to store name: error %d",err);

Reply Children
Related