I'm using an MKW31Z. Might be related to MKW30Z BLE connection flood protection but different processor so unsure.
I'm experiencing an issue where on occasion the call to Gap_Disconnect fails to produce a gConnEvtDisconnected_c callback event. If I call Gap_Disconnect again, I get an internal error of gHciUnknownConnectionIdentifier_c, which indicates that the disconnect occurred but no gConnEvtDisconnected_c callback.
If I ignore the fact that I didn't get the callback and go ahead and call Gap_SetAdvertisingParameters, I then receive no advertising callbacks.
The usual flow is:
And this will repeat until I don't get the gConnEvtDisconnected_c event. At that point, I can only achieve the gAdvertisingDataSetupComplete_c event, but not the other advertising events.
I have not found any pattern of number of connects/disconnects or advertising calls that trigger this. My code is based off the heart rate sensor example, but I don't currently have a working test sample.