Hello,
I am trying to enable the read protection on the NRF51822 on a custom board. By looking through the forums, I found different ways to try and enable the read protection.
According to the reference manual, bits 8 to 15 from RBPCONF must be set to 1 in order to enable the read protection for all the chip. RBPCONF is a RW register, so we should be able to write to the register directly.
So using sd_flash_write, I have this function.
void UTILS_EnableReadProtection (void){#ifdef RELEASE uint32_t RegisterValue;
RegisterValue = ~(0x0000FF00); // Check if read-back mechanism is turned ON. if((uint32_t)((NRF_UICR->RBPCONF & UICR_RBPCONF_PALL_Msk) >> UICR_RBPCONF_PALL_Pos) != UICR_RBPCONF_PALL_Enabled) { sd_flash_write((uint32_t *)&NRF_UICR->RBPCONF, &RegisterValue,1); } //nrf_nvmc_write_word(0x10001004, 0x0000FF00);#endif}
I tried both the method with sd_flash_write, or with nrf_nvmc_write_word to no avail. I tried with and without power cycle and still the same.
What am i missing here?
Thanks,
Jean-Francois