Advertising doesn't change name after code update

Greetings,

I've been developing a DFU firmware that should update the device through Android. The thing is, the device works, but I changed the advertising name, and it still shows the old name when I try to update the device. I use the following function to update the name:

static void make_dev_name(void)
{
    ble_gap_addr_t device_address;
    uint8_t companyName[] = {"M"};
    uint8_t modelName[] = {"1"};
    uint8_t *macAddressName;
    uint8_t macTmp[12];

    sd_ble_gap_addr_get(&device_address);
    macAddressName = Convert_Hex_To_Ascii(&device_address.addr[0], 4);
    memcpy(&DEVICE_NAME[0], companyName, 1);
    memcpy(&DEVICE_NAME[1], modelName, 1);
    memcpy(&DEVICE_NAME[2], macAddressName, 12);

}

Any idea why this issue occurs?

I used reference from here;
https://novelbits.io/ota-device-firmware-update-part-3/

Parents Reply Children
  • Yes, I merge the following:

    1. Generate Settings File from application (a bootloader settings page that contains information about the current DFU process):
    nrfutil settings generate \
    --family NRF52 \
    --application app_file.hex \
    --application-version 0 \
    --bootloader-version 0 \
    --bl-settings-version 2 \
    boot_settings.hex

    2. Merge Bootloader Settings, Bootloader, Soft Device and Application (to create final application HEX file):

    mergehex -m \
    boot_settings_file.hex \
    secure_bootloader_file.hex \
    sXXX_softdevice_file.hex \
    app_file.hex \
    -o app_uart_0.0.1.hex

    Flashing the custom HEX image to your board
    3. Program hex file to NRF52 DK

    3.1 nrfjprog -f nrf52 --recover
    3.2 nrfjprog -f nrf52 --eraseall
    3.3 nrfjprog -f nrf52 --program app_file.hex --reset --verify

  • For debugging, I recommend creating the settings page with boot validation disabled. 

    --app-boot-validation NO_VALIDATION

    This will allow the bootloader to boot the app even if the debugger as loaded a slightly different version of the app image.

  • Ok, update on the project. I had some issues with the OS, now I am able to debug the DFU part of the project in Segger. So I get NRF_BREAKPOINT_COND whenever a APP_ERROR_CHECK(err_code); is called in the code. This happens during debugging. I also put comments on err_code = ble_dfu_buttonless_async_svci_init();, so it doesn't initialize a bootloader check (seems that was the issue that didn't let me debug.)

    Update: When I comment error check function in the timers_init() function, I get the following:

  • I have not seen your code, so I can't tell why it is failing. Please check what the error code was. You can check this by enabling debug logs and build with the DEBUG flag set, or by inspecting the variables passed to the erorr handler after NRF_BREAKPOINT_COND is reached.

Related