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

ERROR: FOTA download reverted to the previous version nRF9160.

Dear Nordic engineer.

I am using nrf9160.

I follow the instructions to download Fota using AWS upload file update.bin.

After the device has downloaded the file and receives the FOTA_DOWNLOAD_EVT_FINISHED event, the device reboots and runs to the new version.

But after a while, the device reboots and reverted to the old version before updating.

What do I need to do to fix this?

I use ncs 1.4.0 and firmware 1.2.3

Thank you.

# FOTA library
CONFIG_FOTA_DOWNLOAD=y

# DFU Target
CONFIG_DFU_TARGET=y

# Application Upgrade support
CONFIG_BOOTLOADER_MCUBOOT=y

  • Hi,

     

    Are you confirming the image in your new firmware?

    That can be done by calling this function:

    https://github.com/nrfconnect/sdk-nrf/blob/master/samples/nrf9160/aws_fota/src/main.c#L588-L591

     

    If that does not work, can you ensure that the overall flash layout is equal on both your original image and new image?

    This can be done by setting static partitions: http://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.4.99-dev1/nrf/scripts/partition_manager/partition_manager.html#configuring-static-partitions

     

    It essentially means that you take the original_project/build-folder/partitions.yml and copy this to the root of your new-application/ folder, and then reconfigure/recompile your new-application again.

     

    Kind regards,

    Håkon

  • Hi Håkon

    Sorry for reply late, 

    I added the function "boot_write_img_confirmed()" after get event "FOTA_DOWNLOAD_EVT_FINISHED"

    I have also added PM_STATIC_YML_FILE in CMakeList.txt

    #
    # Copyright (c) 2018 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    
    cmake_minimum_required(VERSION 3.8.2)
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    # include($ENV{ZEPHYR_BASE}/../nrf/cmake/boilerplate.cmake)
    # include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
    project(vtracker)
    
    set(PM_STATIC_YML_FILE
      ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static.yml
      )
    
    # NORDIC SDK APP START
    target_sources(app PRIVATE src/main.c)
    # NORDIC SDK APP END
    
    # Include application events and configuration headers

    I use the board nrf9160dk_nrf9160ns

    After I download it, the device will run to the new version ok. At the 3rd minute, I turn off the device and turn it on again, it doesn't work anymore, the screen shows the above revert message, please help me.

    Here is my pm_static file

    EMPTY_0:
      address: 0xc000
      placement:
        before:
        - mcuboot_pad
      region: flash_primary
      size: 0x4000
    app:
      address: 0x1c200
      region: flash_primary
      size: 0x68e00
    bsdlib_sram:
      address: 0x20010000
      placement:
        after:
        - spm_sram
        - start
      region: sram_primary
      size: 0x10000
    mcuboot:
      address: 0x0
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0xc000
    mcuboot_pad:
      address: 0x10000
      placement:
        align:
          start: 0x8000
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0x10000
      orig_span: &id001
      - mcuboot_pad
      - spm
      - app
      region: flash_primary
      sharers: 0x1
      size: 0x75000
      span: *id001
    mcuboot_primary_app:
      address: 0x10200
      orig_span: &id002
      - app
      - spm
      region: flash_primary
      size: 0x74e00
      span: *id002
    mcuboot_secondary:
      address: 0x85000
      placement:
        after:
        - mcuboot_primary
        align:
          start: 0x1000
      region: flash_primary
      share_size:
      - mcuboot_primary
      size: 0x75000
    nvs_storage:
      address: 0xfa000
      placement:
        before:
        - end
      region: flash_primary
      size: 0x6000
    otp:
      address: 0xff8108
      region: otp
      size: 0x2f4
    spm:
      address: 0x10200
      inside:
      - mcuboot_primary_app
      placement:
        before:
        - app
      region: flash_primary
      size: 0xc000
    spm_sram:
      address: 0x20000000
      inside:
      - sram_secure
      placement:
        after:
        - start
      region: sram_primary
      size: 0x10000
    sram_primary:
      address: 0x20020000
      region: sram_primary
      size: 0x20000
    sram_secure:
      address: 0x20000000
      orig_span: &id003
      - spm_sram
      region: sram_primary
      size: 0x10000
      span: *id003

    Thanks

  • haohv6 said:
    I added the function "boot_write_img_confirmed()" after get event "FOTA_DOWNLOAD_EVT_FINISHED"

    You should call this function in your new firmware to verify the newly downloaded image.

    Call it in the top of main, like done in aws_fota.

     

    Kind regards,

    Håkon

Related