Issue with nRF DFU App (v2.7.0) on Android 11 and 14: DFU Update Fails Due to Missing Location Permission?

Hi All

I am experiencing an issue with the nRF DFU app (v2.7.0) on devices running both Android 11 and Android 14. The issue occurs when I attempt to perform a DFU update via Bluetooth LE.

- Upon starting the BLE scan in nRF DFU, I see the message: "The app needs to scan and connect to Bluetooth LE devices." I grant the required permissions, and the scan begins successfully.
- However, when initiating the DFU update, the process starts but fails almost immediately without transferring the firmware.
- When I perform the same DFU update using nRF Connect, the process works correctly. In nRF Connect, the app explicitly requests Location permissions, and the DFU update completes successfully without any issues.
It seems that the nRF DFU app does not request the necessary Location permissions, which may be causing the BLE operations to fail during the DFU process.

I tried the following:
- Verified that the Nearby Devices permission is granted, but there is no option to enable Location permissions in the app settings for nRF DFU.

- Uninstalled and reinstalled the app, then restarted the phone, but the issue persists.

- Tested the app on both Android 11 and Android 14, with the same problematic result.

- Reverted to nRF DFU v2.4.0, which works correctly. The issue seems to have been introduced in later versions.

- The DFU update works correctly when performed via nRF Connect, indicating that the issue is specific to the nRF DFU app.

- In nRF Connect, the app requests Location permissions, which may be the key difference leading to the success of the DFU update.

Any hints to solve the issue?

Thanks in advance for your support.

Kind regards,

Cristian

Parents
  • Hello,

    In nRF DFU app we're using "neverForLocation" flag (https://developer.android.com/develop/connectivity/bluetooth/bt-permissions#assert-never-for-location) when requesting for Bluetooth Scan permission. This means that the app doesn't need location permission but also doesn't get iBeacons and Eddystone (and perhaps other) beacons in scan results. 

    In nRF Connect, the app explicitly requests Location permissions, and the DFU update completes successfully without any issues.

    In nRF Connect we actually do want to scan for any Bluetooth LE device, including beacons, therefore we are requesting for location.

    When I perform the same DFU update using nRF Connect, the process works correctly.

    The current version of nRF Connect is using a bit older version of DFU library than the nRF DFU app. I'm actually working now on integrating the latest version into the app.

    Answering your question, nRF DFU app should work with any DFU from nRF5 SDK from 4.3 up until 17.1. Indeed, we introduced some speed optimizations in the latest version, which may cause your device to respond with an error due to too slow flash save operations on the device. Could you clarify what error are you getting here: "it shows a generic error message".

    Possible solutions:
    1. In nRF DFU app tap the Settings icon and enable Packet Receipt Notification and set the value to 6. This should fix the flash problem.
    2. Before doing DFU install nRF Logger app. Then, when your upload fails, tap the log icon (magnifying glass) in the top-right corner, to see the logs. Please share them here.

Reply
  • Hello,

    In nRF DFU app we're using "neverForLocation" flag (https://developer.android.com/develop/connectivity/bluetooth/bt-permissions#assert-never-for-location) when requesting for Bluetooth Scan permission. This means that the app doesn't need location permission but also doesn't get iBeacons and Eddystone (and perhaps other) beacons in scan results. 

    In nRF Connect, the app explicitly requests Location permissions, and the DFU update completes successfully without any issues.

    In nRF Connect we actually do want to scan for any Bluetooth LE device, including beacons, therefore we are requesting for location.

    When I perform the same DFU update using nRF Connect, the process works correctly.

    The current version of nRF Connect is using a bit older version of DFU library than the nRF DFU app. I'm actually working now on integrating the latest version into the app.

    Answering your question, nRF DFU app should work with any DFU from nRF5 SDK from 4.3 up until 17.1. Indeed, we introduced some speed optimizations in the latest version, which may cause your device to respond with an error due to too slow flash save operations on the device. Could you clarify what error are you getting here: "it shows a generic error message".

    Possible solutions:
    1. In nRF DFU app tap the Settings icon and enable Packet Receipt Notification and set the value to 6. This should fix the flash problem.
    2. Before doing DFU install nRF Logger app. Then, when your upload fails, tap the log icon (magnifying glass) in the top-right corner, to see the logs. Please share them here.

