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 Reply Children
  • Hi Hung,

    Thanks.

    So, in "normal" operation, the device is advertising, but the App doesn't try and connect.  It just grabs the scan response data and updates its info that way.  The only time it will connect is to do a DFU.

    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.

    But after the DFU and with my custom App forcing the software reset, I would have thought the Peripheral would disconnect.  If I do a reset on the DK, it certainly forces the disconnect.  But having my App force the reset, it doesn't seem to.

    I grab the vallue of RESETREAS when it first boots up, and not surprisingly, when the App resets the device, I see RESETREAS = 0x04, which corresponds to the Software Reset (SREQ).  My code then sets up Bluetooth and starts advertising.  The Client then connects, even though I don't want it to.

    If I do a RESETPIN reset via the button on my DK at this point, then the device will go through the Bluetooth start up and start advertising, but will not reconnect to the Central.

    The brute force method at this point might well be that my App needs to write to my "disconnect" characteristic to force a disconnect.

    Cheers,

    Mike

  • Thanks Mike. 
    I think this is something we can fix in the iOS DFU library. I assume you have the same problem when you test with nRF DFU app or nRF Toolbox app , correct ? 
    I will report your observation to the app team and will let you know when we have any update. 

Related