Hi.
I' m using nRF52832, SDK v15.0.0, S132.
I'm want tutorial how make bootloader DFU in IAR.
How I make bootloader DFU for nrf52832 in IAR?
Hi.
I' m using nRF52832, SDK v15.0.0, S132.
I'm want tutorial how make bootloader DFU in IAR.
How I make bootloader DFU for nrf52832 in IAR?
You can use nRF Connect for Desktop or nrfutil on a PC to perform DFU. We also have the nRF Connect for Mobile app for Android and iOS, which allows you to perform DFU from a mobile device.
Me's need step by step guide, getting started with Nordic's Secure DFU bootloader.
If you flash SoftDevice, Bootloader and the Buttonless DFU application, then the device should start in DFU mode. If you want the device to run the application, then you need to generate a bootloader settings page and flash that along with the SD,BL and App.
See https://github.com/NordicSemiconductor/pc-nrfutil#generate-2 on how to generate the settings hex file.
Thanks bjorn-spockeli.
I get new problem. I mayn't build progect in IAR. Progect Buttonless DFU.
I get errors:
Error[Pe020]: identifier "nrf_dfu_set_peer_data_svci_async_t" is undefined
Error[Pe020]: identifier "nrf_dfu_set_peer_data_svci_async_t" is undefined
Error[Pe020]: identifier "nrf_dfu_set_peer_data_svci_async_t" is undefined 3
Error[Pe020]: identifier "nrf_dfu_peer_data_t" is undefined
Error[Pe020]: identifier "nrf_dfu_peer_data_t" is undefined
Error[Pe020]: identifier "SYSTEM_SERVICE_ATT_SIZE" is undefined
nrf_dfu_peer_data_t is defined in nrf_dfu_types.h - Make sure that you have added this in the include path in IAR ( the file is located in components\libraries\bootloader\dfu)
nrf_dfu_set_peer_data_svci_async_t is defined when NRF_SVCI_ASYNC_FUNC_DECLARE(NRF_DFU_SVCI_SET_PEER_DATA, nrf_dfu_set_peer_data, nrf_dfu_peer_data_t, nrf_dfu_peer_data_state_t); is called nrf_dfu_ble_svci_bond_sharing.h
#define NRF_SVCI_ASYNC_FUNC_DECLARE(svci_num, \
name, \
param_type, \
state_type) \
/*lint --e{19} */ \
NRF_SVCI_ACYNC_FUNC_TYPEDEF(name, param_type, state_type); \
NRF_SVCI_ASYNC_EVENT_FUNC_TYPEDEF(name, state_type); \
\
typedef struct \
{ \
name ## _async_fn_t async_func; \
name ## _event_fn_t sys_evt_handler; \
state_type state; \
} name ## _svci_async_t;
I add file \libraries\bootloader\dfu figure IAR error_1.
I include in main.c following libraries:
#include "nrf_dfu_ble_svci_bond_sharing.h"
#include "nrf_svci_async_function.h"
#include "nrf_svci_async_handler.h"
figure library nrf_dfu_ble_svci_bond_sharing.h
figure library nrf_svci_async_function.h
Errors remained.
I build project.
I added peer_id.c, peer_data_storage.c, peer_database.c, peer_manager.c, pm_buffer.c, pm_mutex.c, security_dispatcher.c, security_manager.c, gatt_cache_manager.c, gatts_cache_manager.c,id_manager.c include in sdk_config.h CRC16_EABLE, FDS_ENABLE, NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS, NRF_SDH_BLE_SERVICE_CHANGED and BLE_DFU_ENABLED and added BL_SETTINGS_ACCESS_ONLY, NRF_DFU_SVCI_ENABLED
NRF_DFU_TRANSPORT_BLE=1
There is a guide or an application note that explains the several steps needed to integrate buttonless DFU to a custom application?
What do I must make for full completions buttonless DFU?
I build project.
I added peer_id.c, peer_data_storage.c, peer_database.c, peer_manager.c, pm_buffer.c, pm_mutex.c, security_dispatcher.c, security_manager.c, gatt_cache_manager.c, gatts_cache_manager.c,id_manager.c include in sdk_config.h CRC16_EABLE, FDS_ENABLE, NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS, NRF_SDH_BLE_SERVICE_CHANGED and BLE_DFU_ENABLED and added BL_SETTINGS_ACCESS_ONLY, NRF_DFU_SVCI_ENABLED
NRF_DFU_TRANSPORT_BLE=1
There is a guide or an application note that explains the several steps needed to integrate buttonless DFU to a custom application?
What do I must make for full completions buttonless DFU?
No, unfortunately we do not have such a guide.
I suggest that you compare the project settings of your ble_app_uart project IAR project with the settings of the ble_app_buttonless_dfu IAR project. You will then see which .c files that are nescessary , which paths to .h files that must be added to the include directories path and which Preprocessor definitions that are needed.
In project ble_app_uart function advertising_start have the form
static void advertising_start(void) { uint32_t err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST); APP_ERROR_CHECK(err_code); }
In project ble_app_buttonless_dfu function advertising_start have the form
static void advertising_start(bool erase_bonds)
{
if (erase_bonds == true)
{
delete_bonds();
// Advertising is started by PM_EVT_PEERS_DELETE_SUCCEEDED event.
}
else
{
uint32_t err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);
NRF_LOG_DEBUG("advertising is started");
}
}
Which do one to use function advertising_start ?
Just use the second one, i.e. advertising_start(bool erase_bonds), with erase_bonds = false.
I solved the compilation problems. I changed the function "services_init(void)" of project ble_app_uart in:
static void services_init(void)
{
uint32_t err_code;
ble_nus_init_t nus_init;
nrf_ble_qwr_init_t qwr_init = {0};
ble_dfu_buttonless_init_t dfus_init = {0};
// Initialize Queued Write Module.
qwr_init.error_handler = nrf_qwr_error_handler;
err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
APP_ERROR_CHECK(err_code);
// Initialize NUS.
memset(&nus_init, 0, sizeof(nus_init));
nus_init.data_handler = nus_data_handler;
err_code = ble_nus_init(&m_nus, &nus_init);
APP_ERROR_CHECK(err_code);
//***** buttonless DFU *****
// Initialize the async SVCI interface to bootloader.
err_code = ble_dfu_buttonless_async_svci_init();
APP_ERROR_CHECK(err_code);
dfus_init.evt_handler = ble_dfu_evt_handler;
err_code = ble_dfu_buttonless_init(&dfus_init);
APP_ERROR_CHECK(err_code);
//**************************
}
and add peer_manager_init
int main(void)
{
bool erase_bonds;
// static uint32_t pages_to_erase = 1;
// Initialize.
log_init();
timers_init();
buttons_leds_init(&erase_bonds);
power_management_init();
ble_stack_init();
peer_manager_init();
gap_params_init();
gatt_init();
services_init();
advertising_init();
conn_params_init();
// Start execution.
advertising_start(erase_bonds);
I want start buttonless DFU with command. I get command through ble uart. How do I may it make?
You call the following function
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; }
its defined in ble_dfu.c and its called in so just include ble_dfu.h in the file, I assume main.c, and then call ble_dfu_buttonless_bootloader_start_finalize when you want to jump to the bootloader.