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.
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.
I got an error again.
What do I do wrong?
bootloader uploaded
Which error code is returned by ble_dfu_buttonless_init()? Can you step into ble_dfu_buttonless_init and see which internal function that returns the error code?
Which error code is returned by ble_dfu_buttonless_init()? Can you step into ble_dfu_buttonless_init and see which internal function that returns the error code?
Returns the error code function err_code = sd_ble_uuid_vs_add(&nordic_base_uuid, &m_dfu.uuid_type);
err_code = sd_ble_uuid_vs_add(&nordic_base_uuid, &m_dfu.uuid_type);
VERIFY_SUCCESS(err_code);
0x04 means NRF_ERROR_NOMEM, which is generate by sd_ble_uuid_vs_add when there are no more free slots for VS UUIDs,
You need to increase NRF_SDH_BLE_VS_UUID_COUNT in sdk_config.h to 1.
* @param[in] p_vs_uuid Pointer to a 16-octet (128-bit) little endian Vendor Specific base UUID disregarding
* bytes 12 and 13.
* @param[out] p_uuid_type Pointer to a uint8_t where the type field in @ref ble_uuid_t corresponding to this UUID will be stored.
*
* @retval ::NRF_SUCCESS Successfully added the Vendor Specific base UUID.
* @retval ::NRF_ERROR_INVALID_ADDR If p_vs_uuid or p_uuid_type is NULL or invalid.
* @retval ::NRF_ERROR_NO_MEM If there are no more free slots for VS UUIDs.
*/
SVCALL(SD_BLE_UUID_VS_ADD, uint32_t, sd_ble_uuid_vs_add(ble_uuid128_t const *p_vs_uuid, uint8_t *p_uuid_type));
I get error in function static void ble_stack_init(void).
I changed NRF_SDH_BLE_VS_UUID_COUNT with 1 in 2, but now in function:
ret_code_t nrf_sdh_ble_enable(uint32_t * const p_app_ram_start) { // Start of RAM, obtained from linker symbol. uint32_t const app_ram_start_link = *p_app_ram_start; ret_code_t ret_code = sd_ble_enable(p_app_ram_start); if (*p_app_ram_start > app_ram_start_link) { NRF_LOG_WARNING("Insufficient RAM allocated for the SoftDevice."); NRF_LOG_WARNING("Change the RAM start location from 0x%x to 0x%x.", app_ram_start_link, *p_app_ram_start); NRF_LOG_WARNING("Maximum RAM size for application is 0x%x.", ram_end_address_get() - (*p_app_ram_start)); } else { NRF_LOG_DEBUG("RAM starts at 0x%x", app_ram_start_link); if (*p_app_ram_start != app_ram_start_link) { NRF_LOG_DEBUG("RAM start location can be adjusted to 0x%x.", *p_app_ram_start); NRF_LOG_DEBUG("RAM size for application can be adjusted to 0x%x.", ram_end_address_get() - (*p_app_ram_start)); } } if (ret_code == NRF_SUCCESS) { m_stack_is_enabled = true; } else { NRF_LOG_ERROR("sd_ble_enable() returned %s.", nrf_strerror_get(ret_code)); } return ret_code; }
the the execution the execution enters in the block
NRF_LOG_WARNING("Insufficient RAM allocated for the SoftDevice.");
NRF_LOG_WARNING("Change the RAM start location from 0x%x to 0x%x.",
app_ram_start_link, *p_app_ram_start);
NRF_LOG_WARNING("Maximum RAM size for application is 0x%x.",
ram_end_address_get() - (*p_app_ram_start));
Thank you for your support.
I modify RAM start and RAM STOP in IAR.
after started project.
How do start work DFU? I use function ble_dfu_buttonless_bootloader_start_finalize(); but she not started DFU.
Error on line nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU); in 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; }
I don't know that do. Help me.
Alex, when you report that functions return errors, then you need to provide the error codes so that we can find out what caused the error. Also do you mean a compilation error or a run-time error?
After calling the ble_dfu_buttonless_bootloader_start_finalize() function the device should jump to the bootloader and the device should start advertising as DfuTarg. You can then connect to the device using nRF Connect for Desktop or Mobile(ios/Android) and then start a DFU by pressing the DFU icon, the blue lock and then select the image you want to upload