Reading more fields from Device unique ID?..

Learn MoreFAQsTutorials

2 posts / 0 new
Last post
alexsunny123
Offline
Last seen:2 months 1 day ago
加入:2020-11-17 12:37
Reading more fields from Device unique ID?..

Hello,

I want to allocate a 8-bytes unique-id to each OTP that I burn, in addition to the MAC address (broadcasting address).
In the Smart Snippets, under OTP Header, there are many fields called "Device unique ID", where the first two are used for the 6 bytes broadcasting address.

How do I read these fields in the program?
In nvds.c I found the code that reads the OTP broadcasting address.

void nvds_read_bdaddr_from_otp()
{
#ifdef BDADDR_FROM_OTP

#ifndef APP_BOOT_FROM_OTP
... // irrelevant code - in my compilation APP_BOOT_FROM_OTP is defined.
#else
uint8_t *otp_bdaddr = (uint8_t *)0x20000000 + BDADDR_FROM_OTP; //where in OTP header is BDADDR
#endif

memcpy(&dev_bdaddr, otp_bdaddr, sizeof(dev_bdaddr));
SetBits16(CLK_AMBA_REG, OTP_ENABLE, 0); //disable OTP clock
#ifdef SUPPORT_1_8_V
SetBits16(DCDC_CTRL2_REG, DCDC_VBAT3V_LEV, 0x0); ///--Support 1.8V boot
#endif

#endif
}

I can make a simple 8 bytes static array, and add the following line below the memcpy above:

memcpy(my_unique_id, (otp_bdaddr + 8), 8);

Is this the right way to do it?
Is there a different location that I should use to store identifiers for my own customized usage (to support future stacks, etc.)?
I have also seen fields called Customer Specific Fields at 0x47F54.

thanks

alexsunny

Device:
PM_Dialog
Offline
Last seen:16 hours 51 min ago
Staff
加入:2018-02-08 11:03
Hi alexsunny123,

Hi alexsunny123,

Thanks for your question online. So, if I understood correctly, that you would like to accomplish is to add another unique ID in the OPT expect from the Device BD Address? nvds_read_bdaddr_from_otp will try to get the address from OTP(0x7fd4) and copy the address value to " dev_bdaddr".

Thanks, PM_Dialog