How to change BD address dynamically?

14 posts / 0 new
Last post
summer20100514
Offline
Last seen:4 years 2 months ago
Guru
加入:2014-12-30 05:01
How to change BD address dynamically?

I can change BD address during startup, for example, I add some code in custom_nvds_get_func() to load BD address from an external FLASH. But I can't change it later. Is there any way to change BD addresswhenever neededafter startup?

JE_Dialog
Offline
Last seen:5天1小时前
工作人员
加入:2013-12-05 14:02
Hi There, please see

Hi There, please see following post which i beleive covers your quetsion.

http://support.dialog-semiconductor.com/bd-address-external-memory

BR JE_Dialog

summer20100514
Offline
Last seen:4 years 2 months ago
Guru
加入:2014-12-30 05:01
I am afraid you misunderstand

I am afraid you misunderstand my question. I read the post already, I want to change the BD address dynamically, but the solution in the post can only change the BD address once.

summer20100514
Offline
Last seen:4 years 2 months ago
Guru
加入:2014-12-30 05:01
I am blocking by this issue

I am blocking by this issue all day long, can you help me?

summer20100514
Offline
Last seen:4 years 2 months ago
Guru
加入:2014-12-30 05:01
Any suggestions?

Any suggestions?

VesaN
Offline
Last seen:5 years 4 months ago
Guru Master
加入:2014-06-26 08:49
Hello summer20100514,

Hello summer20100514,

Maybe this document is helpful?

To use the described method you need to obtain IRK via bonding.

Can you describe more your issue?

summer20100514
Offline
Last seen:4 years 2 months ago
Guru
加入:2014-12-30 05:01
Thank, but I have already add

Thank, but I have already add the code to achieve the functionalities as discussed in the document you point out, which is a resolvable private address solution. It works well. But my question is, can I configure the BD address whenever I want, such as using an app to configure it. Or I have no need to do so, because the BD address is already changing from time to time??? Maybe I don't make the thing clearly.

VesaN
Offline
Last seen:5 years 4 months ago
Guru Master
加入:2014-06-26 08:49
Hello summer20100514,

Hello summer20100514,

In core definition 4.1 vol 3 p. 384 it says:

A device may choose to initialize its static address to a new value after each power cycle. A device shall not change its static address value once initialized until the device is power cycled.

I doubt you need to change the address yourself

PY_Dialog
Offline
Last seen:2 years 8 months ago
工作人员
加入:2014-08-25 09:59
Hi summer20100514,

Hi summer20100514,

You can change BD address, but to make it take effect, you have to reset radio. Please use GAPM_RESET message to reset your radio every time you change your bd address.

Regards!
PY

summer20100514
Offline
Last seen:4 years 2 months ago
Guru
加入:2014-12-30 05:01
I tested GAPM_RESET command,

I tested GAPM_RESET command, and the BD address changed, but there is still something confuses me. I add the following code in custom_nvds_get_func()

for(uint8_t i = 0; i < 6; i++)
{
buf[i] = reload_bd_addr[i];
}
reload_bd_addr[0] += 1;

and in the function gattc_write_cmd_ind_handler() of my service

// reset the lower layers.
struct gapm_reset_cmd* cmd = KE_MSG_ALLOC(GAPM_RESET_CMD, TASK_GAPM, TASK_APP,
gapm_reset_cmd);
cmd->operation = GAPM_RESET;
ke_msg_send(cmd);

the result

  1. after initialization, the BD address is 00 00 00 00 00 01
  2. after I write something to my service, the the BD address is 00 00 00 00 00 03, but I can't find my service anymore, onlyGeneric AccessandGeneric Attributeleft

My question

  1. why is the BD addressget increased by 2 instead of 1?
  2. why do I can't find my serviceafter sending an GAPM_RESET command?
PY_Dialog
Offline
Last seen:2 years 8 months ago
工作人员
加入:2014-08-25 09:59
Hi summer20100514,

Hi summer20100514,

1. check whether you run this code twice.
2. you also need to reinit your profile service to after reset.

Regards!
PY

summer20100514
Offline
Last seen:4 years 2 months ago
Guru
加入:2014-12-30 05:01
I guess the function custom

I guess the function custom_nvds_get_func() is called by stack, so I can't figure out whether it is called twice.

summer20100514
Offline
Last seen:4 years 2 months ago
Guru
加入:2014-12-30 05:01
Would the support team be

Would the support team be kind to answer this?

PY_Dialog
Offline
Last seen:2 years 8 months ago
工作人员
加入:2014-08-25 09:59
Hi Summer,

Hi Summer,

You can turn off sleep mode in da14580_config.h by comment out CFG_EXT_SLEEP and CFG_DEEP_SLEEP. Then use debug and break point to track your program.

Regards!
PY