nRF Cloud FOTA: Doesn't apply application firmware.

Hi all, I am experiencing some problems related to the installation of the new application firmware downloaded via FOTA.

I started from the nRF Rest Cloud Fota example, the code manages to identify itself on nRFCloud, manages to find the Update job, starts to download the new fw, but when it reboots, it starts again with the same previous code and does not apply the new one.

By searching on this site i follow : ERROR: FOTA download reverted to the previous version nRF9160 , in fact i setting the static partition and futhermore i add boot_write_img_confirmed().

There's the /{CurrentApplicationDir}(configuration/pm_static.yml 

EMPTY_0:
  address: 0x14200
  end_address: 0x18000
  placement:
    before:
    - s1_pad
  region: flash_primary
  size: 0x3e00
EMPTY_1:
  address: 0x24200
  end_address: 0x28000
  placement:
    before:
    - mcuboot_pad
  region: flash_primary
  size: 0x3e00
EMPTY_2:
  address: 0xfa000
  end_address: 0x100000
  placement:
    after:
    - settings_storage
  region: flash_primary
  size: 0x6000
app:
  address: 0x30000
  end_address: 0x90000
  region: flash_primary
  size: 0x60000
app_image:
  address: 0x28200
  end_address: 0x90000
  orig_span: &id001
  - tfm
  - app
  region: flash_primary
  size: 0x67e00
  span: *id001
b0:
  address: 0x0
  end_address: 0x8000
  placement:
    after:
    - start
  region: flash_primary
  size: 0x8000
b0_container:
  address: 0x0
  end_address: 0x8000
  orig_span: &id002
  - b0
  region: flash_primary
  size: 0x8000
  span: *id002
mcuboot:
  address: 0x8200
  end_address: 0x14200
  placement:
    before:
    - mcuboot_primary
  region: flash_primary
  sharers: 0x1
  size: 0xc000
mcuboot_pad:
  address: 0x28000
  end_address: 0x28200
  placement:
    align:
      start: 0x8000
    before:
    - mcuboot_primary_app
  region: flash_primary
  sharers: 0x2
  size: 0x200
mcuboot_primary:
  address: 0x28000
  end_address: 0x90000
  orig_span: &id003
  - mcuboot_pad
  - tfm
  - app
  region: flash_primary
  sharers: 0x1
  size: 0x68000
  span: *id003
mcuboot_primary_app:
  address: 0x28200
  end_address: 0x90000
  orig_span: &id004
  - app
  - tfm
  region: flash_primary
  size: 0x67e00
  span: *id004
mcuboot_secondary:
  address: 0x90000
  end_address: 0xf8000
  placement:
    after:
    - mcuboot_primary
    align:
      start: 0x8000
  region: flash_primary
  share_size:
  - mcuboot_primary
  size: 0x68000
mcuboot_sram:
  address: 0x20000000
  end_address: 0x20008000
  orig_span: &id005
  - tfm_sram
  region: sram_primary
  size: 0x8000
  span: *id005
nonsecure_storage:
  address: 0xf8000
  end_address: 0xfa000
  orig_span: &id006
  - settings_storage
  region: flash_primary
  size: 0x2000
  span: *id006
nrf_modem_lib_ctrl:
  address: 0x20008000
  end_address: 0x200084e8
  inside:
  - sram_nonsecure
  placement:
    after:
    - tfm_sram
    - start
  region: sram_primary
  size: 0x4e8
nrf_modem_lib_rx:
  address: 0x2000a568
  end_address: 0x2000c568
  inside:
  - sram_nonsecure
  placement:
    after:
    - nrf_modem_lib_tx
  region: sram_primary
  size: 0x2000
nrf_modem_lib_sram:
  address: 0x20008000
  end_address: 0x2000c568
  orig_span: &id007
  - nrf_modem_lib_ctrl
  - nrf_modem_lib_tx
  - nrf_modem_lib_rx
  region: sram_primary
  size: 0x4568
  span: *id007
nrf_modem_lib_tx:
  address: 0x200084e8
  end_address: 0x2000a568
  inside:
  - sram_nonsecure
  placement:
    after:
    - nrf_modem_lib_ctrl
  region: sram_primary
  size: 0x2080
otp:
  address: 0xff8388
  end_address: 0xff83fc
  region: otp
  size: 0x74
provision:
  address: 0xff8108
  end_address: 0xff8388
  region: otp
  size: 0x280
s0:
  address: 0x8000
  end_address: 0x14200
  orig_span: &id008
  - s0_pad
  - mcuboot
  region: flash_primary
  size: 0xc200
  span: *id008
s0_image:
  address: 0x8200
  end_address: 0x14200
  orig_span: &id009
  - mcuboot
  region: flash_primary
  size: 0xc000
  span: *id009
s0_pad:
  address: 0x8000
  end_address: 0x8200
  placement:
    after:
    - b0_container
    align:
      start: 0x8000
  region: flash_primary
  share_size:
  - mcuboot_pad
  size: 0x200
s1:
  address: 0x18000
  end_address: 0x24200
  orig_span: &id010
  - s1_pad
  - s1_image
  region: flash_primary
  size: 0xc200
  span: *id010
s1_image:
  address: 0x18200
  end_address: 0x24200
  placement:
    after:
    - s1_pad
    - s0
  region: flash_primary
  share_size:
  - mcuboot
  size: 0xc000
