This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Not able to enter in DFU mode after creating a new project based on secure boot

Hi,

I am using nrf52840 development kit with SDK 17.1.0.

I created a new project in IAR 8.50 and replicate project for sceure_bootloader in new project by adding files manually and include path and all.

Its compiling properly no issue in that, But when i am flashing that code then its not entering to DFU mode.

The strange thing is when i use debugger and put breakpoint in the code and then run step by step at that time it going into DFU mode, 2 LED are glowing.

But again when i tried to upload a zip package its failing.

Can you suggest me what could be the reason for this. Did i missed any setting while creating a new project...?

Regards

Rohit Saini

Parents
  • Hi,

    But when i am flashing that code then its not entering to DFU mode.

    What did you flash? SoftDevice and the bootloader?

    I created a new project in IAR 8.50 and replicate project for sceure_bootloader in new project by adding files manually and include path and all.

    Does it work with the original secure_bootloader project?

  • OK 

    i have two bootloaders. bootloader 1 and bootloader 2.

    the flashing sequence is like ->MBR->Softdevice->Bootloader1->Bootloader2 ->Application code

    Bootloader 1 start address  -- 0x000E8000 to ECFFF

    Bootloader 2 start Address  --0x000ED000  to FDFFF
    Application Start Address  --  0x00027000 

    Bootloader 1 is used for Bootloader 2 signature verification and bootloader 2 is responsible for DFU activity.

    in Bootloader 1 i found that some portion of code creating this issue

    void nrf_bootloader_app_start_final(uint32_t vector_table_addr)
    {
        ret_code_t ret_val;
    
        // Size of the flash area to protect.
        uint32_t area_size;
    
        area_size = BOOTLOADER_SIZE + NRF_MBR_PARAMS_PAGE_SIZE;
        if (!NRF_BL_DFU_ALLOW_UPDATE_FROM_APP && !NRF_BL_DFU_ENTER_METHOD_BUTTONLESS && !NRF_DFU_TRANSPORT_BLE)
        {
            area_size += BOOTLOADER_SETTINGS_PAGE_SIZE;
        }
    
        ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, area_size);
    
        if (ret_val != NRF_SUCCESS)
        {
            NRF_LOG_ERROR("Could not protect bootloader and settings pages, 0x%x.", ret_val);
        }
        APP_ERROR_CHECK(ret_val);
    
        ret_val = nrf_bootloader_flash_protect(0,
                        nrf_dfu_bank0_start_addr() + ALIGN_TO_PAGE(s_dfu_settings.bank_0.image_size));
    
        if (ret_val != NRF_SUCCESS)
        {
            NRF_LOG_ERROR("Could not protect SoftDevice and application, 0x%x.", ret_val);
        }
        APP_ERROR_CHECK(ret_val);
    
        // Run application
        app_start(vector_table_addr);
    }
    

    If i comment the portion before app_start(vector_table_addr); then the issue get resolved. 

    But i am not able to understand it why.

    How flash protect can cause this issue..?

    This portion is realted to the bootloader 1 and i am facing issue in bootloader2 . is it because flash protect function accessing more size i think in this case include bootloader size as well..?

    Regards

    R_S

  • R_S said:
    If i comment the portion before app_start(vector_table_addr); then the issue get resolved. 

    Good!

    R_S said:
    How flash protect can cause this issue..?

    You seem to be protecting the bootloader settings page as well. This way, bootloader2 won't be able to update the bootloader settings page when it does the DFU, and the DFU will fail.

Reply
  • R_S said:
    If i comment the portion before app_start(vector_table_addr); then the issue get resolved. 

    Good!

    R_S said:
    How flash protect can cause this issue..?

    You seem to be protecting the bootloader settings page as well. This way, bootloader2 won't be able to update the bootloader settings page when it does the DFU, and the DFU will fail.

Children
No Data
Related