Assuming SDK 12.x
For those people that want to integrate the Buttonless DFU service to their app, which uses already one custom base 128bit UUID, please make sure to:
-
Edit
softdevice_handler.c
(located atcomponents/softdevice/common/softdevice_handler/
):uint32_t softdevice_enable_get_default_config(uint8_t central_links_count, uint8_t periph_links_count, ble_enable_params_t * p_ble_enable_params) { memset(p_ble_enable_params, 0, sizeof(ble_enable_params_t)); p_ble_enable_params->common_enable_params.vs_uuid_count = 2; // HERE MAKE THIS 2!!! p_ble_enable_params->gatts_enable_params.attr_tab_size = SOFTDEVICE_GATTS_ATTR_TAB_SIZE; p_ble_enable_params->gatts_enable_params.service_changed = SOFTDEVICE_GATTS_SRV_CHANGED; p_ble_enable_params->gap_enable_params.periph_conn_count = periph_links_count; p_ble_enable_params->gap_enable_params.central_conn_count = central_links_count; if (p_ble_enable_params->gap_enable_params.central_conn_count != 0) { p_ble_enable_params->gap_enable_params.central_sec_count = SOFTDEVICE_CENTRAL_SEC_COUNT; } return NRF_SUCCESS; }
-
Making the above change, means you have to adjust
RAM ORIGIN
in your linker script as well, e.g. theble_app_gcc_nrf51.ld
. Probably it will start 16 bytes (+ 0x10) after the current value. (Hint: If you run your app with NRF_LOG on, the Softdevice will report the correct value you need to use) -
If applicable: There is bug in the buttonless DFU example. Adjust the
nrf_dfu_flash_buttonless.c
:uint32_t nrf_dfu_flash_init(bool sd_enabled) { fs_fake_init(); // IMPORTANT! ADD THIS! WAS BUG IN THE EXAMPLE! m_flags = FLASH_FLAG_SD_ENABLED; return NRF_SUCCESS; }
Otherwise you will get flash operation errors.
-
Don't forget to patch BLE DFU Service
ble_dfu.c
static uint32_t rx_char_add(ble_dfu_t * p_dfu, const ble_dfu_init_t * p_dfu_init) { ... char_md.char_props.write = 1; // ADD THIS! IT IS MISSING! ... }
That's it! :) Enjoy!