I'm trying to read OTP memory with the following code:
int cnt = 100000;
SetBits16(CLK_AMBA_REG, OTP_ENABLE, 1); // enable OTP clock
while ((GetWord16(ANA_STATUS_REG) & LDO_OTP_OK) != LDO_OTP_OK && cnt--)
// set OTP in read mode
SetWord32(OTPC_MODE_REG, 0x1);
uint8_t *otp_major = (uint8_t *)0x47F54;
uint8_t *otp_minor = (uint8_t *)0x47F58;
memcpy(&user_beacon_config.major_ALT_val1, otp_major, 2);
memcpy(&user_beacon_config.minor_ALT_val2, otp_minor, 2);
SetBits16(CLK_AMBA_REG, OTP_ENABLE, 0); //disable OTP clock
I've written data to the OTP address 7F54: 6C 7F55: 00 7F56: 00 7F57: 00 7F58: 00 using the PLT
but it seems when the program is running, it's not grabbing the data correctly. My advertisement strings show both major and minor to be 0.
Alternatively to test this, can I just write the custom data field with values I want and leave the rest of the OTP header fields intact for programming at a later time? Field such as 32kHz field selection, BD Address, etc...?
Hi dlo,
我对你的工作issue and I will get back to you shortly.
Thanks, PM_Dialog
Hi PM_Dialog,
I think I got it sorted out, thanks for the support!
Hi dlo,
Glad that you figured your issue out.
Thanks, PM_Dialog