Resolvable private address issues

16 posts / 0 new
Last post
summer20100514
Offline
Last seen:4 years 5 months ago
Guru
加入:2014-12-30 05:01
Resolvable private address issues

Hi there, I followed the document AN-B-022 DA14580 Resolvable private address guidelines to achieve the random address, and every thing went well, the address changed periodically according to my configuration. But I found that each time I changed the advertisement data which would call app_adv_func(), the address changed as well.
What can I do to prevent the address from changing after I call the function app_adv_func()?

Device:
summer20100514
Offline
Last seen:4 years 5 months ago
Guru
加入:2014-12-30 05:01
As far as I am concerned, it

As far as I am concerned, it is impossible to achieve that, right?

JE_Dialog
Offline
Last seen:20 hours 27 min ago
Staff
加入:2013-12-05 14:02
Yes Summer, i beleive you are

Yes Summer, i beleive you are correct. BR JE_Dialog

summer20100514
Offline
Last seen:4 years 5 months ago
Guru
加入:2014-12-30 05:01
Thank you.

Thank you.

Mahesh
Offline
Last seen:3 years 4 months ago
加入:2016-01-04 14:03
Hi,

Hi,
I am using SDK 5.0.3 software on DA14583DEVKT-B board.
I have taken the "ble_app_peripheral" (BLE example projects given).

I have changed "address_src" to "GAPM_GEN_STATIC_RND_ADDR".
I am facing issue while scanning for Bluetooth device. While scanning the Bluetooth device address is changing without any power cycle (of DA14583). As per Bluetooth core spec, if we have selected Static Random address then the Bluetooth address has to change on each power cycle.

My requirement is Bluetooth device address need to be changed on each power cycle.
Please guide me to resolve the issue.

Regards,
Mahesh Chandana.

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi Mahesh,

Hi Mahesh,

This is a known issue, and there is a work around for this, you can use the GAPM_GEN_RAND_ADDR_CMD with a GAP_STATIC_ADDR type and store the generated address returned in GAPM_DEV_BDADDR_IND message. Then a GAPM_START_ADVERTISE_CMD should be sent with address source set to GAPM_PROVIDED_RND_ADDR and providing the stored random address in the address field, for more info regarding the commands please check the RW-BLE-GAP-IS. The idea is to call the above process during initialization of the device, for example when the setup of your database has been completed and then, after aquiring the bd_address you can start advertising.

Thanks MT_dialog

Mahesh
Offline
Last seen:3 years 4 months ago
加入:2016-01-04 14:03
Hi,

Hi,
In which function and in which file we need to do these sequence of changes.

"GAPM_PROVIDED_RND_ADDR" I have changed directly in "user_config.h".

Regards,
Mahesh Chandana.

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi Mahesh,

Hi Mahesh,

There is no special file to implement this, just create a function that sends the command GAPM_GEN_RAND_ADDR_CMD, retrieve the command via the catch_rest mechanism (catch the GAPM_DEV_BDADDR_IND) and set the db address that you got from that indication when you are preparing the advertising command in the gapm_start_advertise_cmd struct in the op->addr member. Check the document mentioned above for any details regarding the structs.

Thanks MT_dialog

Mahesh
Offline
Last seen:3 years 4 months ago
加入:2016-01-04 14:03
Hi

Hi

I am able to retrieve the catch_rest mechanism (catch the GAPM_DEV_BDADDR_IND) after sending the command "GAPM_GEN_RAND_ADDR_CMD". Able to read the Random address.

我打电话app_gapm_gen_rand_addr_msg_create() inside "default_app_on_db_init_complete() as shown in below

void default_app_on_db_init_complete( void )
{
struct gapm_gen_rand_addr_cmd* cmd;
cmd = app_gapm_gen_rand_addr_msg_create();
app_gapm_gen_rand_addr_msg_send(cmd);

EXECUTE_DEFAULT_OPERATION_VOID(default_operation_adv);
return;
}

After receiving the generated random bd address, where I need to update.
As you told we can update it in gapm_start_advertise_cmd struct in the op->addr member (as shown in below)

