Problems with BLE notifications | Cypress Semiconductor
Problems with BLE notifications
Hi all, I've been trying to get BLE notifications working correctly on the PROC, but I keep running into issues (perhaps they are related?)
1) I'm using an iOS app called LightBlue as my BLE client interface (I've used this for a year or two on dozens of BLE projects from other vendors, with no problems - so I think the app is solid). When I 'listen for notifications', and then perform an action which should send a notification from the PROC to the phone, I ALWAYS get 2 identical notifications. However, nowhere in my code am I sending the same notification twice (I've printf'd the hell outta my code and manually debugged).
Is there something in ProcessEvents, or elsewhere that I should be looking for potential causes?
2) I'm trying to send multiple notifications in a row, however, I get a crash which pushes the PROC into the exception handler infinite loop (I should be able to send 4-6 per connection interval, but at this point, I don't care about performance, I just don't want a crash). It crashes after the very first notification.
Here is the code which causes it (ble_Run gets called every iteration of the main.c loop, fakesync_data is just a uint8 pointer to a few hundred data points - static data, so it's not disappearing off the stack):
if(CyBle_GattGetBusStatus() == CYBLE_STACK_STATE_FREE && remainingPackets > 0)
ble_SendNotification(CYBLE_DATA_SYNC_DATA_CHAR_HANDLE, fakesync_data(), 20);
if (remainingPackets <= 0) // Reset the test
mIsSynching = 0;
remainingPackets = 20;
void ble_SendNotification(CYBLE_GATT_DB_ATTR_HANDLE_T characteristic,
uint8* data, uint16 length)
notification.value.val = data;
notification.value.len = length;
notification.attrHandle = characteristic;
if (CyBle_GattsNotification(cyBle_connHandle, ¬ification) != CYBLE_ERROR_OK)
PRINT("ERROR sending notification\r\n");