s1_pad:
  address: 0x18000
  end_address: 0x18200
  placement:
    after:
    - s0
    align:
      start: 0x8000
  region: flash_primary
  share_size:
  - mcuboot_pad
  size: 0x200
settings_storage:
  address: 0xf8000
  end_address: 0xfa000
  inside:
  - nonsecure_storage
  placement:
    align:
      start: 0x8000
    before:
    - end
  region: flash_primary
  size: 0x2000
sram_nonsecure:
  address: 0x20008000
  end_address: 0x20040000
  orig_span: &id011
  - sram_primary
  - nrf_modem_lib_ctrl
  - nrf_modem_lib_tx
  - nrf_modem_lib_rx
  region: sram_primary
  size: 0x38000
  span: *id011
sram_primary:
  address: 0x2000c568
  end_address: 0x20040000
  region: sram_primary
  size: 0x33a98
sram_secure:
  address: 0x20000000
  end_address: 0x20008000
  orig_span: &id012
  - tfm_sram
  region: sram_primary
  size: 0x8000
  span: *id012
tfm:
  address: 0x28200
  end_address: 0x30000
  inside:
  - mcuboot_primary_app
  placement:
    before:
    - app
  region: flash_primary
  size: 0x7e00
tfm_nonsecure:
  address: 0x30000
  end_address: 0x90000
  orig_span: &id013
  - app
  region: flash_primary
  size: 0x60000
  span: *id013
tfm_secure:
  address: 0x28000
  end_address: 0x30000
  orig_span: &id014
  - mcuboot_pad
  - tfm
  region: flash_primary
  size: 0x8000
  span: *id014
tfm_sram:
  address: 0x20000000
  end_address: 0x20008000
  inside:
  - sram_secure
  placement:
    after:
    - start
  region: sram_primary
  size: 0x8000



This is instead my prj.conf : 

# Sample
CONFIG_REST_FOTA_DO_JITP=n
CONFIG_NRF_CLOUD_REST_FOTA_SAMPLE_LOG_LEVEL_INF=y

# nRF Cloud REST
CONFIG_NRF_CLOUD_REST=y
CONFIG_NRF_CLOUD_CLIENT_ID_SRC_IMEI=n           #If you put Y you need to use nrf-123789137 deviceId
CONFIG_NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID=y  #Use the UUID as deviceId
CONFIG_MODEM_JWT=y
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_NATIVE=n

# FOTA download
CONFIG_FOTA_DOWNLOAD=y
CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
CONFIG_DFU_TARGET=y
CONFIG_DOWNLOAD_CLIENT=y

# MCUBOOT
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
CONFIG_SECURE_BOOT=y
CONFIG_BUILD_S1_VARIANT=y

# Settings
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_FCB=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_FCB=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

# Button/LED support
CONFIG_DK_LIBRARY=y

# Modem/LTE Link
CONFIG_NRF_MODEM_LIB_SYS_INIT=y
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_NETWORK_MODE_LTE_M=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n

# AT Host library - Used to send AT commands directy from an UART terminal and to allow
#		    integration with nRF Connect for Desktop LTE Link monitor application.
CONFIG_AT_HOST_LIBRARY=y

# Modem info
CONFIG_MODEM_INFO=y
CONFIG_MODEM_INFO_ADD_DEVICE=y
CONFIG_MODEM_INFO_ADD_NETWORK=y
CONFIG_MODEM_INFO_ADD_SIM=y
CONFIG_MODEM_INFO_ADD_SIM_ICCID=y
CONFIG_MODEM_INFO_ADD_SIM_IMSI=y

# System
CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192
CONFIG_ASSERT=y
CONFIG_REBOOT=y
CONFIG_FPU=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_NEWLIB_LIBC_FLOAT_SCANF=y

# Logging
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_UART_INTERRUPT_DRIVEN=y



Log received from the SerialTerminal of nRF Cloud during the last phase of FOTA

[00:01:01.841,094] <inf> dfu_target_mcuboot: MCUBoot image-0 upgrade scheduled. Reset device to apply
[00:01:01.851,776] <inf> nrf_cloud_rest_fota: FOTA download finished
+CEREG: 0
+CSCON: 0
[00:01:05.180,114] <inf> nrf_cloud_rest_fota: Rebooting in 10s to complete FOTA update...
*** Booting Zephyr OS build fcaa60a99fa9 ***
Attempting to boot slot 0.
Attempting to boot from address 0x8200.
Verifying signature against key 0.
Hash: 0xd7...e1
Firmware signature verified.
Firmware version 1
*** Booting Zephyr OS build fcaa60a99fa9 ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Bootloader chainload address offset: 0x28000
*** Booting Zephyr OS build fcaa60a99fa9 ***
[00:00:00.499,237] <inf> nrf_cloud_rest_fota: nRF Cloud REST FOTA Sample, version: 1.0.0
[00:00:00.508,117] <inf> nrf_cloud_rest_fota: Saved job: 62fa0eb1-5068-49ba-8755-37a19824567d, type: 0, validate: 1, bl: 0x0
[00:00:00.519,805] <inf> nrf_cloud_rest_fota: Application Name: nrf_cloud_rest_fota
[00:00:00.527,770] <inf> nrf_cloud_rest_fota: nRF Connect SDK version: v2.3.0




Am i missing something ? 


Thanks !!!

Parents Reply Children
No Data
Related