Can I modify the value of ucir in my application? If yes, How to do it?
Can I modify the value of ucir in my application? If yes, How to do it?
Yes you can, simply write to UICR->xxx
address (must be 32-bit aligned and better not overwrite some significant registers;)
Hi Endnode, Thanks for your feedback I have tried the code below: #define UICR_CUSTOM_ADDRESS 0x10001080
*((uint32_t *)UICR_CUSTOM_ADDRESS) = 0x12345678;
printf("UICR:%8x ",(*(uint32_t *)UICR_CUSTOM_ADDRESS));
But I still get "UICR:ffffffff". Can you tell me what is the right way to modify UICR->CUSTOMER ? Thanks Frank
Your code is correct, I have tested it and get correct reading. Note that UICR registers are located in flash, and it can take up to 338 us to write one word. Try adding a short delay before reading back the value, to make sure it have enough time to be written to flash.