From BLE4.2 component datasheet this is what I get:
CYBLE_API_RESULT_TCyBle_GapDisconnect (uint8 bdHandle)
This function disconnects the peer device. It is to be used by the device in GAP Central mode and may be used
by a GAP Peripheral device to send a disconnect request. This is a non-blocking function. On disconnection, the
following events are generated, in order.
if your device is the peripheral, then maybe the problem could be the central which do not process the disconnect request sent from your device(the peripheral)?
If so, some suggestion would be to change the central device which you are testing with. For example, in my case I usually download the cysmart app in my android phone to act as the central. I think these apps would properly process any disconnect request.
Just guessing here.
I try catch these events and these events arent start. I read the return value of CyBle_GapDisconnect() and it is CYBLE_ERROR_INVALID_PARAMETER....
again, the BLE component datasheet says that return value means
No device to be disconnected. The specified
device handle does not map to any device
entry in the BLE Stack.
I guess your input(peer device handle) is somehow corrupt or wrong. You'll have to dig in deeper..
Please use the below code for sending disconnect request:
if(CyBle_GetState() == CYBLE_STATE_CONNECTED)
If you are still the issue is persisting, please share the project.