Hello,
I added an extra opcode to the DFU Control Point characteristic so that I can jump to the main application by writing to it. The problem is that whenever I do that, the bootloader freezes (it doesn't reset). I'm on SDK13.1, using S132 4.0.2 on an NRF52832
This is what my code looks like:
case BLE_DFU_OP_CODE_BOOT_TO_MAIN:
NRF_LOG_DEBUG("- Received boot to main command\r\n");
if (nrf_dfu_app_is_valid())
{
res_code = NRF_DFU_RES_CODE_SUCCESS;
response_send(p_dfu, BLE_DFU_OP_CODE_BOOT_TO_MAIN, res_code);
NRF_LOG_DEBUG("Jumping to: 0x%08x\r\n", MAIN_APPLICATION_START_ADDR);
nrf_bootloader_app_start(MAIN_APPLICATION_START_ADDR);
}
res_code = NRF_DFU_RES_CODE_OPERATION_FAILED;
return response_send(p_dfu, BLE_DFU_OP_CODE_BOOT_TO_MAIN, res_code);
The application freezes for some reason inside nrf_bootloader_app_start()
. Other calls to that function work as expected, but not that one.
I looked at this thread, but I can't pinpoint what I need to do to fix it: application can not start normally in merged hex (SD+APP+BL)
I'm guessing that in that case, the program is in a state where the SoftDevice somehow crashes when calling nrf_dfu_mbr_init_sd()
(which I don't really understand what is for).
Any help will be appreciated!