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

DFU FW validation error

Hello,

I am performing a OTA DFU operation with a combined package (Bootloader + Soft Device + Application). The firmware version validation is failing. 

When nrf_dfu_ver_validation() is called, the dru_init_command_t.fw_version field contains the bootloader version (image 0 fw_version), not the version of the application (image 1 fw_version). The nrf_dfu_settings.app_version contains the correct information for the currently installed application so the comparison fails.

Here is a dump of the DFU package.

|
|- Image count: 2
|
|- Image #0:
|- Type: sd_bl
|- Image file: sd_bl.bin
|- Init packet file: sd_bl.dat
|
|- op_code: INIT
|- signature_type: ECDSA_P256_SHA256
|- signature (little-endian): b'008454b635d074e2fa420af6a872268c51e87778702714fb3d215e49c1a287f6a49fdd38d0564ece3b16bc4efd8084a607ba416ed2648ba052c6afb2d4184a14'
|
|- fw_version: 0x00000006 (6)
|- hw_version 0x0000002A (42)
|- sd_req: 0x102, 0xCC, 0x9D
|- type: SOFTDEVICE_BOOTLOADER
|- sd_size: 107692
|- bl_size: 24176
|- app_size: 0
|
|- hash_type: SHA256
|- hash (little-endian): b'2edfb3be03bf637c92bd23fd700175b579de420bcb61c30dd867a79fc1fd774a'
|
|- boot_validation_type: ['VALIDATE_GENERATED_CRC', 'VALIDATE_GENERATED_CRC']
|- boot_validation_signature (little-endian): [b'', b'']
|
|- is_debug: False

|
|- Image #1:
|- Type: application
|- Image file: FIELD_BLE_UART_D045_ETM_v396.bin
|- Init packet file: FIELD_BLE_UART_D045_ETM_v396.dat
|
|- op_code: INIT
|- signature_type: ECDSA_P256_SHA256
|- signature (little-endian): b'8ed7261a47a8c0f9ff55685249a0a4b3c7352c63303d4bde2a0dfb25e8bac1d466d494b7c431bdd858dc9c6abcf3f07c1e4c5dbfad53ed6d191fdc7d51979fd5'
|
|- fw_version: 0x2010396F (537934191)
|- hw_version 0x0000002A (42)
|- sd_req: 0x102
|- type: APPLICATION
|- sd_size: 0
|- bl_size: 0
|- app_size: 161956
|
|- hash_type: SHA256
|- hash (little-endian): b'637dd572d7f8dac1071a95878f24483f1f3382aea3a30eec2f60434a9b577307'
|
|- boot_validation_type: ['VALIDATE_GENERATED_CRC']
|- boot_validation_signature (little-endian): [b'']
|
|- is_debug: False

I am using SDK 17.0.1, soft device S113 7.2.0

Any idea how to fix this?

Thanks

Parents
  • Added logging to fw_version_ok() in nrf_dfu_ver_validation.c This shows the invalid comparison.

    0> In Bootloader
    0> init=0x00000006 setting=0x2010395F

    As you can see from the above "pkg display", the bootloader is version 0x00000006. s_dfu_settings.app_version == 0x2010395F, which is the correct information for the currently installed application. You can also see from "pkg display" the application version should be 0x2010396F which is greater than 0x2010395F.

  • Ok, here is the answer.

    fw_version_ok() was not failing because it was comparing the bootloader version with the application version. It failed because it requires the new bootloader version to be greater than the current bootloader version. It does not take the same version DFU compile flag into consideration.

    Solution:

    1. Change the comparison to >=

    2. Do a NRF_DFU_APP_ACCEPT_SAME_VERSION check like the application.

Reply
  • Ok, here is the answer.

    fw_version_ok() was not failing because it was comparing the bootloader version with the application version. It failed because it requires the new bootloader version to be greater than the current bootloader version. It does not take the same version DFU compile flag into consideration.

    Solution:

    1. Change the comparison to >=

    2. Do a NRF_DFU_APP_ACCEPT_SAME_VERSION check like the application.

Children
Related