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

Application failing validation in bootloader

I'm working with a development prototype board with the nRF52832.  It is connected to a main processor in our design over UART.  We are working towards being able to do the DFU process from our main processor connected over the UART.  I have a functioning bootloader, main application, and softdevice on the board, loaded through the SWI interface with Segger Embedded Studio.  The bootloader is based on the serial secure DFU bootloader example in SDK 14.2.0.  I used nrfutil to create a bootloader settings page and flashed that to the board using Segger download tool.  However, when the bootloader comes up, it fails to validate the main app and will not jump to the main app if with the settings page on the board.  After further debugging, I've narrowed it down to this code below in nrf_dfu_app_is_valid() where it fails the s_dfu_settings.bank_0.bank_code check.  The CRC check is successful.  If I comment out ONLY the bank_code check, the validation is successful, meaning the CRC is fine. 

    if (s_dfu_settings.bank_0.bank_code != NRF_DFU_BANK_VALID_APP)
    {
       // Bank 0 has no valid app. Nothing to boot
       NRF_LOG_DEBUG("Return false in valid app check");
       return false;
    }

I've not been able to figure out why that bank_code check fails since the bootloader settings output seemed to indicate all was good including the bank Code check:

C:\Python27\Scripts\nrfutil settings generate --family NRF52 --application nRF52_App.hex --application-version 0 --bootloader-version 1 --bl-settings-version 1 bootloader_setting.hex

Generated Bootloader DFU settings .hex file and stored it in: bootloader_setting.hex

Bootloader DFU Settings:
* File: bootloader_setting.hex
* Family: nRF52
* Start Address: 0x0007F000
* CRC: 0xFF49BF5C
* Settings Version: 0x00000001 (1)
* App Version: 0x00000000 (0)
* Bootloader Version: 0x00000001 (1)
* Bank Layout: 0x00000000
* Current Bank: 0x00000000
* Application Size: 0x0000DD08 (56584 bytes)
* Application CRC: 0x1AD351F3
* Bank0 Bank Code: 0x00000001

Any ideas why this is failing?

Parents
  • One additional data point, I noticed that the CRC is NOT failing but is zero, so it bypasses the check in nrf_dfu_app_is_valid() which makes more sense now.  But the question still remains why the bootloader settings data is not valid when I've created and flashed the bootloader settings page following Nordic's documentation.  I've attached the .hex file for the bootloader settings.  Could the addresses be wrong in the hex file?

    bootloader_setting.hex

Reply
  • One additional data point, I noticed that the CRC is NOT failing but is zero, so it bypasses the check in nrf_dfu_app_is_valid() which makes more sense now.  But the question still remains why the bootloader settings data is not valid when I've created and flashed the bootloader settings page following Nordic's documentation.  I've attached the .hex file for the bootloader settings.  Could the addresses be wrong in the hex file?

    bootloader_setting.hex

Children
No Data
Related