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

dfu removes bonds

Hello,

I am using secure dfu with bonds (SDKv15.3, Segger, nrF52832), it works fine however after each dfu (application only) I lose the bond information.

I have search about it and found that there are several variables that can affect to it, I think I checked all of them but the problem still remains:

1-I use nRF Toolbox from Android phone and I enabled the "keep bonds" option on the settings. Can you btw tell me what is doing exactly this option and how is this setting is transfered to the secure dfu code to remove or not the bonds?

2-The sdk_config.h on the secure download has NRF_DFU_APP_DATA_AREA_SIZE set to 12288 (I think is correct to match FDS 3*4*1024)

3-FDS on the application side (based on heart rate example) has FDS_VIRTUAL_PAGES = 3, FDS_VIRTUAL_PAGE_SIZE = 1024, where I think stores the bonds.

According to comment on sdk_config.h it is same size as 12288:

// <i> The total amount of flash memory that is used by FDS amounts to @ref FDS_VIRTUAL_PAGES * @ref FDS_VIRTUAL_PAGE_SIZE * 4 bytes.

To me knowledge all seems to be fine, but .... why I after dfu the phone and board cannot connect?

To bypass the problem I remove bonds on the board and phone and connect them after each dfu, then everything seems to work fine... till the next dfu.

Thanks,

Carlos

Parents
  • HI Carlos,

    I agree that the NRF_DFU_APP_DATA_AREA_SIZE  looks correct. 

    Can you btw tell me what is doing exactly this option and how is this setting is transfered to the secure dfu code to remove or not the bonds?

    The "keep bonds" in the nrf Toolbox app refers to the bonding information on the Android device. No bonding data is transferred to the nRF device by the nRF Toolbox app.

    Could you try to use the nRF Connect app to perform the DFU instead of nRF Toolbox? Do you see the same behavior there?

    If you do, could you capture a sniffer trace using our nRF Sniffer v2? It will make it easier to see which peer, i.e. the nRF or the Android, that does not have the correct bonding data.

    Best regards

     Best regards

    Bjørn 

  • Hello again,

    I found a similar case 

    https://devzone.nordicsemi.com/f/nordic-q-a/36346/a-problem-on-buttonless-dfu-bonding-valid

    The effect I have is same as described here, however I didn't change MTU size...

    Anyway, do you know if this issues was fixed?

    During the dfu I see this logs:

    <info> app: ble_evt_handler 0x10
    <info> app: Connected.
    <info> app: ble_evt_handler 0x14
    <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Encryption
    <info> app: ble_evt_handler 0x1A
    <info> app: ble_evt_handler 0x50
    <info> app: Received indication state 1
    <info> app: ble_evt_handler 0x50
    <info> app: Writing peer data to the bootloader...
    <info> app: ble_evt_handler 0x51
    <info> app: Device is preparing to enter bootloadï[info> app: Device is preparing to enter bootloader mode.
    <info> app: Disconnected 1 links.
    <info> app: ble_evt_handler 0x53
    <info> app: Device will enter bootloader mode.
    <info> pwr_mgmt: Shutdown request 2
    <info> pwr_mgmt: Shutdown started. Type 2
    <info> app: Power management wants to reset to DFU mode.
    <info> app: Power management allowed to reset to DFU mode.
    <info> pwr_mgmt: SysOff handler 0x0002C401 => ready
    <info> pwr_mgmt: Shutdown complete.
    <info> pwr_mgmt: NVIC_SystemReset

    When I connect same phone after dfu I see this logs I print event on evt_handler(this should correspond to the sniffer I sent you):

    <info> app: ble_evt_handler 0x10
    <info> app: Connected.
    <info> app: ble_evt_handler 0x54
    <info> app: ble_evt_handler 0x14
    <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Encryption
    <info> app: ble_evt_handler 0x1A
    <info> app: ble_evt_handler 0x12

    Could you look at the sniffer log?

    After that only works if I delete bond on both nrf and phone...

    Thanks,

    Carlos

  • Looking up the event IDs from the debug log:

    Event ID 0x10 = BLE_GAP_EVT_CONNECTED

    Event ID 0x12 = BLE_GAP_EVT_CONN_PARAM_UPDATE/**< Connection Parameters updated.

    Event ID 0x14 = BLE_GAP_EVT_SEC_INFO_REQUEST  /**< Request to provide security information.

    Event ID 0x1A = BLE_GAP_EVT_CONN_SEC_UPDATE /**< Connection security updated.

    Event ID 50 = BLE_GATTS_EVT_WRITE /**< Write operation performed.   

    Event ID 51 = BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST  /**< Read/Write Authorization request.    

    Event ID 53 = BLE_GATTS_EVT_HVC        /**< Handle Value Confirmation.  

    Event ID 54 = BLE_GATTS_EVT_SC_CONFIRM /**< Service Changed Confirmation.   

    I cannot see anything abnormal in the sniffer trace you attached. The nRF device responding with the LL_ENC_RSP and the LL_START_ENC_REQ and after that the link is secured. 

    You say that: 

    Carlos said:
    After that only works if I delete bond on both nrf and phone...

    Do you mean that you are not able to connect to the device again if you disconnect after this point? If so did you also capture a sniffer trace when try to reconnect?

  • Sorry, may be my explanation was not precise, I can connect but cannot see services that are SEC_JUST_WORKS after the dfu.

    The only way to see again the resources is to remove bonds on all sides (phone and nRf) and connect again.

    I guess is similar issue as stated in:

    https://devzone.nordicsemi.com/f/nordic-q-a/36346/a-problem-on-buttonless-dfu-bonding-valid

    That after dfu resources are lost and only way to see them again is to remove bonds.

    Thks

Reply Children
No Data
Related