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

HardFault Error after calling nrf_nvmc_page_erase

Hello Support

When calling the function nrf_nvmc_page_erase(0xF7000) (In nrf_nvmc.c) I immediately get a Hardfault error when the code reaches the line where it calls wait_for_flash_ready(); which reads the NRF_NVMC->READY register.

This is my setup:

MBR calls my Bootloader (address 0xE0000). 

Bootloader works fine, it can erase and write the internal FLASH with no problems. The Bootloader is not using softdevice (not defining -DSOFTDEVICE_PRESENT).

Bootloader calls Application image using the function nrf_bootloader_app_start(), jumping to image at address 0x26000.

Application image then runs executing from main()

When calling nrf_nvmc_page_erase(0xF7000) in the Application image (e.g. as the first line in main(void) i get the HardFault error.

Application has defined -DSOFTDEVICE_PRESENT but softdevice is not enabled (never called nrf_sdh_enable_request();)

Question: What can cause this Hardfault? Some clock not enabled? Why can the bootloader call the erase page and not the application image? Some restriction when executing from Application area?

 

Parents Reply Children
  • Hello Sigurd. I solved the issue by using your hint that ACL is in use. It was indeed the ACL block that prohibited me to write at the area I had designed to use for a proprietary data.

    So my bootloader called nrf_bootloader_app_start_final which again called nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, BOOTLOADER_SIZE + NRF_MBR_PARAMS_PAGE_SIZE, NRF_BOOTLOADER_READ_PROTECT);

    So I solved the issue by decreasing the BOOTLOADER_SIZE value thereby allowing my application to erase the data at 0xF7000 where my proprietary data resides.

Related