Hi Cypress Community,
I am working with a Client/Central-Server/Peripheral set up using 2 pioneer kits where I have the server sending notifications to the Client.
Using the CySmart Tool and dongle and I can easily enable notifications on all the characteristics that I have set using the BLE circuit block.
When I try using the Client/Central pioneer kit to writeCharacterisitc values to ([01:00]) the various characteristics on the Server/Pheripheral pioneer kit, only the first one is enabled and the second returns an CYBLE_ERROR_INVALID_OPERATION. Even if I call the same function twice the first one is enabled and the second returns that error. It also doesn't even matter what handle I set.
I know it is not the Server/Peripheral side because the Dongle can enable notifications perfectly fine.
I believe you are writing 01:00 to CCCD's of the characteristic.
Can you try calling CyBle_ProcessEvents() after every characteristic write of individual CCCDs? Try enabling them from the main loop, not from the Event handler of the BLE component.
Can you replace the 'CyBle_GattcWriteCharacteristicDescriptors' API with following in your 'EnableFootPedalNotification' function?
apiResult = CyBle_GattcWriteCharacteristicDescriptors(cyBle_connHandle, &writeReqParam_FootPedal);
Similarly in 'EnableFootPedal2Notification'.
Also, I believe that 0x0025 and 0x0029 are the attribute handles of the CCCD of the Characteristics that you want the notification to be enable on.
In the BLEclient.c , the connection event stores the param as connHandle. Should I change it there too?
And yes you are correct, the 0x0025, 0x0029 are the attribute handles for the CCCD of those characteristics.
Do you have a BLE sniffer with your? I am trying to see what kind of BLE activity happens on the second notification.
I don't have the server side of your project so I cannot test the changes. Can you try the following:
As you already know the attribute handles, you don't need to do Service discovery after connection.
Remove the 'apiResult = CyBle_GattcStartDiscovery(connHandle);' from the 'CYBLE_EVT_GAP_DEVICE_CONNECTED' event and move 'deviceConnected = TRUE;' from 'CYBLE_EVT_GATTC_DISCOVERY_COMPLETE' to 'CYBLE_EVT_GAP_DEVICE_CONNECTED'.
The reason I am asking is because Creator 3.1 had some issue with Custom service discovery, just want to make sure that does not create a problem.