BD address customization

Learn MoreFAQsTutorials

6 posts / 0 new
Last post
moguilevski
Offline
Last seen:3 days 12 hours ago
Joined:2019-04-30 12:25
BD address customization

Dear Dialog Team,

is there any possibility to set the new custom or random BD address at every restart when OTP is not used? The method, decribedhere, which involves the modification ofaddr_typeandaddrmembers of theuser_gapm_confstructure, didn't work. The BD address is always set from the CFG_NVDS_TAG_BD_ADDRESS define.

Also, could you clarify the role ofnvds_get_func()(caseNVDS_TAG_BD_ADDRESS) from nvds.c?

Thank you and best regards!

Device:
PM_Dialog
Offline
Last seen:7 hours 21 min ago
Staff
Joined:2018-02-08 11:03
Hi moguilevski,

Hi moguilevski,

Thanks for your post online. If I understood correctly; you would like to advertise with a different DB address when the device boot. Please correct me if I a mistake. You could use a Random Static BD Address, so you should change the USER_CFG_ADDRESS_MODE macro in user_config.h header file to APP_CFG_ADDR_STATIC.

Thanks, PM_Dialog

moguilevski
Offline
Last seen:3 days 12 hours ago
Joined:2019-04-30 12:25
Hello PM_Dialog,

Hello PM_Dialog,

thank you for the reply. It works fine with the Random Static BD address. However, wenn I read the BD adderss from the NVDS it is still the public address defined by CFG_NVDS_TAG_BD_ADDRESS.

Should the addresses of the both type be stored in the device memory? Then where is the random static address stored?

bojanpotocnik
Offline
Last seen:1 month 3 weeks ago
Joined:2019-11-26 11:41
Dear Dialog Team,

Dear Dialog Team,

我们有几乎相同的案例——公共BD地址我s received via UART right after power-on and needs to be set programmatically, overriding CFG_NVDS_TAG_BD_ADDRESS define.

Using the following does not work (public_address variable is 6-byte buffer with received Public BD Address):

/* In arch_system.c::system_init(), BD address is read from OTP location OTP_HDR_BDADDR_ADDR * using otp_hdr_get_bd_address() and copied to dev_bdaddr variable. If OTP was not programmed, * dev_bdaddr will either be blank_otp_bdaddr (DA14531) or co_null_bdaddr (DA1458x). Variable * dev_bdaddr is then only used in nvds.c::nvds_get_func when tag is NVDS_TAG_BD_ADDRESS. * * In nvds.c::nvds_get_func(tag=NVDS_TAG_BD_ADDRESS), value of dev_bdaddr is checked and if * not blank/null, its value will be returned. Otherwise the user configuration value * nvds_data_storage.bd_address will be used, which is assigned to CFG_NVDS_TAG_BD_ADDRESS * (defined in da1458x_config_advanced.h) statically. This function is called from ROM code. */ extern struct bd_addr dev_bdaddr; /*< arch_system.c */ /* User configuration value (NVDS_TAG_BD_ADDRESS) does not need to be updated, because: * 1. It can't be, because nvds_data_storage is static const in nvds.c * 2. It is not used if dev_bdaddr is not blank/null */ /* Update value which was read from OTP in arch_system.c::system_init() */ memcpy(dev_bdaddr.addr, public_address, sizeof(dev_bdaddr.addr)); /* This function is not implemented (returns NVDS_FAIL), but try anyway */ nvds_put(NVDS_TAG_BD_ADDRESS, NVDS_LEN_BD_ADDRESS, dev_bdaddr.addr); /* Actually set current BD address */ lld_util_set_bd_address(&dev_bdaddr, 0);

Despite the fact that when reading it afterwards

struct bd_addr resp_addr; /* Read back set address */ lld_util_get_bd_address(&resp_addr);

the new address is actually set (resp_addr.addr == public_address), but when advertising is started afterwards, DA14585 advertises with old address.

Bases onCYibin's comment, the above shall work, but I suspect that only if set in user_app_init(). How to change the address later on - anytime?

EDIT: For anyone wondering, I have just discovered the working way. For setting public address, the following

/* Actually set current BD address */ lld_util_set_bd_address(&dev_bdaddr, 0);

must be replaced with

/* Also apply this address right away via Link Layer Manager */ llm_util_set_public_addr(&dev_bdaddr); llm_util_apply_bd_addr(0); /*< 0 = Public address */

read-back stays the same

/* Read back set address directly from the Link Layer Driver */ lld_util_get_bd_address(&resp_addr);

moguilevski
Offline
Last seen:3 days 12 hours ago
Joined:2019-04-30 12:25
Hello bojanpotocnik,

Hello bojanpotocnik,

thank you very much for your contribution.

PM_Dialog
Offline
Last seen:7 hours 21 min ago
Staff
Joined:2018-02-08 11:03
Hi bojanpotocnik,

Hi bojanpotocnik,

Thanks for your inputs and for your indication.

Thanks, PM_Dialog