我想修改Beacon示例以从OTP NVDS中拉动主要值和次要值。
OTP NVDS will be programmed with different values during production (BD Address, Major, Minor) to act as various serial numbers.
Do I need to add a field in the nvds_data_struct to define the major and minor field? i.e.
struct nvds_data_struct {
uint32_t NVDS_VALIDATION_FLAG; // define which fields are valid
uint32_t NVDS_TAG_UART_BAUDRATE;// UART baudrate
uint32_t NVDS_TAG_DIAG_SW; // Diagport configuration
uint32_t NVDS_TAG_DIAG_BLE_HW; // Diagport configuration
uint16_t NVDS_TAG_NEB_ID; // Neb Session ID
uint16_t NVDS_TAG_LPCLK_DRIFT; // Low power clock accourancy
uint8_t NVDS_TAG_SLEEP_ENABLE; // Enable sleep mode
uint8_t NVDS_TAG_EXT_WAKEUP_ENABLE; //External wakeup enable
uint8_t NVDS_TAG_SECURITY_ENABLE; //Enable security for BLE application
uint8_t ADV_DATA_TAG_LEN; // Advertise data size
uint8_t SCAN_RESP_DATA_TAG_LEN; // Scan response data size
uint8_t DEVICE_NAME_TAG_LEN; // Device name size
uint8_t NVDS_TAG_APP_BLE_ADV_DATA[32]; // Advertise data
uint8_t NVDS_TAG_APP_BLE_SCAN_RESP_DATA[32]; // Scan response data
uint8_t NVDS_TAG_DEVICE_NAME[62]; // Device name
uint8_t NVDS_TAG_BD_ADDRESS[6]; // Device Bluetooth address
uint16_t NVDS_TAG_BLE_CA_TIMER_DUR; // Default Channel Assessment Timer duration
uint8_t NVDS_TAG_BLE_CRA_TIMER_DUR; // Default Channel Reassessment Timer duration
uint8_t NVDS_TAG_BLE_CA_MIN_RSSI;// Default Minimal RSSI Threshold
uint8_t NVDS_TAG_BLE_CA_NB_PKT; // Default number of packets to receive for statistics
uint8_t NVDS_TAG_BLE_CA_NB_BAD_PKT;// Default number of bad packets needed to remove a channel
uint16_t NVDS_TAG_MAJOR;// Major advertising data
UINT16_T NVDS_TAG_MINOR; //次要广告数据
};
and then during the initializing portion of the code:
const struct user_beacon_config_tag user_default_beacon_config = {
.uuid = {0xC3, 0x8B, 0x2D, 0x50, 0xBE, 0xE8, 0xCE, 0x52, 0x14, 0xA6, //10-byte Namespace
0xF3, 0xA7, 0xC6, 0x99, 0x2F, 0x0B},//6-byte Instance
.major_ALT_val1 = NVDS_TAG_MAJOR, //Major Value
.minor_ALT_val2 = NVDS_TAG_MINOR, //Minor Value
.雷电竞下载appcompany_id = Apple_Comp_id,// Beacon公司ID
.adv_int = BEACON_ADVERTISING_INTERVAL, //Advertising interval
.power = 0xC5, //Tx Power
.beacon_type = DEFAULT_BEACON_TYPE,
.url_prefix = HTTPWWW,
.url = { 0x0E, 'd','i','a','s','e','m','i',DOTCOM},
.TLM_version = 0x00,
.TLM_used =0x01
};
由于我们需要在OTP上测试这一点,因此由于其一次可编程,因此难以进行试用和错误而不会浪费很多部件。
Thank you for your help!
Hi,
您在OTP中添加私有参数的方式无法保证工作。您可以直接将参数存储在可用的OTP地址中,并直接从地址读取。
问候,
yhe_Dialog
Hello,
So I could create a pointer to the NVDS address, for example:
uint16_t *nvds_tag_major = 0x20000360; // Major advertising data pointer
uint16_t *nvds_tag_minor = 0x20000364; // Minor advertising data pointer
const struct user_beacon_config_tag user_default_beacon_config = {
.uuid = {0xC3, 0x8B, 0x2D, 0x50, 0xBE, 0xE8, 0xCE, 0x52, 0x14, 0xA6, //10-byte Namespace
0xF3, 0xA7, 0xC6, 0x99, 0x2F, 0x0B},//6-byte Instance
.major_ALT_val1 = nvds_tag_major, //Major Value
.minor_ALT_val2 = nvds_tag_minor, //Minor Value
.雷电竞下载appcompany_id = Apple_Comp_id,// Beacon公司ID
.adv_int = BEACON_ADVERTISING_INTERVAL, //Advertising interval
.power = 0xC5, //Tx Power
.beacon_type = DEFAULT_BEACON_TYPE,
.url_prefix = HTTPWWW,
.url = { 0x0E, 'd','i','a','s','e','m','i',DOTCOM},
.TLM_version = 0x00,
.TLM_used =0x01
};
and then use the PLT to write data to the NVDS location?
What is the recommended way to generate a sequential number to be programmed to that NVDS memory location? Is there a script in the PLT tool to accomplish this?
Thank you for your continued support!
Hi,
不建议修改OTP nvd。In PLT, there is way to burn customer specific field into OTP header. Check Section 7.2.8 of UM-B-041.
In your firmware, you can just read it out from the right OTP field and apply it.
问候,
yhe
Thank you yhe,
One last question if you get to answer it before I find it in the documentations. What is the memory address of the OTP customer field so I can assign MAJOR = &0xXXXX and MINOR = &0xXXXX ?
Thank you for the prompt support!
I think I found the information: Custom Specific Field is at word addresses 0x7F54 to 0x7F60. If these addresses are mirrored to RAM on power up, does it mean the variables can be found at RAM addresses: 0x20007F54 to 0x20007F60?
Thank you,
dlo
Hi,
I do not think the OTP header will be mirrored to RAM. In your firmware, you need to read your Custom Specific Field directly from OTP.
问候,
yhe