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

Nrf52832 ble_app_uart DFU No bootloader found(NRF_ERROR_NO_MEM) | SDK 15.3.0 | Soft device S132 6.1.1

I am trying to integrate buttonless DFU with FDS in ble_app_uart example from sdk 15.3.0. Merge hex was done properly which includes bootloader_settings.hex+bootloader.hex+softdevice.hex+application.hex and programmed using JLink prior to that i erased the chip using nrfjprog -f nrf52 -e command successfully. Then i resetted the board, application started and reaches ble_dfu_buttonless_async_svci_init() which gives NRF_ERROR_NO_MEM error. I went into debug mode and found uint32_t bootloader address was 0xFFFFFFFF. I checked UICR register value using JLink command -> mem8 0x10001014 4 which results 0xFFFFFFFF. The bootloader i programmed was debug version and i got the below prints.

PRINT_START

00> <info> app: Inside main
00>
00> <debug> app: In nrf_bootloader_init
00>
00> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
00>
00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
00>
00> <debug> nrf_dfu_settings: Using settings page.
00>
00> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
00>
00> <info> nrf_dfu_settings: Old settings page detected. Upgrading info.
00>
00> <debug> nrf_dfu_settings: Writing settings...
00>
00> <debug> nrf_dfu_settings: Erasing old settings at: 0x0007F000
00>
00> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0007F000, len=1 pages), queue usage: 0
00>
00> <debug> nrf_dfu_flash: Flash erase success: addr=0x0007F000, pending 0
00>
00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0007F000, src=0x20009188, len=896 bytes), queue usage: 1
00>
00> <debug> nrf_dfu_flash: Flash write success: addr=0x0007F000, pending 0
00>
00> <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
00>
00> <debug> nrf_dfu_settings: Writing settings...
00>
00> <debug> nrf_dfu_settings: Erasing old settings at: 0x0007E000
00>
00> <debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0007E000, len=1 pages), queue usage: 1
00>
00> <debug> nrf_dfu_flash: Flash erase success: addr=0x0007E000, pending 0
00>
00> <debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0007E000, src=0x20009508, len=896 bytes), queue usage: 1
00>
00> <debug> nrf_dfu_flash: Flash write success: addr=0x0007E000, pending 0
00>
00> <debug> app: Enter nrf_bootloader_fw_activate
00>
00> <info> app: No firmware to activate.
00>
00> <debug> nrf_dfu_validation: CRC check of app failed. Return 1
00>
00> <debug> app: App is valid
00>
00> <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
00>
00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
00>
00> <debug> app: Running nrf_bootloader_app_start with address: 0x00001000
00>
00> <debug> app: Disabling interrupts. NVIC->ICER[0]: 0x0
00>
00> <info> app: Setting vector table to bootloader: 0x00072000
00>
00> <info> app: Setting vector table to main app: 0x00026000
00>

<debug> No bootloader found


00> <error> app: Fatal error
00>

PRINT_ENDS

The application Linker script has 

FLASH_PH_START=0x0

FLASH_PH_SIZE=0x80000

RAM_PH_START=0x20000000

RAM_PH_SIZE=0x10000

FLASH_START=0x26000

FLASH_SIZE=0x53000

RAM_START= 0x200030E0

RAM_SIZE=0xCF20

I don't know why UICR has 0xFFFFFFFF value and i know that because this my application stucks in Fatal error. Why UICR is not programmed properly?

I am attaching nrf52832_xxaa_s132.map(from pca10040_ble_debug\armgcc\build), bootloader_settings.hex, bootloader.hex, application.hex and sd_app_boot.hex for reference.  74862.nrf52832_xxaa_s132.map6567.bootloader_settings.hex1667.nrf52832_xxaa_s132.hex8524.sd_app_boot.hex0513.ble_app_uart_pca10040_s132.hex

  • Hi,

    Yogeshwaran said:
    Yeah as you said it not getting Fatal error because of NVIC_SystemReset().

    Sounds good. Then we can ignore NVIC_SystemReset() itself.

    Yogeshwaran said:
    if i add NRF_POWER->GPREGRET = BOOTLOADER_DFU_START before NVIC_SystemReset() then it is happening but if add the NRF_POWER->GPREGRET = BOOTLOADER_DFU_START and restart the device by switch off and on then it goes to DFU mode as excepected and other functionalities are working fine.

    By turning off and on here do you mean power-cycle? If so, then whatever was in the GPREGRET is lost as it is only retained while the device is powered. It is a bit odd that the device enters DFU mode though, as the BOOTLOADER_DFU_START flag is lost after the reset. It is also strange that you get the error when the flag is set. Some questions:

    • Do you only get this error when using a high number of FDS pages, or is that unrelated to the issue?
    • Have you made any modifications in the bootloader? If so, which?
    • Do you see anything useful if testing with the debug bootloader with RTT logging (example bootloader project ending with "_debug")?
  • I am sorry basically resetting the board drives the device into DFU mode not power off and on. So i found some useful things from https://devzone.nordicsemi.com/f/nordic-q-a/30856/invalid-memory-access-when-writing-to-nrf_power--gpregret and https://devzone.nordicsemi.com/f/nordic-q-a/37971/gpregret-clears-on-sd_nvic_systemreset using this the issue got resolved. Actually we should not directly set NRF_POWER->GPREGRET if Softdevice is present. The way we should set by only using below code 

    err_code = sd_power_gpregret_clr(0, 0xffffffff);
    APP_ERROR_CHECK(err_code);
    err_code = sd_power_gpregret_set(0,BOOTLOADER_DFU_START);
    APP_ERROR_CHECK(err_code);
    nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);

    I am right sir?

  • Hi,

    Ah, yes. I did not spot that. You are right. Please note that if you want a BLE service for enabling DFU that is allready implemented for you in the SDK, with the DFU service. There you can also see how DFU mode is triggered by writing to GPREGRET and resetting using ble_dfu_buttonless_bootloader_start_finalize() implemented like this in ble_dfu.c (for your reference):

    uint32_t ble_dfu_buttonless_bootloader_start_finalize(void)
    {
        uint32_t err_code;
    
        NRF_LOG_DEBUG("In ble_dfu_buttonless_bootloader_start_finalize\r\n");
    
        err_code = sd_power_gpregret_clr(0, 0xffffffff);
        VERIFY_SUCCESS(err_code);
    
        err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
        VERIFY_SUCCESS(err_code);
    
        // Indicate that the Secure DFU bootloader will be entered
        m_dfu.evt_handler(BLE_DFU_EVT_BOOTLOADER_ENTER);
    
        // Signal that DFU mode is to be enter to the power management module
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);
    
        return NRF_SUCCESS;
    }

  • Sure Thanks for being Kind and supportive. The issue got solved really fast that i didn't expect. This is why i like to use Nordic chip majorly because of very good support. Good Luck!

Related