able to do the OTA but when reset the nRF 7002dk kit then take old code

I used SDK v2.6.2 with the nRF7002 DK kit.i used mcu boot secondary with external flash. 

I was able to perform OTA using the nRF Connect app, but after resetting the DK kit, it reverts to the older firmware. How can I resolve this issue?

EMPTY_0:
address: 0xfe000
end_address: 0x100000
placement:
after:
- settings_storage
region: flash_primary
size: 0x2000
app:
address: 0x10200
end_address: 0xfc000
region: flash_primary
size: 0xebe00
external_flash:
address: 0xec000
end_address: 0x800000
region: external_flash
size: 0x714000
mcuboot:
address: 0x0
end_address: 0x10000
placement:
before:
- mcuboot_primary
region: flash_primary
size: 0x10000
mcuboot_pad:
address: 0x10000
end_address: 0x10200
placement:
before:
- mcuboot_primary_app
region: flash_primary
size: 0x200
mcuboot_primary:
address: 0x10000
end_address: 0xfc000
orig_span: &id001
- mcuboot_pad
- app
region: flash_primary
size: 0xec000
span: *id001
mcuboot_primary_app:
address: 0x10200
end_address: 0xfc000
orig_span: &id002
- app
region: flash_primary
size: 0xebe00
span: *id002
mcuboot_secondary:
address: 0x0
device: DT_CHOSEN(nordic_pm_ext_flash)
end_address: 0xec000
placement:
align:
start: 0x4
region: external_flash
share_size:
- mcuboot_primary
size: 0xec000
otp:
address: 0xff8100
end_address: 0xff83fc
region: otp
size: 0x2fc
rpmsg_nrf53_sram:
address: 0x20070000
end_address: 0x20080000
placement:
before:
- end
region: sram_primary
size: 0x10000
settings_storage:
address: 0xfc000
end_address: 0xfe000
placement:
align:
start: 0x4000
before:
- end
region: flash_primary
size: 0x2000
sram_primary:
address: 0x20000000
end_address: 0x20070000
region: sram_primary
size: 0x70000
Parents Reply Children
  • Hi,

    I add boot_write_img_confirmed() and problem is solve,
    thanks for your support.

  • Glad to hear that this helped. Hope you have a wonderful day!

     

    Kind regards,

    Håkon

  • when i do the OTA after the NVS flash memory is erase so how i can solve this problem

  • Hi,

     

    Did you use a static partition layout?

    ie. do you have a pm_static.yml file in your application folder?

     

    If not, you can copy it from build-folder/partitions.yml to ../pm_static.yml

     

    Kind regards,

    Håkon

  • Yes i used pm_static.yml file below is my partition and i used nvs_storage:

    but when do the ota then which data i store in NVS flash was erase. 

    using of below i init the nvs

    #define NVS_PARTITION nvs_storage
    #define NVS_PARTITION_DEVICE FIXED_PARTITION_DEVICE(NVS_PARTITION)
    #define NVS_PARTITION_OFFSET FIXED_PARTITION_OFFSET(NVS_PARTITION)


    static struct nvs_fs fs;
    struct flash_pages_info info;

    ssize_t FM_flashinit()
    {
    int rc = 0;

    fs.flash_device = NVS_PARTITION_DEVICE;
    if (!device_is_ready(fs.flash_device)) {
    LOG_INF("Flash device %s is not ready", fs.flash_device->name);
    return 0;
    }
    fs.offset = NVS_PARTITION_OFFSET;
    rc = flash_get_page_info_by_offs(fs.flash_device, fs.offset, &info);
    if (rc) {
    LOG_INF("Unable to get page info");
    return 0;
    }
    fs.sector_size = info.size;
    fs.sector_count = 3U;

    rc = nvs_mount(&fs);
    if (rc) {
    LOG_INF("Flash Init failed");
    return 0;
    }
    return 1;
    }


    below is pm_static.yml partition  

    EMPTY_0:
    address: 0xfe000
    end_address: 0x100000
    placement:
    after:
    - settings_storage
    region: flash_primary
    size: 0x2000
    app:
    address: 0x10200
    end_address: 0xfc000
    region: flash_primary
    size: 0xebe00
    external_flash:
    address: 0xec000
    end_address: 0x800000
    region: external_flash
    size: 0x714000
    mcuboot:
    address: 0x0
    end_address: 0x10000
    placement:
    before:
    - mcuboot_primary
    region: flash_primary
    size: 0x10000
    mcuboot_pad:
    address: 0x10000
    end_address: 0x10200
    placement:
    before:
    - mcuboot_primary_app
    region: flash_primary
    size: 0x200
    mcuboot_primary:
    address: 0x10000
    end_address: 0xfc000
    orig_span: &id001
    - mcuboot_pad
    - app
    region: flash_primary
    size: 0xec000
    span: *id001
    mcuboot_primary_app:
    address: 0x10200
    end_address: 0xfc000
    orig_span: &id002
    - app
    region: flash_primary
    size: 0xebe00
    span: *id002
    mcuboot_secondary:
    address: 0x0
    device: DT_CHOSEN(nordic_pm_ext_flash)
    end_address: 0xec000
    placement:
    align:
    start: 0x4
    region: external_flash
    share_size:
    - mcuboot_primary
    size: 0xec000
    otp:
    address: 0xff8100
    end_address: 0xff83fc
    region: otp
    size: 0x2fc
    rpmsg_nrf53_sram:
    address: 0x20070000
    end_address: 0x20080000
    placement:
    before:
    - end
    region: sram_primary
    size: 0x10000

    nvs_storage:
    address: 0xfa000
    end_address: 0xfc000
    placement:
    before:
    - settings_storage
    region: flash_primary
    size: 0x2000 # 8KB reserved for NVS
    share_size:
    - settings_storage # Prevents overlap with settings
    settings_storage:
    address: 0xfc000
    end_address: 0xfe000
    placement:
    align:
    start: 0x4000
    before:
    - end
    region: flash_primary
    size: 0x2000
    sram_primary:
    address: 0x20000000
    end_address: 0x20070000
    region: sram_primary
    size: 0x70000

Related