This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Losing Bonding and FDS info on DFU

Running 52840 with SDK 15.3, SD140 on SES Ive got an application that has a bootloader on it running DFU.  Everything works during DFU correctly but when I get into the application (same SDK version), I've lost my bonding and other FDS information. 

Application is operating peripheral only, non-bonded DFU.  The application itself uses peer manager with whitelists and storing bonding information.

There are several tickets running around here from other SDK versions on the subject and I'm not finding anything that is helping here. 

In the nrf_dfu_types.h file I've got the DFU_APP_DATA_RESERVED set at default of 3 pages which is what the FDS is set at as well so this should match up.

Maybe there is some other setting to turn on saving the area at all that isn't?

Thanks

  • Experiment this morning:

    * flashed with prior version of the code using Segger jlink lite.
    * Connected up the app (Android app on a Samsung tablet) and bound the device (so now I should have bonding information to this tablet).
    * Drop the app
    * Use nRFconnect to kick into bootloader mode
    * Us nRFconnect to do DFU to Current version of the code
    * Connect back up with JLink RTT viewer

    nRFconnect was asking to pair, so paired (twice)

    Got (these are [mostly] my internal debug statements printing things but some of these are Nordic debug statements:

    00> [1638809628.058] Reboot into bootloader in 1 sec...
    00> [3624999905.013] POR Vbat: (3.00V)
    00> <debug> nrf_sdh_freertos: Creating a SoftDevice task.
    00> <debug> ble_scan: Adding filter on RWStudentID name
    00> <info> app: USB power detected
    00> <debug> nrf_sdh_freertos: Enter softdevice_task.
    00> [3624999905.266] Whitelist: File found
    00> [3624999905.266] Whitelist: File read successfully
    00> [3624999905.266] Whitelist: Whitelist file found. peer_id=0
    00> [3624999905.267] Whitelist: File found. Writing data into it
    00> [3624999905.267] Whitelist: Write succeeded.
    00> <info> app: USB ready
    00> [1630337702.317] temperature: 22.0C
    00> [1630337702.317] Vbat: 100% (3.41V)

    * Bring App back up

    The App is showing stuff coming from the device but attempting to connect and send a command is showing (on Segger RTT viewer):

    00> [1630338002.415] Vbat: 100% (3.39V)
    00> <warning> peer_manager_gcm: The local database has changed, so some subscriptions to notifications and indications could not be restored for conn_handle 0
    00> <warning> peer_manager_handler: Local DB could not be applied: conn_handle: 0, peer_id: 0
    00> <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
    00> [1630338050.927] BLE: Peer connected
    00> [1630338051.061] BLE: Allow repairing: 0
    00> <info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Bonding, error: 133
    00> <warning> peer_manager_handler: Disconnecting conn_handle 0.
    00> <debug> nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).
    00> [1630338051.151] BLE: Data len is set to 0xF4(244)
    00> <debug> nrf_ble_gatt: Peer on connection 0x0 requested a data length of 251 bytes.
    00> <debug> nrf_ble_gatt: Updating data length to 27 on connection 0x0.
    00> <error> nrf_ble_gatt: sd_ble_gap_data_length_update() (request) on connection 0x0 returned NRF_ERROR_INVALID_STATE.
    00> [1630338051.012] POR Vbat: (3.35V) [<- my log indicating reset path]
    00> <debug> nrf_sdh_freertos: Creating a SoftDevice task.
    00> <debug> ble_scan: Adding filter on RWStudentID name
    00> <info> app: USB power detected
    00> <debug> nrf_sdh_freertos: Enter softdevice_task.
    00> [1630338051.250] Whitelist: File found
    00> [1630338051.250] Whitelist: File read successfully
    00> [1630338051.250] Whitelist: Whitelist file found. peer_id=0
    00> [1630338051.251] Whitelist: File found. Writing data into it
    00> [1630338051.251] Whitelist: Write succeeded.
    00> [1630338051.256] Device service: Version=0.8.4.2, Family=90, ProgramChecksum=2213D3E4
    00> [1630338051.259] Whitelist: File found
    00> [1630338051.259] Whitelist: File read successfully
    00> [1630338051.259] BLE: Whitelist contains a peer. Start advertising.
    00> [1630338051.259] Whitelist: Applied whitelist with addr_cnt=1 irk_cnt=1
    00> [1630338051.264] temperature: 23.0C
    00> [1630338051.264] Vbat: 100% (3.45V)
    00> [1630338051.270] LOG: 221,18,0x00,0x00
    00> <info> app: USB ready
    00> [1630337462.277] POR [<- my log indicating reset path]


    There appears to be several places where I'm overrunning the output buffers here, but the interesting thing to note here is extra POR events that shouldn't be there.

    This has something or other to do with the DFU, but not at all clear to me what...

  • One of the errors I had, I did a search on and came up with something you've answered before to some extent.. https://devzone.nordicsemi.com/f/nordic-q-a/38663/keep-getting-failed-to-secure-connection-error/156832#156832

    I already had some cod in there to prevent this but changed it to

                pm_conn_sec_config_t conn_sec_config = { .allow_repairing = true };

    And I can now run commands from my App against this thing (albeit with an Android request for pairing).

    I'm going to follow that thread a bit more...

  • After some experiments, it looks like this is what's going on here.... I've put this code in and I think it's working correctly from here..

Related