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

DFU, caching & iOS

Hi,

I know that this is a known issue, but I'm seeing caching issues often with iOS. I'm using S132 v5.0.0, SDK 14.0 against custom application with iOS DFU SDK and often I'm seeing that my device is unusable after DFU unless I toggle the bluetooth button in the iOS Settings window. If the DFU fails, then the device's displayed name continues to be DfuTarg unless bluetooth is toggled.

I'm using bonded devices, services changed characteristic is enabled in both app and BL.

Any reason why wouldn't the iOS discover the services correctly? Any solution for this issue? Workarounds?

I'll appreciate the help

Parents
  • OK, I got this working. Apparently, the SDK is not working well with DFU & multiple peers. Effectively, currently only the first peer is stored for SC indication.

    The total changes I did:

    1. ble_dfu_bonded.c: changed if (p_evt->params.peer_data_update_succeeded.data_id == PM_PEER_DATA_ID_GATT_LOCAL) to if (p_evt->params.peer_data_update_succeeded.data_id == PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING) since the former was never triggered; only the latter.
    2. ble_dfu_bonded.c: added break; before case PM_EVT_PEER_DATA_UPDATE_FAILED: since it'll enter the FAILED case upon any SUCCESS.
    3. in main.c, in case BLE_DFU_EVT_BOOTLOADER_ENTER_PREPARE: stopped advertisement (setting ble_adv_on_disconnect_disabled with ble_advertising_modes_config_set(x)) since the iOS/android app SDK will reconnect to the FW before entering bootloader and cause app SDK errors.
    4. gatt_cache_manager.c: removed fallthrough of case NRF_ERROR_INVALID_STATE in service_changed_send_in_evt(x) since this function is triggered after disconnection, after storing peers' data but before entering bootloader, which will drop the SC indication storage.
    5. increased FDS_OP_QUEUE_SIZE since I saw a lot of FDS_ERR_NO_SPACE_IN_QUEUES which may cause peers' data to be discarded before entering bootloader

    For now, it's working well. Couldn't find any bugs. Can somebody review the changes and possible effects on application behavior?

Reply
  • OK, I got this working. Apparently, the SDK is not working well with DFU & multiple peers. Effectively, currently only the first peer is stored for SC indication.

    The total changes I did:

    1. ble_dfu_bonded.c: changed if (p_evt->params.peer_data_update_succeeded.data_id == PM_PEER_DATA_ID_GATT_LOCAL) to if (p_evt->params.peer_data_update_succeeded.data_id == PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING) since the former was never triggered; only the latter.
    2. ble_dfu_bonded.c: added break; before case PM_EVT_PEER_DATA_UPDATE_FAILED: since it'll enter the FAILED case upon any SUCCESS.
    3. in main.c, in case BLE_DFU_EVT_BOOTLOADER_ENTER_PREPARE: stopped advertisement (setting ble_adv_on_disconnect_disabled with ble_advertising_modes_config_set(x)) since the iOS/android app SDK will reconnect to the FW before entering bootloader and cause app SDK errors.
    4. gatt_cache_manager.c: removed fallthrough of case NRF_ERROR_INVALID_STATE in service_changed_send_in_evt(x) since this function is triggered after disconnection, after storing peers' data but before entering bootloader, which will drop the SC indication storage.
    5. increased FDS_OP_QUEUE_SIZE since I saw a lot of FDS_ERR_NO_SPACE_IN_QUEUES which may cause peers' data to be discarded before entering bootloader

    For now, it's working well. Couldn't find any bugs. Can somebody review the changes and possible effects on application behavior?

Children
No Data
Related