⚠️
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.
14 posts / 0 new
Last post
邓昌永
Offline
Last seen:2 months 1 week ago
加入:2020-02-10 02:23
BLE MacAddress

Hi,

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?

Device:
PM_Dialog
Offline
Last seen:2 days 15 hours ago
Staff
加入:2018-02-08 11:03
Hi There,

Hi There,

What kind of BD address are you using? Is it static random? Can you please share more inputs on this?

Thanks, PM_Dialog

邓昌永
Offline
Last seen:2 months 1 week ago
加入:2020-02-10 02:23
hi,

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

PM_Dialog
Offline
Last seen:2 days 15 hours ago
Staff
加入:2018-02-08 11:03
Hi There,

Hi There,

What is the BD address that the device is advertising? If you are not using random BD address, the device will advertise with the BD address that is set in your application code. Can you please share more inputs for what you have accomplish? What is the type of the BD address?

Thanks, PM_Dialog

邓昌永
Offline
Last seen:2 months 1 week ago
加入:2020-02-10 02:23
Hi,

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.

PM_Dialog
Offline
Last seen:2 days 15 hours ago
Staff
加入:2018-02-08 11:03
Hi There,

Hi There,

为了宣传与静态随机BD地址s, 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

邓昌永
Offline
Last seen:2 months 1 week ago
加入:2020-02-10 02:23
hi,

hi,

I can't find the app_easy_gap_undirected_advertise_start_create_msg () function? Please explain the location of that function.

PM_Dialog
Offline
Last seen:2 days 15 hours ago
Staff
加入:2018-02-08 11:03
Hi There,

Hi There,

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

邓昌永
Offline
Last seen:2 months 1 week ago
加入:2020-02-10 02:23
hi there,

hi there,

Sorry, the product and SDK I marked are wrong, I use DA14695, and use the latest SDK version

PM_Dialog
Offline
Last seen:2 days 15 hours ago
Staff
加入:2018-02-08 11:03
Hi There,

Hi There,

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 :

#define defaultBLE_STATIC_ADDRESS {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);

The .addr will be ignored.

Thanks, PM_Dialog

邓昌永
Offline
Last seen:2 months 1 week ago
加入:2020-02-10 02:23
Hi There,

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?

aectaan
Offline
Last seen:2 months 1 week ago
加入:2019-10-02 07:06

No, it will be unique for each device and BD address of device will change at least every 150s. But if you set address type is PRIVATE_RANDOM_NONRESOLVABLE_ADDRESS, as PM_Dialog said, you will be not able to connect. Nonresolvable address is for beacons or non-connectable devices.

I set up my unique address in this way:

static const own_address_t own_addr = { .addr_type = PRIVATE_RANDOM_RESOLVABLE_ADDRESS, }; err = ble_gap_address_set(&own_addr, defaultBLE_ADDRESS_RENEW_DURATION);

you are able to change the address renew period.

Unfortunately, there is no private static BD address burned at production, like at nRF52 MCUs.

邓昌永
Offline
Last seen:2 months 1 week ago
加入:2020-02-10 02:23
Hi There,

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 */
static own_address_t user_bd_address = {
.addr_type = PRIVATE_STATIC_ADDRESS,
.addr = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06}
};

PM_Dialog
Offline
Last seen:2 days 15 hours ago
Staff
加入:2018-02-08 11:03
Hi There,

Hi There,

Let me explain how the BD address in handled in our SDK. When the device boots, the BLE adapter will access the NVMS_PARAM_PART partition and check if a valid BD address is placed in this partition. The first entry of that partition, is the NVPARAM_BLE_PATFORM_BD_ADDRESS and it has 7 bytes length:

- 6 bytes for the BD address

- 1 byte that designates the validity of the written BD address.

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).

When no device address is provided by the developer the Bluetooth public address is used. 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.

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. Write a BD address in the NVMS_PARAM_PART flash partition. The SDK will overwrite the public address defined in defaultBLE_STATIC_ADDRESS macro definition.

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