Children
  • Hello

    Thank you very much for your support.

    With the nRF DFU app settings left at their default values, the process ends with the error shown in the attached screenshot. The corresponding log file is also attached.

    Following your suggestions, I enabled the packet receipt notification in the nRF DFU application and set the value to 6. This has definitively resolved the flashing issue.

    Kind regards

    Cristian

    DFU, 2024-11-14
    DfuO2HC (D9:E7:A1:69:CB:55)
    V 09:54:54.271 [DFU] DFU service started
    V 09:54:54.287 [DFU] Opening file...
    I 09:54:54.302 [DFU] Firmware file opened successfully
    V 09:54:54.313 [DFU] Connecting to DFU target...
    D 09:54:54.324 [DFU] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferredPhy = LE_1M | LE_2M)
    D 09:54:54.568 [DFU] [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    I 09:54:54.595 [DFU] Connected to D9:E7:A1:69:CB:55
    V 09:54:54.612 [DFU] Discovering services...
    D 09:54:54.629 [DFU] gatt.discoverServices()
    I 09:54:55.140 [DFU] Services discovered
    V 09:54:55.164 [DFU] Reading DFU version number...
    D 09:54:55.184 [DFU] gatt.readCharacteristic(00001534-1212-efde-1523-785feabcd123)
    I 09:54:55.205 [DFU] Read Response received from 00001534-1212-efde-1523-785feabcd123, value (0x): 05-00
    A 09:54:55.228 [DFU] Version number read: 0.5
    V 09:54:55.249 [DFU] Requesting new MTU...
    D 09:54:55.269 [DFU] gatt.requestMtu(517)
    I 09:54:55.289 [DFU] MTU changed to: 23
    V 09:54:55.309 [DFU] Enabling notifications for 00001531-1212-efde-1523-785feabcd123
    D 09:54:55.330 [DFU] gatt.setCharacteristicNotification(00001531-1212-efde-1523-785feabcd123, true)
    D 09:54:55.350 [DFU] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
    I 09:54:55.379 [DFU] Data written to descr.00001531-1212-efde-1523-785feabcd123
    V 09:54:55.401 [DFU] Notifications enabled for 00001531-1212-efde-1523-785feabcd123
    A 09:54:55.423 [DFU] Notifications enabled
    V 09:54:55.441 [DFU] Writing to characteristic 00001531-1212-efde-1523-785feabcd123, value (0x): 01-04
    D 09:54:55.461 [DFU] gatt.writeCharacteristic(00001531-1212-efde-1523-785feabcd123)
    I 09:54:55.478 [DFU] Data written to 00001531-1212-efde-1523-785feabcd123
    A 09:54:55.494 [DFU] DFU Start sent (Op Code = 1, Upload Mode = 4)
    V 09:54:55.512 [DFU] Writing to characteristic 00001532-1212-efde-1523-785feabcd123, value (0x): 00-00-00-00-00-00-00-00-CC-AA-00-00
    D 09:54:55.529 [DFU] gatt.writeCharacteristic(00001532-1212-efde-1523-785feabcd123)
    I 09:54:55.556 [DFU] Data written to 00001532-1212-efde-1523-785feabcd123
    A 09:54:55.588 [DFU] Firmware image size sent (0b, 0b, 43724b)
    I 09:54:57.656 [DFU] Notification received from 00001531-1212-efde-1523-785feabcd123, value (0x): 10-01-01
    A 09:54:57.674 [DFU] Response received (Op Code = 1 Status = 1)
    V 09:54:57.691 [DFU] Requesting high connection priority...
    D 09:54:57.706 [DFU] gatt.requestConnectionPriority(HIGH)
    A 09:54:57.721 [DFU] Writing Initialize DFU Parameters...
    V 09:54:57.747 [DFU] Writing to characteristic 00001531-1212-efde-1523-785feabcd123, value (0x): 02-00
    D 09:54:57.764 [DFU] gatt.writeCharacteristic(00001531-1212-efde-1523-785feabcd123)
    I 09:54:57.781 [DFU] Data written to 00001531-1212-efde-1523-785feabcd123
    V 09:54:57.798 [DFU] Writing to characteristic 00001532-1212-efde-1523-785feabcd123 value (0x): FF-FF-FF-FF-FF-FF-FF-FF-01-00-FE-FF-37-D3
    D 09:54:57.820 [DFU] gatt.writeCharacteristic(00001532-1212-efde-1523-785feabcd123)
    I 09:54:57.835 [DFU] Data written to 00001532-1212-efde-1523-785feabcd123
    V 09:54:57.851 [DFU] Writing to characteristic 00001531-1212-efde-1523-785feabcd123, value (0x): 02-01
    D 09:54:57.868 [DFU] gatt.writeCharacteristic(00001531-1212-efde-1523-785feabcd123)
    I 09:54:57.887 [DFU] Data written to 00001531-1212-efde-1523-785feabcd123
    A 09:54:57.907 [DFU] Initialize DFU Parameters completed
    I 09:54:57.930 [DFU] Notification received from 00001531-1212-efde-1523-785feabcd123, value (0x): 10-02-01
    A 09:54:57.951 [DFU] Response received (Op Code = 2, Status = 1)
    V 09:54:57.971 [DFU] Writing to characteristic 00001531-1212-efde-1523-785feabcd123, value (0x): 03
    D 09:54:57.990 [DFU] gatt.writeCharacteristic(00001531-1212-efde-1523-785feabcd123)
    I 09:54:58.011 [DFU] Data written to 00001531-1212-efde-1523-785feabcd123
    A 09:54:58.028 [DFU] Receive Firmware Image request sent
    A 09:54:58.042 [DFU] Uploading firmware...
    V 09:54:58.057 [DFU] Sending firmware to characteristic 00001532-1212-efde-1523-785feabcd123...
    I 09:54:58.079 [DFU] Notification received from 00001531-1212-efde-1523-785feabcd123, value (0x): 10-03-06
    A 09:54:58.095 [DFU] Response received (Op Code = 3, Status = 6)
    I 09:54:58.113 [DFU] Data written to 00001532-1212-efde-1523-785feabcd123
    E 09:54:58.131 [DFU] Remote DFU error: OPERATION FAILED
    V 09:54:58.151 [DFU] Writing to characteristic 00001531-1212-efde-1523-785feabcd123, value (0x): 06
    D 09:54:58.167 [DFU] gatt.writeCharacteristic(00001531-1212-efde-1523-785feabcd123)
    A 09:55:03.080 [DFU] Reset request sent
    V 09:55:03.123 [DFU] Disconnecting...
    D 09:55:03.140 [DFU] gatt.disconnect()
    I 09:55:03.178 [DFU] Disconnected
    D 09:55:03.191 [DFU] gatt.refresh() (hidden)
    D 09:55:03.206 [DFU] gatt.disconnect()
    D 09:55:03.221 [DFU] gatt.close()
    D 09:55:03.235 [DFU] wait(600)
    D 09:55:03.250 [DFU] [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED

Related