8 posts / 0 new
Last post
eli.iser
Offline
Last seen:6 years 3 months ago
加入:2014-04-13 07:54
Using nvds_put

I'm working with SDK 3.0.6 and trying to write the NVDS. However, when enabling read/write (#define NVDS_READ_WRITE 1), trying to call nvds_put() results in a linker error: ".\out\full_emb_sysram.axf: Error: L6218E: Undefined symbol nvds_put (referred from nvds.o)."

How can NVDS be written? Specifically I am interested in configuring the device's name (NVDS_TAG_DEVICE_NAME) and the BD address (NVDS_TAG_BD_ADDRESS). Both of these will be configured via an external command from a host MCU as part of production, and will be different for every device manufactured.

VesaN
Offline
Last seen:5 years 10 months ago
Guru Master
加入:2014-06-26 08:49
Hello eli.iser,

Hello eli.iser,

I can see thatnvds_putis 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, specifically advertising functionapp_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

Sorry, I can't help you withBD_ADDR. The address is not a part of advertising data

eli.iser
Offline
Last seen:6 years 3 months ago
加入:2014-04-13 07:54
Thank you for the reply.

Thank 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?

VesaN
Offline
Last seen:5 years 10 months ago
Guru Master
加入:2014-06-26 08:49
Hello eli.iser,

Hello 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.ccallsnvds_read_bdaddr_from_otpfunction. 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 */
#定义BLE_BDADDRU_REG (0 x40000028) / * BLE设备address MSB register */

JE_Dialog
Offline
Last seen:2 months 3 weeks ago
工作人员
加入:2013-12-05 14:02
Hello Eli, I have asked the

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

eli.iser
Offline
Last seen:6 years 3 months ago
加入:2014-04-13 07:54
Thank you for forwarding this

Thank you for forwarding this issue to support. Indeed, Robert visited on Tuesday, but I didn't identify this issue until yesterday.

zuma
Offline
Last seen:4 months 2 weeks ago
加入:2016-01-13 09:35
Hi, 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.

MT_dialog
Offline
Last seen:6 months 3 days ago
工作人员
加入:2015-06-08 11:34
Hi zuma,

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