Firmware update always gives error on iOS

Could not perform DFU. Firmware 0.3.3 requires bootloader version '0.3.2' which does not exist.

Looking at the code, it first retrieves this from Mbient servers as the latest firmware update:

hardwareRev : "0.4"
modelNumber : "5"
buildFlavor : "vanilla"
firmwareRev : "1.5.0"
filename : "firmware.zip"
requiredBootloader : "0.4.0"

Then it tries to retrieve boot loader 0.4.0, which in turns gives:

hardwareRev : "0.4"
modelNumber : "5"
buildFlavor : "bootloader"
firmwareRev : "0.4.0"
filename : "sd_bl.zip"
requiredBootloader : "0.3.3"

Since this is a recursive function (MetaWear+Firmware.swift, func updateMetaBoot), this goes on. It tries to retrieve boot loader 0.3.3 next:

hardwareRev : "0.4"
modelNumber : "5"
buildFlavor : "bootloader"
firmwareRev : "0.3.3"
filename : "bl.zip"
requiredBootloader : "0.3.2"

And then boot loader 0.3.2, which fails, as it doesn't exist.

The sensor that I'm testing with is on firmware version 1.5.0, updated with the MetaBase app. I'm trying to integrate the firmware update process into our app. The MetaBase app works with the same sensor, it re-flashes firmware version 1.5.0 without issues.

Maybe firmware version 1.5.0 was the first one that required a boot loader update as well, since the iOS SDK was released? The code doesn't seem like it ever worked in this use case.

Comments

  • Which version of the MetaBase App, are you at the latest? This was fixed in the latest release months ago.

  • edited January 2020

    I'm trying to integrate the firmware update process into our app.
    The error occurs with the latest iOS SDK's firmware update. The MetaBase app works fine.

  • @kustra
    Firmware 1.5.0 updates the bluetooth firmware stack in order to support BLE 5.1, which required a new bootloader (r0.4.0). MMR r0.4 devices ship with bootloader r0.3.3, so the update should need to search so far down the dependency list. There was an issue fixed in MetaBase your app must be missing.

  • @Matt
    is it possible that your MetaWear iOS SDK never received this bugfix?
    Here's the line that causes the bug: https://github.com/mbientlab/MetaWear-SDK-iOS-macOS-tvOS/blob/master/MetaWear/DFU/MetaWear+Firmware.swift#L119

    Can you please push the bugfix to your MetaWear iOS SDK?

  • Ok I went back and checked. MetaBase is working and MetaBase uses the cocoapods 3.4.0 which is built on the APIs. It is not possible for the API to fail but for MetaBase to work.
    Can you make sure your stuff is up to date?

  • @kustra we confirmed this part of the API did not change with the latest MetaBase. The function you linked should never recurse -- your MetaMotion device running firmware r1.5.0 must also be running bootloader revision r0.4.0. The dependency check will be met, as r0.4.0 is the required bootloader for r1.5.0 firmware.

    Could you confirm that you are attempting to re-update your device with r1.5.0 or to do something else?

  • @Matt @Laura thank you for taking the time to check this out.
    I went back and attempted a firmware update on a sensor that we've ordered recently. This sensor was delivered with firmware version 1.5.0 already:

    Step 1
    if let required = build.requiredBootloader, required != metaboot.info!.firmwareRevision
    (MetaWear+Firmware.swift, Line 119)

    Here's the debugger output for the two relevant variables:

    build:
        - hardwareRev : "0.4"
        - modelNumber : "5"
        - buildFlavor : "vanilla"
        - firmwareRev : "1.5.0"
        - filename : "firmware.zip"
        - requiredBootloader : "0.4.0"
        - firmwareURL : https://mbientlab.com/releases/metawear/0.4/5/vanilla/1.5.0/firmware.zip
    
    metaboot.info:
        - manufacturer : "MbientLab Inc"
        - modelNumber : "5"
        - serialNumber : "047B2A"
        - firmwareRevision : "1.5.0"
        - hardwareRevision : "0.4"
    

    As you can see, metaboot.info!.firmwareRevision == "1.5.0" and build.requiredBootloader == "0.4.0". They aren't equal, so the code enters the if block.

    Step 2
    if let bootloader = $0.result?.first(where: { $0.firmwareRev == required })
    (MetaWear+Firmware.swift, Line 121)

    bootloader:
        - hardwareRev : "0.4"
        - modelNumber : "5"
        - buildFlavor : "bootloader"
        - firmwareRev : "0.4.0"
        - filename : "sd_bl.zip"
        - requiredBootloader : "0.3.3"
        - firmwareURL : https://mbientlab.com/releases/metawear/0.4/5/bootloader/0.4.0/sd_bl.zip
    

    So we recurse, this time with the bootloader. The next step is similar to Step 1, except build.requiredBootloader == "0.3.3", which is still not equal to metaboot.info!.firmwareRevision == "1.5.0". And so on.

    Hm. I see metaboot.isMetaBoot is false while running this function. I suspect this is the cause.
    No idea why it doesn't go into metaBoot mode, though. Here's how we initiate the process on our end:

    A. BLE scan.
    B. Connect to the sensor seen on the BLE scan.
    C. Call MetaWear.updateFirmware
    D. Fail :smile:

    Connecting to the sensor subscribes to the battery level indicator in our app. Maybe an in-progress subscription prevents the jump to metaBoot mode?

  • edited February 2020

    I tried yesterday and it worked fine with our API example. I even updated the repo and the cocoapods.
    I also uploaded the MetaWearAPITest App which shows you the source code to update Firmware.

    Why don't you check that out: https://github.com/mbientlab/MetaWear-SDK-iOS-macOS-tvOS/tree/master/MetaWearApiTest

  • edited February 2020

    All right, I got it to work. The secret was to disconnect from the sensor and let the firmware update operation do the connecting. Probably had to do with subscriptions automatically created when the my own code connected.
    Thank you for the example code and your time check this out.

Sign In or Register to comment.