我正在使用SDK 3.0.6并尝试编写NVDS。但是,在启用读/写(#define nvds_read_write 1)时,尝试调用NVDS_put()导致链接器错误:“。\ out \ full_emb_sysram.axf:错误:l6218e:未定义的符号nvds_put(从nvds.o中引用)。“
如何写入NVDS?特别是我有兴趣配置设备的名称(NVDS_TAG_DEVICE_NAME)和BD地址(NVDS_TAG_BD_ADDRESS)。这两个都将通过来自主机MCU的外部命令配置为生产的一部分,并且对于制造的每个设备将是不同的。
你好Eli.iser,
I can see that
nvds_put
is not implemented in the code, hence the linker error. Unfortunately I don't have experience on working with external processor. To change your device name in advertisement packets, see fileapp_your_project_proj.c,特别是广告功能app_adv_func
. There you can find the structure gapm_start_advertise_cmd *cmd as a parameter. You can set advertising data and the device name with this pointer. To set the device name:memcpy(&cmd->info.host.adv_data[cmd->info.host.adv_data_len + 2], device_name_temp_buf, device_name_length);
Maybe this is not directly your interest, but here is an example of advertising data payload. You find your device name there. Length is 0x08 and type is 0x09 (complete local name)
0000 02 01 06 08 09 41 42 43 44 45 46 47 .....ABCDEFG
对不起,我无法帮助你
BD_ADDR
. The address is not a part of advertising dataThank you for the reply.
Yes, I am aware that I can change the device name at runtime each time the device starts. This is an acceptable workaround - reading the BT address and setting the device name to include it.
However, I must be able to change the BT address. From what I see, it can be stored either in OTP or in NVDS. We wish to set the BT address of each device during production. Is there another method of doing this?
你好Eli.iser,
Hopefully somebody knows better than me.
I guess changing BD_ADDR on the fly is not very easy. I only found hci read function for it.这是关于OTP the address, section 9.1 and page 18.
Filearch_main.ccalls
nvds_read_bdaddr_from_otp
function. That function is implemented innvds.c.. The function reads BD_ADDR from OTP memory and stores it to dev_bdaddr. I couldn't trace how this variable is actually used to ultimately set the address.I don't know if it's a good idea to modifyarch_main.cand make it read the BD_ADDR from the external processor instead from OTP (make it wait for, e.g., uart data).
I also found these registers fromdatasheet.h, but they are not documented in the actual datasheet:
#define BLE_BDADDRL_REG (0x40000024) /* BLE device address LSB register */
#define ble_bdaddru_reg(0x40000028)/ * BLE设备地址MSB寄存器* /
Hello Eli, I have asked the team to contact you to discuss : there are a couple of factors about your set-up that they will need to clarify. I have sent Robert a copy of this thread and asked him to get in touch as if i'm not mistaken, he visited you this week.
Hi VesaN, thanks for your comments again !
BR JE_Dialog
感谢您转发此问题以支持。事实上,罗伯特星期二访问过,但直到昨天我没有确定这个问题。
Hi, JE_Dialog,
I'm also interested in the issue that wether i can change the BD Address dynamicly by modify NVDS_TAG_BD_ADDRESS in NVDS especially after firmware burned.
We hope that BD Address of our device can be changed according to data received from uart.
Hi zuma,
The bd address as defined by the BLE specification has a few options, a device can carry a Public or a Random address and the Random address type is divided in Static and Private, then Private addresses are divided in Non-resolvable and Resolvable. I trust that the bd address that you would like to have is a public one (correct me if i am wrong). The device obtains the bd address during start up, in the nvds_read_bdaddr() function (the device checks from the where the bd address can be obtained either NVDS structure or OTP) and places the obtained value in the dev_bdaddr variable that holds the address of the device.
Regarding changing that during run time, if you are interested in something random the random address mode can do that for your but if you would like to specify an exact address obtained by the UART you will have to either provide the bd address before the nvds_read_bdaddr() runs and applies the bd address to the stack, or while the device is running obtain the bd address by the uart and copy it to the dev_bdaddr variable, then you will have to send a GAPM_RESET_CMD in order for the stack to take the new bd address. The above procedure is not tested since the bd address on a BLE device as the specification indicates is either fixed or random but if this is what you would like to do, this is a way you can do it.
Thanks MT_dialog