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 CRC check workaround for J-Link debugging

Common situation:

We have flashed dfu bootloader, and firmware uploaded into Flash via DFU. In this situation, DFU settings page contains correct CRC value for existing application. But if we make any changes in code and upload new version with J-Link, bootloader never start application due to wrong CRC checking.

So, my suggestion to add two lines in nrf_dfu_utils.c function nrf_dfu_app_is_valid()

        if (crc != s_dfu_settings.bank_0.image_crc)
        {
            // CRC does not match with what is stored.
            NRF_LOG_DEBUG("Return false in CRC");
#ifndef NRF_DFU_DEBUG_VERSION
            return  false;
#endif
        }
    }

    NRF_LOG_DEBUG("Return true. App was valid");

This change will affect only debug version of bootloader and we still have information about CRC in log

  • Hi,

    The way this is currently done is that for the debug version of the DFU bootloader (which is a separate project from the non-debug version) the CRC is set to 0 which leads to checking the CRC of the application being skipped. Intended use is to use the debug version of the bootloader during development, which lets you change the application without recalculating CRC every time.

    I do see, however, that your suggestion may have some advantages, and as always I have registered the suggestion in our internal issue tracker. Feedback from customers is always highly appreciated!

    Of course one can always do as you suggest manually, and add an #ifndef checking for a debug flag around the "return false;".

    Regards,
    Terje

  • Yes, CRC==0 also useful on manual update via nrfjprog, but actually I have no idea how to skip CRC writing after DFU upload in debug version (and probably this way more dangerous than previous).

    Anyway thank you for your response, I'll mark your reply as verified answer and start waiting for next updated SDK :)

Related