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

Can't erase softdevice flash sectors.

I try to create a custom boot loader that enable to update soft device via data come in from SPI msg. When I try to use the command nrf_nvmc_page_erase() to erase the flash sector with start address 0x1000(containing soft device), the flash sector data still remain. I know that this function is working on my app flash sector(0x1c000). Is the softdevice flash sector protected? If it is, is there a way for me to update this flash sector?

Thanks, Kevin.

  • In the MPU section of the product specification it says that if the access to the memory region is not allowed then

    • No access 0 (NA0)
            No read or write access.
            Read will return 0.
            Write will have no effect.
    

    This most probably happens when you have set UICR->CLENR0 Then you flash is divided into two blocks. Quote from the spec

    The code area can be divided into two regions, code region 0 (CR0) and code region 1 (CR1). Code region 0 starts at address 0x00000000 and stretches into the code area as specified in the CLENR0 register. The area aboveCLENR0 will then be defined as code region 1. If CLENR0 is not configured, that is, has the value 0xFFFFFFFF, the whole code area will be defined as code region 1 (CR1).

    Code running from code region 1 will not be able to write to code region 0. Additionally, the content of code region 0 cannot be read from code running in code region 1 or through the SWD interface if code region 0 is readback protected, see PR0 in RBPCONF.

Related