Client automatically reconnects to server after OTA DFU

I'm trying to implement OTA DFU in our custom App with our nRF52832 acting as the device to be upgraded.  Everything seems to work OK in that:

1. New image uploads to the device

2. App resets the device to transfer new image into correct area

3. App does a check to ensure the new image is OK, then confirms this with the device

4. App forces another software reset on the device

At this point, the device should start advertising again.  But for some reason it stays connected to the client.  I'm trying to work out how to prevent this happening, primarily as my App is only scanning for devices and grabbing the scan response data to update its info.  It only needs to connect when its going to do an OTA DFU.  But because it remains connected after the OTA DFU, things get all locked up.

Not sure if this needs to be driven from the client or the server side.  Client is an iOS device running our custom App.  I am also using the CTS on the server, so client and server are paired at some point.  I believe this is a requirement by Apple for devices to access CTS on an iOS device.

Any ideas how I can ensure that the client doesn't automatically reconnect to the server after the final reset at the completion of the OTA DFU?

Cheers,

Mike

Parents
  • I do notice that if I connect to the device using any other iOS BLE app (nRF Connect, LightBlue, etc) then when I hit the "disconnect" button on those apps, the Central doesn't actually disconnect from Peripheral.  I actually had to create a characteristic that I have to write to in order to force the disconnection from those Apps.  This might be something to do with iOS - I'm not sure.

    This is expected behavior. A device on both Android and iOS can be connected by multiple apps or multiple clients in each app. The physical Le connection is terminated only when the last virtual connection is discontented. A virtual connection may also be held by the system, if is supports the service, e.g. HID, or, in case of iOS, perhaps CTS service. A command to trigger disconnection from the device side is indeed the only solution for this use case.

    However, I understand that it is the automatic reconnection, not lack of disconnection, that's the root cause. Try disabling direct advertising, or the CTS service, if you don't need it.

    If connection is only for dfu, why do you have pairing/bonding in the first place?

  • The reset command from Mcumgr should do the same. It should reboot the device after gracefully disconnecting. Perhaps check why it doesn't work as intended?

    We can see that reset command being issued my the Mcumgr with both the devices, and this then restarts our device and it then beings advertising.  But for some reason on the 12/12Pro, the phone would then reconnect and the only way for us to get our device to disconnect was to force it to stop advertising (we enable/disable this via a GPIO)

    Much as I'd like to understand why, the commerical realities of getting product to market dictate that "if you've got something that works, move on to the next issue"

    Cheers,

    Mike

Reply
  • The reset command from Mcumgr should do the same. It should reboot the device after gracefully disconnecting. Perhaps check why it doesn't work as intended?

    We can see that reset command being issued my the Mcumgr with both the devices, and this then restarts our device and it then beings advertising.  But for some reason on the 12/12Pro, the phone would then reconnect and the only way for us to get our device to disconnect was to force it to stop advertising (we enable/disable this via a GPIO)

    Much as I'd like to understand why, the commerical realities of getting product to market dictate that "if you've got something that works, move on to the next issue"

    Cheers,

    Mike

Children
No Data
Related