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

iOS DFU Writing to characteristic failed

I'm using the iOS latest iOSDFULibrary pods to import to my app. However, after I using DFUServiceIniciator service the log just show as attach.DFUQuestionLog.m

The only different with the Nordic iOS toolbox is the following line : 10: Packet Receipt Notif Req (Op Code= 8, Value = 12) request sent. Moreover, I used Nordic iOS toolbox did succeed to OTA the device.

My question is that is it the possible that the the DFUServiceInitiator didn't found the total characteristics in my App?

And if there is possible to fix ATT error, how would I change the iOSDFULibrary?

Thanks~

Update: full DFU log. /Users/dennislan/Desktop/DFUQuestionFullLog.m

  • Hi Hung, I'll provide the sniffer trace later. The only difference is the following line:

    from Toolbox Packet Receipt Notif Req (Op Code= 8, Value = 12) request sent.

    from DFUfulllog: Packet Receipt Notif Req (Op Code= 8, Value = 0) request sent. Thanks~

  • If you change the code in your application to request notification packet after every 12 data packet, the same as the Toolbox does, would the error still occur ?

  • I see. I'll try to modify the code in my application to be the same as Toolbox. By the way, I'm still purchasing the sniffer from the supplier, it may take some days.

  • After Several testing, I found out that the problem may be the same as the following link: github.com/.../24

    According to the log in Xcode, the Value for my case return 0

    ex. 10: Packet Receipt Notif Req (Op Code = 8, Value = 0) request sent

    As the upon link said, maybe the .packetReceiptNotificationParameter was modified by user to return 0. As the result, I modified with following example and it just suceed.

    DFUServiceInitiator *initiator = [[DFUServiceInitiator alloc] initWithCentralManager:bluetoothManager target:peripheral];
    NSString *selectedPath = [[NSBundle mainBundle] pathForResource:@"selectedfile" ofType:@"zip"];
             NSURL *url = [NSURL fileURLWithPath:selectedPath];
             selectedFirmware = [[DFUFirmware alloc] initWithUrlToZipFile:url];
             [initiator withFirmwareFile:selectedFirmware];
             initiator.forceDfu = [[[NSUserDefaults standardUserDefaults] valueForKey:@"dfu_force_dfu"] boolValue]; 
    // initiator.packetReceiptNotificationParameter = [[[NSUserDefaults standardUserDefaults] valueForKey:@"dfu_number_of_packets"] intValue];
    
             initiator.logger = self;
             initiator.delegate = self;
             initiator.progressDelegate = self;
             controller = [initiator start];
    
  • Hi Dennis,

    It's great that you figured out the issue. Please be noted that the library you pointed to is obsoleted and should be replaced by this one.

    In the new repo the issue is fixed, and you are free to set it to 0 (to disable notification) or to something >12 as mentioned here.

Related