Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_fstorage_erase fails to erase bootloader settings during Application update

I use SDK 15.3 and SD S340 v 6.1.1. Bootloader is designed to do custom update through GSM; code based on secure bootloader ble example from SDK.
I have used code that previously worked with S332 Softdevice and SDK 14.2 before, just updating it to above mentioned new versions.


The problem occurs during update process, when request to erase old bootloader settings is done. 

DEBUG1   >> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 0.

Code jumps to bear error handler with error:

<error> app: Received a fault! id: 0x00001001, pc: 0x000ECDD2, info: 0x40000000

Here is partial log:

2020-07-15 15:44:50,526, DEBUG1 >> <debug> app: DFU CM_DFU_WRITE_OBJECT data p: 257 size: 142 start: 27 first byte 12
2020-07-15 15:44:50,527, DEBUG1 >>
2020-07-15 15:44:50,537, DEBUG1 >> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (command)
2020-07-15 15:44:50,537, DEBUG1 >>
2020-07-15 15:44:50,545, DEBUG1 >> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
2020-07-15 15:44:50,545, DEBUG1 >>
2020-07-15 15:44:50,548, DEBUG1 >> <debug> app: CALLBACK TRIGGERED
2020-07-15 15:44:50,548, DEBUG1 >>
2020-07-15 15:44:50,556, DEBUG1 >> <debug> app: DFU current status: CM_DFU_WRITE_FW_SIGNATURE_OBJECT next: CM_DFU_VALIDATE_SIGNATURE
2020-07-15 15:44:50,557, DEBUG1 >>
2020-07-15 15:44:50,559, DEBUG1 >> <debug> app: CM_DFU_VALIDATE_SIGNATURE
2020-07-15 15:44:50,559, DEBUG1 >>
2020-07-15 15:44:50,563, DEBUG1 >> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
2020-07-15 15:44:50,563, DEBUG1 >>
2020-07-15 15:44:50,569, DEBUG1 >> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_CRC_GET (command)
2020-07-15 15:44:50,569, DEBUG1 >>
2020-07-15 15:44:50,573, DEBUG1 >> <debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
2020-07-15 15:44:50,574, DEBUG1 >>
2020-07-15 15:44:50,576, DEBUG1 >> <debug> app: CALLBACK TRIGGERED
2020-07-15 15:44:50,576, DEBUG1 >>
2020-07-15 15:44:50,581, DEBUG1 >> <debug> app: offset: 0:x0000008E, CRC:0xA5AA017F
2020-07-15 15:44:50,581, DEBUG1 >>
2020-07-15 15:44:50,586, DEBUG1 >> <debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (command)
2020-07-15 15:44:50,586, DEBUG1 >>
2020-07-15 15:44:50,589, DEBUG1 >> <debug> nrf_dfu_validation: PB: Init packet data len: 65
2020-07-15 15:44:50,589, DEBUG1 >>
2020-07-15 15:44:50,594, DEBUG1 >> <debug> app: Enter nrf_dfu_cache_prepare()
2020-07-15 15:44:50,594, DEBUG1 >>
2020-07-15 15:44:50,598, DEBUG1 >> <debug> app: required_size: 0x2FC18.
2020-07-15 15:44:50,598, DEBUG1 >>
2020-07-15 15:44:50,600, DEBUG1 >> <debug> app: single_bank: false.
2020-07-15 15:44:50,600, DEBUG1 >>
2020-07-15 15:44:50,605, DEBUG1 >> <debug> app: keep_app: false.
2020-07-15 15:44:50,605, DEBUG1 >>
2020-07-15 15:44:50,607, DEBUG1 >> <debug> app: keep_softdevice: true.
2020-07-15 15:44:50,607, DEBUG1 >>
2020-07-15 15:44:50,609, DEBUG1 >> <debug> app: SD_PRESENT: true.
2020-07-15 15:44:50,609, DEBUG1 >>
2020-07-15 15:44:50,611, DEBUG1 >> <debug> app: Bank contents:
2020-07-15 15:44:50,611, DEBUG1 >>
2020-07-15 15:44:50,614, DEBUG1 >> <debug> app: Bank 0 code: 0x01: Size: 0x2FC18
2020-07-15 15:44:50,614, DEBUG1 >>
2020-07-15 15:44:50,619, DEBUG1 >> <debug> app: Bank 1 code: 0x00: Size: 0x0
2020-07-15 15:44:50,619, DEBUG1 >>
2020-07-15 15:44:50,621, DEBUG1 >> <debug> app: pass: 0.
2020-07-15 15:44:50,621, DEBUG1 >>
2020-07-15 15:44:50,623, DEBUG1 >> <debug> app: cache_address: 0x61000.
2020-07-15 15:44:50,623, DEBUG1 >>
2020-07-15 15:44:50,626, DEBUG1 >> <debug> app: cache_too_small: false.
2020-07-15 15:44:50,626, DEBUG1 >>
2020-07-15 15:44:50,629, DEBUG1 >> <debug> app: keep_firmware: false.
2020-07-15 15:44:50,630, DEBUG1 >>
2020-07-15 15:44:50,632, DEBUG1 >> <debug> app: delete_more: false.
2020-07-15 15:44:50,632, DEBUG1 >>
2020-07-15 15:44:50,635, DEBUG1 >> <debug> nrf_dfu_validation: Write address set to 0x00061000
2020-07-15 15:44:50,635, DEBUG1 >>
2020-07-15 15:44:50,638, DEBUG1 >> <debug> nrf_dfu_settings: Writing settings...
2020-07-15 15:44:50,638, DEBUG1 >>
2020-07-15 15:44:50,644, DEBUG1 >> <debug> nrf_dfu_settings: Erasing old settings at: 0x000FF000
2020-07-15 15:44:50,644, DEBUG1 >>
2020-07-15 15:44:50,650, DEBUG1 >> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x000FF000, len=1 pages), queue usage: 0
2020-07-15 15:44:50,650, DEBUG1 >>
2020-07-15 15:44:50,657, DEBUG1 >> <error> app: Received a fault! id: 0x00001001, pc: 0x000ECDD2, info: 0x40000000
2020-07-15 15:44:50,657, DEBUG1 >>
2020-07-15 15:44:50,807, DEBUG1 >> <info> app: Inside main
2020-07-15 15:44:50,807, DEBUG1 >>
2020-07-15 15:44:50,809, DEBUG1 >> <debug> app: In nrf_bootloader_init
2020-07-15 15:44:50,809, DEBUG1 >>
2020-07-15 15:44:50,814, DEBUG1 >> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
2020-07-15 15:44:50,814, DEBUG1 >>
2020-07-15 15:44:50,820, DEBUG1 >> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
2020-07-15 15:44:50,820, DEBUG1 >>
2020-07-15 15:44:50,823, DEBUG1 >> <debug> nrf_dfu_settings: Using settings page.
2020-07-15 15:44:50,823, DEBUG1 >>
2020-07-15 15:44:50,827, DEBUG1 >> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
2020-07-15 15:44:50,827, DEBUG1 >>
2020-07-15 15:44:50,833, DEBUG1 >> <info> nrf_dfu_settings: Old settings page detected. Upgrading info.
2020-07-15 15:44:50,833, DEBUG1 >>
2020-07-15 15:44:50,839, DEBUG1 >> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
2020-07-15 15:44:50,839, DEBUG1 >>
2020-07-15 15:44:50,846, DEBUG1 >> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
2020-07-15 15:44:50,846, DEBUG1 >>
2020-07-15 15:44:50,852, DEBUG1 >> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
2020-07-15 15:44:50,852, DEBUG1 >>
2020-07-15 15:44:50,857, DEBUG1 >> <debug> app: Enter nrf_bootloader_fw_activate
2020-07-15 15:44:50,857, DEBUG1 >>
2020-07-15 15:44:50,861, DEBUG1 >> <info> app: No firmware to activate.
2020-07-15 15:44:50,861, DEBUG1 >>
2020-07-15 15:44:51,107, DEBUG1 >> <debug> app: App is valid
2020-07-15 15:44:51,107, DEBUG1 >>
2020-07-15 15:44:51,112, DEBUG1 >> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.


