This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NCS bt_set_name()

Hello,

NCS1.9.1,  VSCode,

bt_set_name() successed,
but DeviceManage app show old name 'test' that from prj.conf.

prj.conf

CONFIG_BT=y
CONFIG_BT_BROADCASTER=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_PER_ADV=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_DEVICE_NAME="test"
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_PERIPHERAL=y


# Enable mcumgr.
CONFIG_MCUMGR=y

# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y

# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y


# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=252
CONFIG_BT_BUF_ACL_RX_SIZE=502

# Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n

# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=800
CONFIG_BT_CONN_PARAM_UPDATE_TIMEOUT=5000

  

Best regards

Parents
  • Hi,

    The phone will cache the device name, so in most cases you will need to toggle Bluetooth off and on again to see the updated name on a mobile device. That is a very common issue and should be the first thing to check. If that does not seem to work, then you can check with nRF Connect for Desktop and see which name is actually being used (this will show you whatever is actually advertised on air and changes immediately when the advertising packet changes).

  • Hi,

    thanks for reply,

    i've toggle Bluetooth off and on again ,and remove Device Mamage app,and than install it from apple store.

    but the same old BT name, use another iphone12( that never install app) also show old BT name.

     

    if change name from prj.conf,  

    the correct name will be immediately displayed on the app.

      

    Best regards

  • Hi,

    I see. Then the name is not updated in the advertising packet. Looking at your code snippet from the original post again I see that you don't update the advertising data before between setting the new name and starting to advertise, so this is expected. You need to do that using bt_le_adv_update_data(). If you still can' make it work, then please let me know and show your code here  (please post using Insert - Code for better readability and searchability).

Reply
  • Hi,

    I see. Then the name is not updated in the advertising packet. Looking at your code snippet from the original post again I see that you don't update the advertising data before between setting the new name and starting to advertise, so this is expected. You need to do that using bt_le_adv_update_data(). If you still can' make it work, then please let me know and show your code here  (please post using Insert - Code for better readability and searchability).

Children
Related