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.
In order to advertise with static random BD address, you should change the .addr_src item of user_adv_conf structure to GAPM_GEN_STATIC_RND_ADDR. This structure is under user_config.h file. Please take a look into the app_easy_gap_undirected_advertise_start_create_msg() function that creates the advertising message for connectable undirected event. If the user_adv_conf.addr_src is configured as GAPM_GEN_STATIC_RND_ADDR, the generate_static_random_address() will be triggered, that generates 48-bit static random address.
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 :
#定义默认的静态地址{0x01,0x02,0x03,0x04,0x05,0x06}
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 */ 静态自身\u地址\u t用户\u bd \u地址={ .addr_type = PRIVATE_STATIC_ADDRESS, .addr={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).
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\u PARAM\u PART flash分区中写入一个BD地址。SDK将覆盖defaultBLE\u STATIC\u 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.
你好,
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.
你好,
In order to advertise with static random BD address, you should change the .addr_src item of user_adv_conf structure to GAPM_GEN_STATIC_RND_ADDR. This structure is under user_config.h file. Please take a look into the app_easy_gap_undirected_advertise_start_create_msg() function that creates the advertising message for connectable undirected event. If the user_adv_conf.addr_src is configured as GAPM_GEN_STATIC_RND_ADDR, the generate_static_random_address() will be triggered, that generates 48-bit static random address.
Thanks, PM_Dialog
hi,
我找不到app\u easy\u gap\u undirected\u advertized\u start\u create\u 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地址至少每150秒改变一次。但是如果您将地址类型设置为PRIVATE\u RANDOM\u NONRESOLVABLE\u address,正如PM\u Dialog所说,您将无法连接。不可解析地址用于信标或不可连接的设备。
I set up my unique address in this way:
you are able to change the address renew period.
不幸的是,在生产中没有像nRF52 mcu那样的私有静态BD地址。
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 */
静态自身\u地址\u t用户\u bd \u地址={
.addr_type = PRIVATE_STATIC_ADDRESS,
.addr={0x01、0x02、0x03、0x04、0x05、0x06}
};
你好,
让我解释一下在我们的SDK中如何处理BD地址。当设备引导时,BLE适配器将访问NVMS\u PARAM\u PART分区,并检查是否在该分区中放置了有效的BD地址。该分区的第一个条目是NVPARAM\u BLE\u PATFORM\u BD\u 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).
如果开发人员没有提供设备地址,则使用蓝牙公共地址。public address的默认值在sdk/ble/config/ble\u config.h文件中声明。如果需要定义一个新的值,那么新的宏定义应该发生在config/custom\u config\u 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\u PARAM\u PART flash分区中写入一个BD地址。SDK将覆盖defaultBLE\u STATIC\u 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