With the DA14580 we used to write custom data to OTP header Custom Fields (specifically at address 0x47F54 and 0x47F56).
On the DA14585 the memory map for OTP changed and looking at the OTP header, I see Customer Specific Field starting at address 0x07F8FE20 (144 bytes available).
Previously I used to read the data written using:
uint8_t *otp_major = (uint8_t *)0x47F54;
uint8_t *otp_minor = (uint8_t *)0x47F56;
memcpy(&beacon_data[MAJOR], otp_major, 2);
memcpy(&beacon_data[MINOR], otp_minor, 2);
With the new DA14585, I thought I would just need to change it to:
uint8_t *otp_major = (uint8_t *)0x07F8FE20;
uint8_t *otp_minor = (uint8_t *)0x07F8FE22;
memcpy(&beacon_data[MAJOR], otp_major, 2);
memcpy(&beacon_data[MINOR], otp_minor, 2);
However, when I do this, the program no longer runs (it still compiles). I'll try and debug to see where it is failing, but please let me know if I'm interpreting the OTP mapping correctly.
Thank you,
I think enabling the OTP in the DA14585 is slightly different from the DA14580. I found a snippet in arch_system.c about reading the BD Address, so I modify it to work with the custom data field, the following code works and it won't crash anymore:
hw_otpc_init();
hw_otpc_manual_read_on(false);
memcpy(&beacon_data[MAJOR], (uint8_t *)OTP_HDR_CUSTOMER_FIELD_ADDR, 2);
memcpy(&beacon_data[MINOR], (uint8_t *)OTP_HDR_CUSTOMER_FIELD_ADDR+2, 2);
hw_otpc_manual_read_off();
hw_otpc_close();
Hi dlo,
Thanks for sharing your finding on the community! Yes, enabling the OTP is DA14585 is ilttle bit different form the DA4585. Did you manage to solve this crash, or ou need furhter support?
Additionally, in case of DA14585 there is no need for 6.8V programming voltage as in DA14580. Please see datasheets for more information.
Thanks, PM_Dialog
Thanks for checking in PM,
The crash was due to not having enabled OTP properly before reading. memcopy would crash because it could not access the memory location.
Cheers,
Hi dlo,
Thanks for the indication.
Regards, PM_Dialog