Skip to content
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

Sometimes stucks at Sending firmware to DFU Packet characteristic... for a long time #515

Open
pontusarfwedson opened this issue Nov 6, 2023 · 2 comments
Labels

Comments

@pontusarfwedson
Copy link

pontusarfwedson commented Nov 6, 2023

DFU Bootloader version (please complete the following information):

  • Bonding used: yes
  • Library version: 4.13.0

Device information (please complete the following information):

  • Device: iPhone 12
  • OS: 17.0.3

Describe the bug
We initiate a DFU to a our peripheral device using this code

let selectedFirmware = try DFUFirmware(urlToZipFile: savedURL)
            
let initiator = DFUServiceInitiator().with(firmware: selectedFirmware)
initiator.logger = self
initiator.delegate = currentDfuDelegate
initiator.progressDelegate = currentProgressDelegate

let controller = initiator.start(target: peripheral)

It generally works OK and can finish DFU:ing our firmware in ~30-45 seconds. However, sometimes it simply goes to Sending firmware to DFU Packet characteristic ... and then nothing happens. Sometimes our bootloader will decide to restart resulting in a full restart of the DFU. Sometimes it suddenly progresses. This can be after anywhere from 30 seconds to 5 minutes. This can happen at any point during the DFU and sometimes multiple times during a single DFU.
What is the reason for it getting stuck at that point? Simply put, what is it waiting for? And is there anything we can do to mitigate this?
We are using your equivalent library for Android and there this never happens.

Logs

DEBUG: OtaService: DFU progress: Sending firmware to DFU Packet characteristic...
DEBUG: OtaService: DFU progress: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
DEBUG: OtaService: DFU progress: peripheral.writeValue(0x03, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
DEBUG: OtaService: DFU progress: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
DEBUG: OtaService: DFU progress: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 60030100b00100d5286317
DEBUG: OtaService: DFU progress: Checksum (Offset = 110592, CRC = 176328D5) received
DEBUG: OtaService: DFU progress: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
DEBUG: OtaService: DFU progress: peripheral.writeValue(0x04, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
DEBUG: OtaService: DFU progress: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
DEBUG: OtaService: DFU progress: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600401
DEBUG: OtaService: DFU progress: Data object executed
DEBUG: OtaService: DFU progress: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
DEBUG: OtaService: DFU progress: peripheral.writeValue(0x010200100000, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
DEBUG: OtaService: DFU progress: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
DEBUG: OtaService: DFU progress: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600101
DEBUG: OtaService: DFU progress: Data object 28/29 created
DEBUG: OtaService: DFU progress: Uploading firmware...
DEBUG: OtaService: DFU progress: Sending firmware to DFU Packet characteristic...

--- TWO MINUTES OF SILENCE HERE ---

DEBUG: OtaService: DFU progress: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
DEBUG: OtaService: DFU progress: peripheral.writeValue(0x03, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
DEBUG: OtaService: DFU progress: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
DEBUG: OtaService: DFU progress: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 60030100c00100981dcc7a
DEBUG: OtaService: DFU progress: Checksum (Offset = 114688, CRC = 7ACC1D98) received
DEBUG: OtaService: DFU progress: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
DEBUG: OtaService: DFU progress: peripheral.writeValue(0x04, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
DEBUG: OtaService: DFU progress: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
DEBUG: OtaService: DFU progress: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600401
DEBUG: OtaService: DFU progress: Data object executed
DEBUG: OtaService: DFU progress: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
DEBUG: OtaService: DFU progress: peripheral.writeValue(0x010260040000, for: 8EC90001-F315-4F60-9FB8-838830DAEA50, type: .withResponse)
DEBUG: OtaService: DFU progress: Data written to 8EC90001-F315-4F60-9FB8-838830DAEA50
DEBUG: OtaService: DFU progress: Notification received from 8EC90001-F315-4F60-9FB8-838830DAEA50, value (0x): 600101
DEBUG: OtaService: DFU progress: Data object 29/29 created
DEBUG: OtaService: DFU progress: Uploading firmware...
DEBUG: OtaService: DFU progress: Sending firmware to DFU Packet characteristic...
DEBUG: OtaService: DFU progress: Writing to characteristic 8EC90001-F315-4F60-9FB8-838830DAEA50...
@philips77
Copy link
Member

Thank you for creating the issue. This looks like an iOS issue...? Have you experienced it before? Did you try on a phone with older iOS version?
I'll try to replicate the issue, but I need to finish few other tasks before resuming work on the DFU library.

@philips77
Copy link
Member

I did a lot of testing using the Test App and could not replicate the issue. I used iPhone 11 and iPhone Xs for tests, iOS 16 and 17. Do you know how can I reproduce the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants