IOS-DFU-Library: Error 201 connection failed

DFU Bootloader version (please complete the following information):

  • SDK version: [e.g. SDK 16]
  • Library version: [e.g. 4.6.1]

Device information (please complete the following information):

  • OS: [e.g. iOS 13.x]

Your question Hi, i’ve a problem with version 4.6.1. Every update fails with error Error 201: Device failed to connect. This is my configuration:

       let dfuInitiator = DFUServiceInitiator(queue: DispatchQueue(label: "Other"))
       dfuInitiator.delegate = self
       dfuInitiator.progressDelegate = self
       dfuInitiator.logger = self

       if #available(iOS 11.0, macOS 10.13, *) {
           dfuInitiator.packetReceiptNotificationParameter = 0
       }
       self.dfuController = dfuInitiator.with(firmware: selFirmware!).start(target: dfuPeripheral)

Moreover, the update fails and abort() command seems to not works. The device seems to be bricked. I can’t detect it after the update Logs Error 201: Device failed to connect

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I found a fix for my problem. Turns out the hard-coded timeout when connecting in DFUPeripheral.swift peripheralDidDisconnect() method wasn’t waiting long enough. I did make a branch, make the changes and tried to push, but I was having authentication issues. So I created a patch file:

diff --git a/iOSDFULibrary/Classes/Implementation/GenericDFU/DFUPeripheral.swift b/iOSDFULibrary/Classes/Implementation/GenericDFU/DFUPeripheral.swift
index 019f41b..e0a5e3a 100644
--- a/iOSDFULibrary/Classes/Implementation/GenericDFU/DFUPeripheral.swift
+++ b/iOSDFULibrary/Classes/Implementation/GenericDFU/DFUPeripheral.swift
@@ -654,7 +654,7 @@ internal class BaseCommonDFUPeripheral<TD : DFUPeripheralDelegate, TS : DFUServi
             if (delegate?.peripheralDidDisconnectAfterFirmwarePartSent() ?? false) {
                 // As we are already in bootloader mode, the peripheral set
                 // may be reused for sending a second part.
-                connectOrSwitchToNewPeripheral(after: 3.0)
+                connectOrSwitchToNewPeripheral(after: 15.0)
             } else {
                 // Upload is completed.
                 // Peripheral has been destroyed and state is now .completed.

I don’t really care on your approach. It could be making this hardcoded 15, or even a user-settable property from service.