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

dfu_buttonless dosen't work

nRF5_SDK_12.3.0_d7731ad

s132_nrf52_3.1.0_softdevice

PCA10040V1.1.1

HI team. I use experimental_ble_app_buttonless_dfu example to do test. But it doesn't work after I write 0x01 to develop board. It will disconnect with LightBlue , but it never go to the DFU mode, because I can't search any device named "nrf_dfu". And the LED3 doesn't work neither. I have read much answers about this problem. As they say that start_bootloard() function will be called after receive the value of 0x01. But I can't search this function anywhere.

Here is some original code from experimental_ble_app_buttonless_dfu:

static void ble_dfu_evt_handler(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt)
{
    switch (p_evt->type)
    {
        case BLE_DFU_EVT_INDICATION_DISABLED:
            NRF_LOG_INFO("Indication for BLE_DFU is disabled\r\n");
            break;

        case BLE_DFU_EVT_INDICATION_ENABLED:
            NRF_LOG_INFO("Indication for BLE_DFU is enabled\r\n");
            break;

        case BLE_DFU_EVT_ENTERING_BOOTLOADER:
            NRF_LOG_INFO("Device is entering bootloader mode!\r\n");
            break;
        default:
            NRF_LOG_INFO("Unknown event from ble_dfu\r\n");
            break;
    }
}

static void enter_bootloader(ble_dfu_t * p_dfu)
{
    if (p_dfu->evt_handler != NULL)
    {
        ble_dfu_evt_t evt;

        evt.type = BLE_DFU_EVT_ENTERING_BOOTLOADER;

        p_dfu->evt_handler(p_dfu, &evt);
    }

    s_dfu_settings.enter_buttonless_dfu = true;

    (void)nrf_dfu_settings_write(flash_callback);

    /*
    TODO:
     - Save bond data
    */
}
  • I assume you followed the instruction on how to test the buttonless example.

    Now you need to step in to the code and check when you write 0x01 to the DFU control characteristic would the enter_bootloader() is called or not ? Note that yo need to enable CCCD before you write to the DFU ctrl characteristic

  • Hi Hung Bui, I think i have found out the reason why it does't go into dfu mode. I had done this attempt which after I finish flashing softdevice and bootloader, I update dfu_buttonless application by DFU instead of flashing it to chip with keil. When the application run normally, I enable indication and then write 0x01 to chip, and it can go into dfu mode correctly. So the reason is I have covered the bootloader when i flash application to chip with keil.

    But here I have another question: when in production what should I do? It is not possible to flash application by dfu for thousands of device. Before, I used nRFgo studio to flash softdevice and bootloader to chip, but when I flash application the tool will warn me that the ROM need be erased. Because of this I flash application by keil, and the consequence is it can't go into dfu mode.

  • Hi ForrestDun,

    If you want to use Keil to flash the application, you need to flash the bootloader setting as well. Please see Appendix 1 in this blog.

    Another option is to do OTA DFU for 01 board, and then dump the hex out (which includes everything) then use that hex to flash all your products.

Related