Bootloader settings:
Bootloader DFU Settings:
* File: ******.hex
* Family: NRF52840
* Start Address: 0x000FF000
* CRC: 0x598F13CA
* Settings Version: 0x00000001 (1)
* App Version: 0x00000001 (1)
* Bootloader Version: 0x00000001 (1)
* Bank Layout: 0x00000000
* Current Bank: 0x00000000
* Application Size: 0x0002FC18 (195608 bytes)
* Application CRC: 0x488CD092
* Bank0 Bank Code: 0x00000001
* Softdevice Size: 0x00000000 (0 bytes)
* Boot Validation CRC: 0x00000000
* SD Boot Validation Type: 0x00000000 (0)
* App Boot Validation Type: 0x00000000 (0)

Any suggestions ?

Parents
  • Found that it fails trying to enable erase in nrf_nvm.c, but do not know the reason of failure. See attached screen 

  • Hi Seg, 
    Error id 0x00001001 indicate that it's a NRF_FAULT_ID_APP_MEMACC:

    #define NRF_FAULT_ID_APP_MEMACC   (NRF_FAULT_ID_APP_RANGE_START + 1)          /**< Application invalid memory access. The info parameter will contain 0x00000000,
                                                                                       in case of SoftDevice RAM access violation. In case of SoftDevice peripheral
                                                                                       register violation the info parameter will contain the sub-region number of
                                                                                       PREGION[0], on whose address range the disallowed write access caused the
                                                                                       memory access fault. */

    Could you check what do you have at address 0x000ECDD2 in the code  ? 
    When you use the fstorage, have you got the softdevice enabled ? If it's enabled you should use the sd backend not the NVMC. It could be the reason for the fault.  

Reply
  • Hi Seg, 
    Error id 0x00001001 indicate that it's a NRF_FAULT_ID_APP_MEMACC:

    #define NRF_FAULT_ID_APP_MEMACC   (NRF_FAULT_ID_APP_RANGE_START + 1)          /**< Application invalid memory access. The info parameter will contain 0x00000000,
                                                                                       in case of SoftDevice RAM access violation. In case of SoftDevice peripheral
                                                                                       register violation the info parameter will contain the sub-region number of
                                                                                       PREGION[0], on whose address range the disallowed write access caused the
                                                                                       memory access fault. */

    Could you check what do you have at address 0x000ECDD2 in the code  ? 
    When you use the fstorage, have you got the softdevice enabled ? If it's enabled you should use the sd backend not the NVMC. It could be the reason for the fault.  

Children
Related