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

DFU with bonds and nrf52810

Hi, 

I have a working application with Buttonless Secure DFU Service wich runs on nRF52832. I'm able to perform DFU without bonds, but I want to use bonding in my application. 

I have modified the following define in my application NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS 1 and NRF_DFU_BLE_REQUIRES_BONDS 1 in the bootloader. I have also generated a bootloader_settings_page for my application and I'm flashing it together with the bootloader, but function nrf_dfu_settings_peer_data_is_valid still returns false. Isn't supposed the bootloader_settings_page to avoid this?

I also have another question: if I want one of my services to require encryption, but no MITM protection (BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM) is it required for the bootloader and DFU Buttonless Service to have bond support?

Parents
  • Hi Adriana, 

    nrf_dfu_settings_peer_data_is_valid() returns false because there is no bond information inside the bootloader setting. 

    To be able to test the DFU bootloader with bond, you would need to let the buttonless application run first, then perform a bond with a central device (a phone for example) then you can switch to the bootloader and nrf_dfu_settings_peer_data_is_valid () should return true.

     

    Setting BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM to a characteristic, will cause the characteristic to reject any read and/or write before the link is encrypted. In your case, as you want the link to be encrypted before bootloader mode can be triggered, you can set the characteristic to be with BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM  property. But it's not mandatory. What mandatory is that the bond information should be stored in bootloader setting. 

     

  • Thanks, I'm trying this. But when I write opcode 0x01 [Enter DFU mode] I receive response code 0x04 [Operation failed]. I'm debugging my application and found that ble_dfu_buttonless_on_ctrl_pt_write function is reporting this error. How can I know what's going on?

  • You would need to let me know where sd_ble_gatts_sys_attr_get () is called. This looks more like you are not initialize the service correctly, the CCCD didn't have an initial value set. 

    Please tell me exactly how you test (step by step) , have you made sure you bond before you switch to DFU bootloader ? Have you tried the ble_app_buttonless_dfu  with bond ? 

  • Sorry, sd_ble_gatts_sys_attr_get() is called at retrieve_peer_data(), inside of enter_bootloader() (ble_dfu_bonded.c)

    Yes, ble_app_buttonless_dfu with bond works fine with my bootloader, and the DFU Service inizalization is the same.

    I've enabled NRF_SDH_BLE_SERVICE_CHANGED and now it works, but why? So far as I understand, bootloader should advertise with address incremented by 1, so it is visible as a new device and requires a new service discovery.

  • Hi Adriana, 


    Yes the bootloader may increase address (not when you do bonding, when you do bonding the bootloader retain the address ) but here we talking about the buttonless application, when you add a new service into your application if you don't have service changed characteristic then the phone won't update that you have the DFU buttonless service. So, please enable service changed on both the application and the bootloader. 

  • I'm not talking about buttonless application. I'm talking about my own application, wich has DFU buttonless service and the central peer is discovering the service.

    Do you mean that, even if the central peer shows the service, I can't rely on interaction if I don't have the service changed characteristic?

  • Correct, if on your application (which has buttonless service) you dont have service changed characteristic, the phone won't expect to do service discovery after you switch to bootloader. Result in that the new attribute table of the bootloader won't be discovered, unless you delete bond/ turn off and on bluetooth

Reply Children
Related