This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UICR registers protection from erase/write operations

Dear Nordic developers,

I want to write 24 bytes constant in Non-volatile Memory. Additionally, I want that this data can only be read by MCU and not being rewritten or erased.

I'm not using softdevice.

I'm thinkng to use UICR registers starting from 0x10001080 address. But I'm not sure how to protect the data not to be rewritten and read by other peripherals than MCU. Can you please tell is this possible or no?

I know that I can use code memory by deviding it in CR0 and CR1 regions and save my data in CR0. In this case I don't know how exactly should I write my data into CR0?

I'd highly appreciate any advice.

Best regards, Harut

Parents
  • Hi Harut, do you want to be able update the 24 bytes at runtime? Note that the UICR registers at cannot be erased without doing NVMC.ERASEALL, but the CPU can still clear existing '1's by writing '0's. E.g., 0b1111 -> 0b0011.

    Depending on your requirements you might be able to use code region protection. Code region 0 will always have full access to CR0 and CR1, see SD runtime protection for more details. Another option is to use the NVM protection blocks (nRF51 RM,chpt. 9.1.5)

  • Hi, the NVM blocks are actually 4KB and range from address 0x0 to 0x40000 (0x20000 on 128K parts) and are enabled at runtime. I think this might be the best option unless you are short on flash space. If you choose to store your data in CR0 you would to implement forwarding of interrupts and program execution to your application. Thus, making it a bit more complicated.

    Const data can be linked to a specific location in flash by using the at attribute if you're using Keil. You can then use the .map file (see build output) to verify the placement.

Reply
  • Hi, the NVM blocks are actually 4KB and range from address 0x0 to 0x40000 (0x20000 on 128K parts) and are enabled at runtime. I think this might be the best option unless you are short on flash space. If you choose to store your data in CR0 you would to implement forwarding of interrupts and program execution to your application. Thus, making it a bit more complicated.

    Const data can be linked to a specific location in flash by using the at attribute if you're using Keil. You can then use the .map file (see build output) to verify the placement.

Children
No Data
Related