-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DFU Library Error in Android but Not iOS --- Error 8 (0x8) GATT CONN TIMEOUT #93
Comments
Hi, |
And I'm sorry for the delay, I was busy with other projects. |
Hi Philips, Thank you very much for your reply. I have sniffed the connection events to the Bootloader during DFU process for both Nordic iOS and Android. I have attached the sniffer files that can be inspected in Wireshark. I have also attached the screenshots highlighting the contents of LL_FEATURE_REQ and LL_FEATURE_RSP for iOS and Android. It is just after the peripheral device sends its LL_FEATURE_RSP when the Android DFU Library never responds... Let me know how it goes. Thank you! |
Additionally, here is the logfile gathered from Android Device Monitor during an nRF Connect app DFU attempt. Included are the logs from the point when the main application is BLE Disconnected until the point where the Bootloader has failed to receive a response from the Android DFU Library, at which point the device BLE Disconnects and re-boots into the main application. It seems like there's probably a lot of helpful info here in addition to the BLE Sniffer results from the last message. |
Are you saying you have the same behavior on all the phones you use for testing? Could you paste logs from nRF Connect or more logs from LogCat? |
As stated in the original post, iOS DFU Library works flawlessly with the same 12.2 SDK + firmware. Tested on the 3 Android phones described in OP, none of them working with Android DFU Library on my firmware. I described in OP how tweaking the SDK bootloader example's default Min/Max Connection parameters did not bring success, as others have been able to achieve. I can attempt a sample SDK 12.2 on a DK. Would you recommend I test by flashing "dfu_test_softdevice_bootloader_s132.hex" located in "SDKROOT/examples/dfu/ble_dfu_send_hex/test_images_update_nrf52" directory to an nRF52 DK and then update with the "dfu_test_softdevice_bootloader_s132.zip" file? Were you able to derive any useful info from the BLE Sniffer and LogCat logs i posted already? What more would you like to see from the logs? Thanks, |
Yes, that's the firmware I was taking about. The thing is I'd like to be able to reproduce your issue. I thought this "Disconnected before service discovery finished" was fixed together with fixing a race condition, but looks like wasn't. From the logs if like to see if you got any more ACL_* events around this second connection. I'm sorry again for replying so slow but I'm super busy these days... I'll ask someone in support to help me with your case. |
@philips77
Use
|
FYI, this issue was resolved for my application. The issue was the watchdog timer, set in firmware, expired too quickly for the Android DFU Library to connect. The problem was the delays in Android DFU Library caused the bootloader to exit before the connection request was sent. So, when the DFU Library tried to BLE Scan for the advertising device, it was too late and issued the ERROR: GATT CONN TIMEOUT. We fixed it for our Android App by reducing the length of delays that were introduced in this pull request: We also reduced the delay times in a few other places. The combination of these delay reductions allowed timing to work with the constraints of our bootloader's watchdog timeout. The iOS DFU Library does not have such delays. Which is why we did not see the issue with iOS. @yjwfn your error is not the 0x8 GATT error (GATT CONN TIMEOUT), it must be a 0x8 error for something else (OPERATION NOT PERMITTED). So, better to create a new ticket for that. I'll close the issue now. Thanks to @philips77 for helping. To be clear, it wasn't an issue with the Android DFU Library, as the delays are introduced to prevent timing errors to help the library be compatible with most Android phones. But, it is important to be aware for those of us who have a watchdog timer in their bootloader. |
This is not a duplicate of:
https://devzone.nordicsemi.com/question/87015/nrf-toolbox-gatt-conn-timeout-during-dfu/
https://devzone.nordicsemi.com/question/64206/getting-a-gatt-conn-timeout-message-when-trying-to-upload-a-new-firmware-via-ble-dfu/
https://devzone.nordicsemi.com/question/94972/error-8-0x8-gatt-conn-timeout-on-android/
I have tried to implement the accepted answers from these posts, but they did not work. Increasing the Max CI to 60, 100, or 500 do not work, nor does reducing the Android Packet Receipts Notification Procedure Number of Packets from 10 to 1, nor a combination of those two.
...
MCU: nRF52832
SoftDevice: SD132 v3.1.0
Phones: Samsung Galaxy S7 Edge on Android 7.0, Nexus 5 on Android 6.1, XiaoMi Mi A1 on Android 8.0
Nordic SDK: 12.2 with Secure Buttonless DFU
...
A) DFU with nRF Toolbox on iOS is good.
B) DFU with nRF Toolbox or nRF Connect on all tested Androids fail with "Error 8 (0x8) GATT CONN TIMEOUT"
The Android DFU Library successfully writes to the DFU Control Point, which writes to Bootloader Settings in Flash, resets the main application, and then the MCU launches the Bootloader in DFU Mode. Everything is the same between iOS and Android DFU until this point in the firmware logs:
Firmware Log from Successful iOS DFU
nrf_ble_dfu.c BLE_GAP_EVT_CONNECTED
Max CI = 24
Min CI = 24
Slave Latency = 0
Conn Sup TO = 72
nrf_ble_dfu.c BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST
nrf_ble_dfu.c BLE_GATTS_EVT_WRITE
nrf_ble_dfu.c BLE_GATTS_EVT_WRITE
nrf_ble_dfu.c BLE_EVT_RW_AUTHORIZE_REQUEST
... after this it continues the DFU procedure
Firmware Log from Failed Android DFU
nrf_ble_dfu.c BLE_GAP_EVT_CONNECTED
Max CI = 39
Min CI = 39
Slave Latency = 0
Conn Sup TO = 2000
... after this it disconnects with Error 8 (0x8) GATT CONN TIMEOUT
Android App Logs
DfuBaseService: Action received: android.bluetooth.device.action.ACL_CONNECTED
DfuBaseService: Attempting to start service discovery... succeed
DfuBaseService: Target device disconnected with status: 8
DfuBaseService: Device got disconnected before service discovery finished
...
Any ideas for how to fix?
The text was updated successfully, but these errors were encountered: