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

DFU BLE with bonding is unsuccessful

Hi all

nrf52840 Development board,sdk is nRF5_SDK_15.2.0_9412b96,PC is windows 10 .My testing master device is cell phone(Huawei HTC and so on,android system),and using "nrf connect "APP and "nrf toolbox" APP.

The dfu will stop in bootloader when I use "nrf connect "APP and "nrf toolbox" APP even if that example of "sd_s140_bootloader_buttonless_with_setting_page_dfu_secure_ble_debug_with_bonds.hex".

The error is "GATT WRITE NOT PERMIT"

When my code runs,the error are "GATT WRITE NOT PERMIT" or "GATT INVALID HANDLE".

When the dfu service is the first service,the error is "GATT WRITE NOT PERMIT".

When my custom ble service is the first service,the error is "GATT INVALID HANDLE".

The log as follosw:

...

...

Thanks,

mijiale

Parents
  • Hello,

    It sounds like you are trying to perform a DFU to a device with a bootloader that requires bonding, without being bonded. Is that correct?

    If you are new to the nRF bootloader, may I suggest you start with this guide on how to set up and perform the DFU:

    https://devzone.nordicsemi.com/b/blog/posts/getting-started-with-nordics-secure-dfu-bootloader

    Best regards,

    Edvin

  • Hi Edvin,

    Thank you very much for your reply.I'm sorry I didn't describe it very clearly. I am very clear about the upgrade process. 

    A few points need to be explained.

    First,I have implemented this upgrade process in unbonding mode and there is no problem at all.

    Second,I have problems about upgrade process in bonding mode and I think I'm following the designated steps,but the DFU doesn't work even if I use official examples for testing which is "sd_s140_bootloader_buttonless_with_setting_page_dfu_secure_ble_debug_with_bonds.hex".

    Third,The error will happen when I use cell phone to test the DFU(bonding mode).However there is no problem when I use PC to test the DFU (bonding mode)with "nrf connect".

    I don't know if I've made it clear enough.

    The logs are as follows :

  • Hello,

    I see. Have you changed anything inside ble_dfu_bonded.c? Especially in ble_dfu_buttonless_char_add(ble_dfu_buttonless_t * p_dfu):

    uint32_t ble_dfu_buttonless_char_add(ble_dfu_buttonless_t * p_dfu)
    {
        ble_add_char_params_t add_char_params;
    
        memset(&add_char_params, 0, sizeof(add_char_params));
        add_char_params.uuid                = BLE_DFU_BUTTONLESS_BONDED_CHAR_UUID;
        add_char_params.uuid_type           = p_dfu->uuid_type;
        add_char_params.char_props.indicate = 1;
        add_char_params.char_props.write    = 1;
        add_char_params.is_defered_write    = true;
        add_char_params.is_var_len          = true;
        add_char_params.max_len             = BLE_GATT_ATT_MTU_DEFAULT;
    
        add_char_params.cccd_write_access = SEC_JUST_WORKS;
        add_char_params.write_access      = SEC_JUST_WORKS;
        add_char_params.read_access       = SEC_OPEN;
    
        return characteristic_add(p_dfu->service_handle, &add_char_params, &p_dfu->control_point_char);
    }

    What are your add_char_params.write_access and add_char_params.cccd_write_access?

    What SDK version do you use?

    Can you try to erase the bonds from your phone and the nRF (nrfjprog -e) and try again? Maybe there are some issues with bonding information being stored from an old application on the same chip?

    Best regards,

    Edvin

  • Hello,

    I haven't changed anything inside ble_dfu_bonded.c

    uint32_t ble_dfu_buttonless_char_add(ble_dfu_buttonless_t * p_dfu)
    {
        ble_add_char_params_t add_char_params;
    
        memset(&add_char_params, 0, sizeof(add_char_params));
        add_char_params.uuid                = BLE_DFU_BUTTONLESS_BONDED_CHAR_UUID;
        add_char_params.uuid_type           = p_dfu->uuid_type;
        add_char_params.char_props.indicate = 1;
        add_char_params.char_props.write    = 1;
        add_char_params.is_defered_write    = true;
        add_char_params.is_var_len          = true;
        add_char_params.max_len             = BLE_GATT_ATT_MTU_DEFAULT;
    
        add_char_params.cccd_write_access = SEC_JUST_WORKS;
        add_char_params.write_access      = SEC_JUST_WORKS;
        add_char_params.read_access       = SEC_OPEN;
    
        return characteristic_add(p_dfu->service_handle, &add_char_params, &p_dfu->control_point_char);
    }
    

    The SDK version is 15.2.

    If I erase the bonds from my phone and the nRF,it needs serval times to try to update my firmware and it can success.

    However,the bonds information must be stored because it's not a good experience to pair up every time when users update firmware.

    Best regards,

    mijiale

     

Reply
  • Hello,

    I haven't changed anything inside ble_dfu_bonded.c

    uint32_t ble_dfu_buttonless_char_add(ble_dfu_buttonless_t * p_dfu)
    {
        ble_add_char_params_t add_char_params;
    
        memset(&add_char_params, 0, sizeof(add_char_params));
        add_char_params.uuid                = BLE_DFU_BUTTONLESS_BONDED_CHAR_UUID;
        add_char_params.uuid_type           = p_dfu->uuid_type;
        add_char_params.char_props.indicate = 1;
        add_char_params.char_props.write    = 1;
        add_char_params.is_defered_write    = true;
        add_char_params.is_var_len          = true;
        add_char_params.max_len             = BLE_GATT_ATT_MTU_DEFAULT;
    
        add_char_params.cccd_write_access = SEC_JUST_WORKS;
        add_char_params.write_access      = SEC_JUST_WORKS;
        add_char_params.read_access       = SEC_OPEN;
    
        return characteristic_add(p_dfu->service_handle, &add_char_params, &p_dfu->control_point_char);
    }
    

    The SDK version is 15.2.

    If I erase the bonds from my phone and the nRF,it needs serval times to try to update my firmware and it can success.

    However,the bonds information must be stored because it's not a good experience to pair up every time when users update firmware.

    Best regards,

    mijiale

     

Children
  • mijiale said:
    However,the bonds information must be stored because it's not a good experience to pair up every time when users update firmware.

     Of course not. But it may be that bonding information from another application was stored on the phone, but you have erased the bonding on the nRF while reprogramming it. Bonding information will not be deleted during the DFU update, so this is not something that will happen out in the field, but may happen when developing.

    Another question:

    Is this application (buttonless dfu) running on your DK? Did you program it together with the bootloader_settings page? Or are you trying to update from a blank chip only containing a bootloader?

    That is, what are you connected to? The bootloader or the application?

    BR,

    Edvin

Related