⚠️ Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
I have a Bluetooth question and would like to consult you. How to ensure the uniqueness of the Bluetooth address, the same program is burned into different chips, how to ensure that the Bluetooth address is different?
我说的是Bluetooth MAC address.What I am talking about is the Bluetooth MAC address. The problem is that downloading the same program will have the same Bluetooth MAC address
Yes,it is advertising BD address.Does a random Bluetooth address guarantee that every BD address is different? How do I use a random Bluetooth address, please guide me.
It’s under5.0.4\sdk\app_modules\src\app_common\app.c SDK path. Which SDK version are you using? You have tagged the DA14580 product, so the recommend SDK is version 5.0.4.
By default, the device starts advertising with static public BD Address. The default value of the public address is declared in sdk/ble/config/ble_config.h file. If a new value is required to be defined then the new macro definition should take place in config/custom_config_xxx.h file where all custom definitions should be declared. For example :
In case of setting a random BD address, you should do the following:
/*Initialize the BLE structure related to the BD address */ static const own_address_t user_bd_address = { .addr_type = PRIVATE_RANDOM_NONRESOLVABLE_ADDRESS, .addr = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06} }; /*Set the Bluetooth address */ ble_gap_address_set(&user_bd_address, 0x00FF);
If you follow your example, then in mass production, the Bluetooth MAC address of each product will be the same. This will definitely not work,Is there a better way?
I use ble_gap_address_set (& user_bd_address, 0x00FF) to set the BD address. Why can this device be scanned by Android phones, but not by Apple phones? My data is as follows:
/*Initialize the BLE structure related to the BD address */ 静态_dddress_t user_bd_address = { .addr_type = PRIVATE_STATIC_ADDRESS, .ddr = {0x01,0x02,0x03,0x04,0x05,0x06} };
You can also use the SmartSnippets Toolbox to read the NVMS_PARAM_PART.
If the user has not written any BD address in that partition or if the flag is invalid (disabled) then, the application will take the default public BD address. Please check read_public_address() function in BLE adapter (ad_ble.c file).
当开发人员没有提供设备地址时,使用蓝牙公共地址。公共地址的默认值在SDK / BLE / CONFIG / BLE_CONFIG.H文件中声明。如果需要确定新值,则新的宏定义应在Config / Custom_config_xxx.h文件中进行,其中应声明所有自定义定义。
The update_bd_address() function aims to generate a BD address based on the TRNG (True Random Number Generator) engine and set it by calling the ble_gap_address_set(). Then, the previously generated address will be written into the NVMS_PARAM_PART. So, after a cold boot (reset) takes place, the device will use the BD address written in the flash. Please find the source code in the attachments. You will also find code snippet for the verification.
Generally, there are three (3) ways to configure the BD address:
1. Define a unique public address. So, the defaultBLE_STATIC_ADDRESS macro should be defined in custom_config_xxx.h
你好呀,
What kind of BD address are you using? Is it static random? Can you please share more inputs on this?
Thanks, PM_Dialog
hi,
我说的是Bluetooth MAC address.What I am talking about is the Bluetooth MAC address. The problem is that downloading the same program will have the same Bluetooth MAC address
你好呀,
设备是广告的BD地址是什么?如果您不使用随机BD地址,则设备将与应用程序代码中设置的BD地址进行通告。您能否为您完成的内容分享更多的输入?BD地址的类型是什么?
Thanks, PM_Dialog
Hi,
Yes,it is advertising BD address.Does a random Bluetooth address guarantee that every BD address is different? How do I use a random Bluetooth address, please guide me.
你好呀,
为了用静态随机BD地址进行宣传,您应该将user_add_src结构的.addr_src属性更改为gapm_gen_static_rnd_addr。此结构位于User_Config.h文件下。请查看app_easy_gap_undircated_advertise_start_create_msg()函数,为可连接的无向事件创建广告消息。如果user_adv_conf.addr_src配置为Gapm_gen_static_rnd_addr,则将触发生成_static_random_address(),它会生成48位静态随机地址。
Thanks, PM_Dialog
hi,
我找不到app_easy_gap_undirected_advertise_start_create_msg()函数?请解释该功能的位置。
你好呀,
It’s under5.0.4\sdk\app_modules\src\app_common\app.c SDK path. Which SDK version are you using? You have tagged the DA14580 product, so the recommend SDK is version 5.0.4.
Thanks, PM_Dialog
hi there,
Sorry, the product and SDK I marked are wrong, I use DA14695, and use the latest SDK version
你好呀,
By default, the device starts advertising with static public BD Address. The default value of the public address is declared in sdk/ble/config/ble_config.h file. If a new value is required to be defined then the new macro definition should take place in config/custom_config_xxx.h file where all custom definitions should be declared. For example :
In case of setting a random BD address, you should do the following:
.addr将被忽略。
Thanks, PM_Dialog
Hi There,
If you follow your example, then in mass production, the Bluetooth MAC address of each product will be the same. This will definitely not work,Is there a better way?
否,对于每个设备,设备的BD地址将是唯一的,设备的BD地址至少每150秒更改。但是,如果您设置地址类型是private_random_nonresolvable_address,因为pm_dialog表示,您将无法连接。非溶解地址用于信标或非可连接设备。
I set up my unique address in this way:
you are able to change the address renew period.
不幸的是,在生产时没有私有静态BD地址,就像在NRF52 MCU。
Hi There,
I use ble_gap_address_set (& user_bd_address, 0x00FF) to set the BD address. Why can this device be scanned by Android phones, but not by Apple phones? My data is as follows:
/*Initialize the BLE structure related to the BD address */
静态_dddress_t user_bd_address = {
.addr_type = PRIVATE_STATIC_ADDRESS,
.ddr = {0x01,0x02,0x03,0x04,0x05,0x06}
};
你好呀,
让我解释我们在SDK中处理的BD地址如何。当设备靴子时,BLE适配器将访问NVMS_PARAM_PART分区并检查此分区中是否放置了有效的BD地址。该分区的第一个条目是nvparam_ble_patform_bd_address,它有7个字节长度:
- 6 bytes for the BD address
- 1字节,指定书面BD地址的有效性。
You can also use the SmartSnippets Toolbox to read the NVMS_PARAM_PART.
If the user has not written any BD address in that partition or if the flag is invalid (disabled) then, the application will take the default public BD address. Please check read_public_address() function in BLE adapter (ad_ble.c file).
当开发人员没有提供设备地址时,使用蓝牙公共地址。公共地址的默认值在SDK / BLE / CONFIG / BLE_CONFIG.H文件中声明。如果需要确定新值,则新的宏定义应在Config / Custom_config_xxx.h文件中进行,其中应声明所有自定义定义。
The update_bd_address() function aims to generate a BD address based on the TRNG (True Random Number Generator) engine and set it by calling the ble_gap_address_set(). Then, the previously generated address will be written into the NVMS_PARAM_PART. So, after a cold boot (reset) takes place, the device will use the BD address written in the flash. Please find the source code in the attachments. You will also find code snippet for the verification.
Generally, there are three (3) ways to configure the BD address:
1. Define a unique public address. So, the defaultBLE_STATIC_ADDRESS macro should be defined in custom_config_xxx.h
2.在nvms_param_part flash分区中编写BD地址。SDK将覆盖DefoultBle_Static_Address宏定义中定义的公共地址。
3. Define a unique BD address by calling the ble_gap_address_set() API. This API can be called at any time to change the BD address of the device.
Thanks, PM_Dialog