“The handle is invalid“ error thrown right at the end of firmware upgrade

We have written a Flutter app, which uses the Flutter-nRF-Connect-Device-Manager package to perform firmware upgrades on bluetooth devices that the app bonds with.

If iOS users pair and bond with our bluetooth device and then perform a firmware upgrade without restarting the app, an error is thrown saying "The handle is invalid". The error does not occur if users restart the app between bonding with the device and upgrading its firmware, however this is not a feasible solution to our problem as it would massively disrupt the user experience of our app.

I have performed the firmware upgrade using the example app of the package mentioned above with the same FirmwareUpgradeMode and estimatedSwapTime that our app uses (testAndConfirm and 90 seconds respectively) and I experience the same error.

I saw this thread, which seems related. The solution was to disconnect and reconnect to the bluetooth device, which is possible, but seems hacky. Especially as errors could potentially be thrown during the disconnection or reconnection step. I'm hoping for a cleaner solution than that.

Is this a known issue? Do you have guidance on how to stop this error being thrown please?

Thanks in advance for any help you can provide.

 

Parents Reply Children
  • Hi Charlie, thanks for your reply. I will try that tomorrow and let you know how it goes. Thanks again

  • Hi Charlie, I downloaded the nRF Connect Device Manager app and tried using it to upgrade the firmware on our device. Unfortunately the maximum swap time that the app can be configured to wait before confirming is 40 seconds. We need around 70 seconds for the swap to complete, which means the nRF app always times out.

    Interestingly, when our bluetooth device does finally reboot and I try to pair with it from the nRF Connect Device Manager app again, I get a response which says "The handle is invalid" i.e. the same error message I initially raised this ticket about.

    Does that provide any insight into what might be causing this issue?

    Thanks again

  • Hi,

    I will continue to help with this ticket.

    WesCJ said:
    We need around 70 seconds for the swap to complete, which means the nRF app always times ou

    This is is you choose test&confirm.

    You can do "test only" and then manually "confirm" after the swap is done.
    As an alternative you can also confirm from the application, if you prefer to do local tests.

    WesCJ said:
    "The handle is invalid"

    What did you change in the application for this test DFU?

    Regards,
    Sigurd Hellesvik

  • Thanks for your replies.

    You can do "test only" and then manually "confirm" after the swap is done.
    As an alternative you can also confirm from the application, if you prefer to do local tests.

    Those are promising suggestions. However, I would ideally like to get to the bottom of why test&confirm isn't working as expected, rather than avoid using it.

    What did you change in the application for this test DFU?

    By "application", do you mean the nRF Connect Device Manager app? If so, I didn't change anything. I just ran the upgrade as instructed and that "handle is invalid" error came out when I tried reconnecting to the device.

  • WesCJ said:
    Those are promising suggestions. However, I would ideally like to get to the bottom of why test&confirm isn't working as expected, rather than avoid using it.

    Agreed. Still, can you try the test only, just to debug this issue?

    WesCJ said:
    By "application", do you mean the nRF Connect Device Manager app? If so, I didn't change anything. I just ran the upgrade as instructed and that "handle is invalid" error came out when I tried reconnecting to the device.

    I mean the application running on the nRF Chip. If the hash of the nRF chip firmware is the same, DFU will be aborted.

Related