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

Rename 'DfuTarg' from bootloader.

Hi,

I checked this thread https://devzone.nordicsemi.com/f/nordic-q-a/24611/how-to-change-the-name-of-bootloader-s-dfutarg which suggests to modify the macro but I would try to avoid that. It doesn't feel safe to modify anything from inside the SDK. Is there any other way to change the DFU advertising name to a custom one?

I searched in the SDK and I think it's possible using `nrf_dfu_settings_adv_name_write` but I couldn't get it to work.

Gabriel

Parents
  • Hi,

    "DfuTarg" should not be visible to the end user if you are implementing button-less DFU as the phone will automatically re-connect to device once it enters bootloader mode (button-less DFU application example). However, if you are not doing button-less DFU and you want to have a different device name, you do need to change the DEVICE_NAME define as suggested in the other thread. I don't foresee any problems with that. 

  • Hi,

    I'm having the same issue, in nrf_dfu_settings.h there's a function named nrf_dfu_settings_adv_name_write(...) that I think I should use to change the GAP device name of the device and to store in flash, but it's not working.

    My device has a name composed of a static part and a 'dynamic' part (stored in uicr memory during programming), so I can't use the #define NRF_DFU_BLE_ADV_NAME to set a completely static name for the device.

    In my bootloader implementation, the nrf_dfu_settings_adv_name_write(...) is called inside my custom nrf_dfu_init_user() function, should this be the correct way to go?

  • Hi,

    nrf_dfu_settings_adv_name_write() is meant to called from the main application through the SVCI interface. This feature enables the DFU controller to change from the default adv. name to an arbitrary one before issuing the DFU start command.  Not sure if it will work if you do it from the bootloader code. 

    Another option could be to just modify nrf_dfu_ble.c::gap_params_init() to concatenate the static part with the dynamic part in UICR. Maybe something like this (haven't tested it):

    static uint32_t gap_params_init(void)
    {
        uint32_t                err_code;
        ble_gap_conn_sec_mode_t sec_mode;
        uint8_t                 device_name[MAX_LEN] = NRF_DFU_BLE_ADV_NAME;
        uint8_t                 bytes_static_part = strlen(device_name);
        
        ...
        
        // Append dynamic string
        snprintf(&device_name[bytes_static_part], BYTES_DYNAMIC_PART, "%s", NRF_UICR->CUSTOMER);
        
        ...
    

    In case you are implementing buttonless dfu, be aware that the DFU controller may need to know the adv. name in order to re-connect when switching to DFU mode because of the address change. 

Reply
  • Hi,

    nrf_dfu_settings_adv_name_write() is meant to called from the main application through the SVCI interface. This feature enables the DFU controller to change from the default adv. name to an arbitrary one before issuing the DFU start command.  Not sure if it will work if you do it from the bootloader code. 

    Another option could be to just modify nrf_dfu_ble.c::gap_params_init() to concatenate the static part with the dynamic part in UICR. Maybe something like this (haven't tested it):

    static uint32_t gap_params_init(void)
    {
        uint32_t                err_code;
        ble_gap_conn_sec_mode_t sec_mode;
        uint8_t                 device_name[MAX_LEN] = NRF_DFU_BLE_ADV_NAME;
        uint8_t                 bytes_static_part = strlen(device_name);
        
        ...
        
        // Append dynamic string
        snprintf(&device_name[bytes_static_part], BYTES_DYNAMIC_PART, "%s", NRF_UICR->CUSTOMER);
        
        ...
    

    In case you are implementing buttonless dfu, be aware that the DFU controller may need to know the adv. name in order to re-connect when switching to DFU mode because of the address change. 

Children
No Data
Related