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

bootloader stuck in wait_for_events if started programatically

Hi,

I have modified slightly the OTA bootloader sample in SDK6.1 and SoftDevice 7.1.0. After flashing the bootloader code to the nrf51822 it works like charm, I can update the firmware on the module OTA with MCP. If I upload OTA a modified version of hrs example code in SDK with OTA DFU support, the bootloader gets started by writing 0x01 to the DFU control characteristic, but afterwards it is stuck in wait_for_events function in bootloader.c. I use gcc 4.9.3 as compiler on Linux. Do you have any ideas what I should check?

I have checked with the unmodified codes in SDK v6.1. DFU does not work with MCP with those codes either. Is gcc problematic with bootloader?

Thanks,

Tamas

  • Hi,

    Testing your hex has given interesting results: DFU could not have been initialized, MCP has shown error message: 'Error during firmware upload. Data could not be sent - failed!'

    In your comment above you have written that there may be some problem with disabling soft device in my code. What exactly do I need to disable? Currently I call sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); if a connection is present at the time when reset_prepare is run (which is the case every time, as DFU is initiated OTA), stop timers, and I call ble_conn_params_stop(). Do I need to do any further preparations before jumping to DFU?

    Br,

    Tamas

  • Hi Tamas,

    I haven't got time to reset my example. But regarding the way to jump to bootloader, what you need to do is to set the GPREGRET, disable softdevicec, disable interrupt, forward vector table to bootloader, and then start bootloader by jumping the PC.

    Please have a look at the bootloader_start() function in dfu_app_handler.c

Related