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?

  • Have you made sure you enable indication before you write 0x01 to enter DFU mode ? Have you tried to write 0x0104 (enter DFU mode, application update) 

    If that doesn't help, could you debug and check why it returns 0x04 ? 

  • Yes, I enable indication before write opcode. And the response is the same for 0x0104. Here is part of the message sequence from the output log:

     "Indications enabled" received
    "(0x) 01" sent
    "(0x) 20-01-04" received
    "(0x) 01-04" sent
    "(0x) 20-01-04" received

    My application is quite big, and I'm "debugging" using Segger Embedded Studio with size optimization level and debugging level set to 0, so I can set breakpoints in the disassembly but not in the code. I do not have much experience interpreting that.

    But looking at the functions at ble_dfu_bonded.c i understand that the only way to get DFU_RSP_OPERATION_FAILED as response code is that enter_bootloader() is returning an error, and so nrf_dfu_set_peer_data. Otherwise the response code would be different, isn't it?

  • Where do you get DFU_RSP_OPERATION_FAILED  ? Was it on the peer device ? 

    Can you test with a more simple application, like disable some of your application's features or test with the ble_app_buttonless_dfu ? 

  • Yes, I get DFU_RSP_OPERATION_FAILED on the peer device. I'm using nRFConnect.

    As you recommend, I've test a more simple application and found the error: sd_ble_gatts_sys_attr_get returns NRF_ERROR_NOT_FOUND (No system attributes found).

  • 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 ? 

Reply
  • 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 ? 

Children
Related