Hello,
I would like to use the UICR customer registers to store our devices serial numbers.
Can you please point me to some example code for nRF52833 SoC.
I am using nRF Connect SDK v1.7.0.
Thank you for your help.
Hello,
I would like to use the UICR customer registers to store our devices serial numbers.
Can you please point me to some example code for nRF52833 SoC.
I am using nRF Connect SDK v1.7.0.
Thank you for your help.
#include <zephyr.h> #include <nrfx_nvmc.h> void main(void) { nrfx_nvmc_word_write(&NRF_UICR->CUSTOMER[0], 0x00); return; }
Thank you Haakonsh.
Good Morning Haakonsh,
I am now back working on the write and read of the UICR register.
I am finding I can write to and read from it but the problem each time I flash the firmware in the device I lose the content of the UICR. The next read is 0xffffffff. I expected the UICR content will remain protected until it is written to again. I am inserting snippets of the code below.
If I flash the debug build (CONFIG_DEBUG_PORT_ACCESS=y) of the firmware from SES Nordic Edition v5.60 then the UICR content is preserved. However, if I use nRF Programmer v2.3.3 then the content of the UICR being erased.
Note, when using nRF Programmer only the 'Erase & write' option is available. The 'Write' only option is disabled, see attached screen shot below.
void system_write_dev_id( uint32_t hb_id ) { /* Allow UICR access */ NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen; while (NRF_NVMC->READY == NVMC_READY_READY_Busy) { } /* Set new value for the id */ NRF_UICR->CUSTOMER[0] = hb_id; /* Disallow UICR access */ NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren; while (NRF_NVMC->READY == NVMC_READY_READY_Busy) { } } /* Read the programmed UICR device id */ memcpy( &dev_id, (uint32_t*)0x10001080, 4 );
Can you spot anything I am doing missing or doing wrong?
PS Case ID: 280741 deals with the same problem but I could not find a solution there.
I think the problem is in the way I am flashing the target but I am not sure how to configure nRF Programmer in order NOT to erase the UICR register.
Thank you.
Hello Mohamed,
What is the current state on this issue?
Best regards,
Simon
Hi Simon,
Although I can write to and read from UICR I am still facing the problem of the UICR content being erased (on nRF52833 QDAAA0 SoC)
1- After I start a debug session in SES v5.60
2- Or use nRF Programmer v2.3.3 to flash a merged,hex image
This is now being dealt under Case ID: 290765.
Kind regards
Mohamed
Learner said:This is now being dealt under Case ID: 290765.
Do you want to continue the discussion there, and close this ticket?
Best,
Simon
Yes, pleas close it because I don't know how to.
Yes, pleas close it because I don't know how to.