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

nRFConnect App on iOS cannot do take app into DFU mode with SDK15.2

Hi, 

nRFConnect is behaving differently for apps on different SDK versions. I am able to do a DFU via script something similar to the one here https://thegecko.github.io/web-bluetooth-dfu/examples/web.html. The app uses SDK 15.2. However, on testing DFU via nrfConnect on iOS it doesn't work. The device doesn't enter DFU mode. The same nrfConnect app can do DFU for an app using SDK 14.2.

Has anyone observed this before?

Parents
  • Hi Chaitz, 

    No, I have not seen this issue before. Our mobile applications should be compatible with the latest version of our SDK as well as backwards-compatible with older versions of the SDK. 

    Can you provide a sniffer trace of the on-air packets between the nRF device running SDK v15.2.0 and the iOS device? You can use our nRF Sniffer to do the trace, see https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Sniffer

    Any log output from the nRF device or the nRF connect app on the iOS side would also be helpful. 

    Best regards

    Bjørn

  • Hi Bjørn

    Apologies for the delayed response. I have the following observations

    1. The characteristics in the app cannot be subscribed to using the nrfConnect app, however it works fine with LightBlue app.

    2. Using the sniffer I see that there are errors in ATT protocol - 0x0a attribute not found'.

    3. Also the slave device disconnects from nrfConnect after a certain interval of time.

    Any clues why this happens with nrfConnect/iOS?

  • Hi Bjørn,

    Thanks for the response. I will send you the sniffer logs soon. Meanwhile, I added peer manager (it was missing somehow!) to the applications and it seems to be working now. I am still validating this change. Can you please let me know whether it is mandatory to have peer manager? How much flash does it use and I see that it distributes service change indications - this will affect DFU isn't it? What is the effect of disabling peer manager?

  • You can use our bootloader in two configurations; allow DFU from unbonded devices (use ble_dfu_unbonded.c) or only allow DFU from bonded devices(use ble_dfu_bonded.c with NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS in the Preprocessor Definitions) . If the latter configuration is chosen, then you need to use the Peer Manager, as the bootloader uses its API to retrieve peer data( encryption keys, identity resolving keys etc). 

    The Peer Manager and its dependencies is about 15kB I think. GATT table caching should only be an issue if you have bonded with the iOS device. 

  • You can use our bootloader in two configurations; allow DFU from unbonded devices (use ble_dfu_unbonded.c) or only allow DFU from bonded devices(use ble_dfu_bonded.c with NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS in the Preprocessor Definitions) . If the latter configuration is chosen, then you need to use the Peer Manager, as the bootloader uses its API to retrieve peer data( encryption keys, identity resolving keys etc). 

    The Peer Manager and its dependencies is about 15kB I think. GATT table caching should only be an issue if you have bonded with the iOS device. 

  • NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS is set to 0 and we are using ble_dfu_unbonded.c. So does this mean that peer manager is still needed for sending the service change indication?

  • No, service changed indication should only be necessary if you are bonded with the iOS device. You can initiate a Service Changed Indication through the SD API, i.e. sd_ble_gatts_service_changed()

    If you are not bonded the the Bootloader will increment the device address by one so that it appears as a "new" device

    #if (!NRF_DFU_BLE_REQUIRES_BONDS)
    static uint32_t gap_address_change(void)
    {
        uint32_t       err_code;
        ble_gap_addr_t addr;
    
        err_code = sd_ble_gap_addr_get(&addr);
        VERIFY_SUCCESS(err_code);
    
        /* Increase the BLE address by one when advertising openly. */
        addr.addr[0] += 1;
    
        err_code = sd_ble_gap_addr_set(&addr);
        VERIFY_SUCCESS(err_code);
    
        return NRF_SUCCESS;
    }
    #endif

    So if you are not bonding to the iOS device and you do accept DFU from unbonded peers, then you should not need to use the peer manager. 

Reply
  • No, service changed indication should only be necessary if you are bonded with the iOS device. You can initiate a Service Changed Indication through the SD API, i.e. sd_ble_gatts_service_changed()

    If you are not bonded the the Bootloader will increment the device address by one so that it appears as a "new" device

    #if (!NRF_DFU_BLE_REQUIRES_BONDS)
    static uint32_t gap_address_change(void)
    {
        uint32_t       err_code;
        ble_gap_addr_t addr;
    
        err_code = sd_ble_gap_addr_get(&addr);
        VERIFY_SUCCESS(err_code);
    
        /* Increase the BLE address by one when advertising openly. */
        addr.addr[0] += 1;
    
        err_code = sd_ble_gap_addr_set(&addr);
        VERIFY_SUCCESS(err_code);
    
        return NRF_SUCCESS;
    }
    #endif

    So if you are not bonding to the iOS device and you do accept DFU from unbonded peers, then you should not need to use the peer manager. 

Children
Related