__INLINE struct gapm_start_advertise_cmd* app_advertise_start_msg_create(void)
{
struct gapm_start_advertise_cmd* cmd = KE_MSG_ALLOC(GAPM_START_ADVERTISE_CMD,
TASK_GAPM, TASK_APP,
gapm_start_advertise_cmd);

cmd->op->addr = RetrieveAddress;
return(cmd);
}

But we are receiving the random address in user level, same way we need to pass the random address from user level.
There is any provision to access the "op->addr " from the user level. Please guide me which is the suitable place to update the op->addr.

Regards,
Mahesh Chandana.

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi Mahesh,

Hi Mahesh,

You can make a custom start advertising function without using the app_easy functions, allocate theGAPM_START_ADVERTISE_CMDmessage, fill it with the proper parameters and send it or, you can just change in the user_config.h the .address_src member to GAPM_PROVIDED_RND_ADDR and when start advertising invoke the app_easy_gap_undirected_advertise_get_active() then copy the generated address to the cmd->op.addr member and finally invoke the app_easy_gap_undirected_advertise_start().

Thanks MT_dialog

sprhawk
Offline
Last seen:3 years 1 month ago
加入:2016-03-03 17:25
Hi I have figured these

Hi I have figured these commands, but I'm not aware where to put the sequences.

I think I should invokeGAPM_GEN_RND_ADDRbefore starting advertising, but I found if I put the command in user_app_init(), theGAPM_BD_ADDR_INDis not returned.

only when I put the command inuser_app_adv_start它将工作。

But It should start advertising only I got the random address.

So How should I do with it ?

thank you

Mahesh
Offline
Last seen:3 years 4 months ago
加入:2016-01-04 14:03
Hi,

Hi,
do the following change as in "default_app_on_db_init_complete( void )" function
void default_app_on_db_init_complete( void )
{

struct gapm_gen_rand_addr_cmd* cmd;

//Create and send the command for generate the bd random address
cmd = app_gapm_gen_rand_addr_msg_create();
app_gapm_gen_rand_addr_msg_send(cmd);

//EXECUTE_DEFAULT_OPERATION_VOID(default_operation_adv);
return;
}

and then put the following case in "user_catch_rest_hndl ()" function
case GAPM_DEV_BDADDR_IND:
{
// Cast the void pointer to the appropriate message structure
struct gapm_dev_bdaddr_ind const *msg_param = (struct gapm_dev_bdaddr_ind const *)(param);

//Copying generated random address in a global array
memcpy(UAP_genRandAddr_mda, msg_param->addr.addr.addr, BD_ADDR_LEN);

user_app_adv_start();

} break;

then update the "cmd->op.addr.addr" inside the "user_app_adv_start()" function.

It is working for me.

Regards,
Mahesh Chandana

sprhawk
Offline
Last seen:3 years 1 month ago
加入:2016-03-03 17:25
Hi

Hi

Big help, I'll try. Thank you

Mahesh
Offline
Last seen:3 years 4 months ago
加入:2016-01-04 14:03
Hi,

Hi,
Thank you very much for your support.

Regards,
Mahesh Chandana.

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi sprhawk, Mahesh

Hi sprhawk, Mahesh

正如我在前面的帖子已经表示你已经发布ed every message during the user_app_init() is discarded since the stack gets reseted after the invokation of the function. In the post #6 "The idea is to call the above process during initialization of the device, for example when the setup of your database has been completed and then, after aquiring the bd_address you can start advertising." So you can generate the bd_address after your database gets initialized (send the command in the app_on_db_init_complete) or if dont have any database when the device configuration is complete (send the generate address command when app_on_set_dev_config_complete()). After you have aquired the bd_address (meaning in the handler that handler the GAPM_DEV_BDADDR_IND) you can copy the address in a variable and allocate your advertising command fill in the proper structures and send the message (as Mahesh suggested). Or you can wait for the GAPM_CMP_EVT (that indicates that the command has completed) and start advertising from that callback. This will ensure that the sequence of messages will be proper.

Also check this posthttp://support.dialog-semiconductor.com/question-about-generation-static...

Thanks MT_dialog

Mahesh
Offline
Last seen:3 years 4 months ago
加入:2016-01-04 14:03
Hi,

Hi,
It worked for me.

Thank you very much...

Regards,
Mahesh Chandana.

Topic locked