I have the TI ADS1298ECG-FE hooked up to a CC2650DK and am having trouble streaming data over BLE to an Android 2013 Nexus 7 using 7.5ms connection intervals. MAX_NUM_PDU = 6 or 10, and MAX_PDU_SIZE = 23. The ADS1298ECG-FE is configured for 3 active channels @ 250Sps, which asserts DRDYb every 4ms. Every DRYb, the data is stored into a global buffer.
For testing, I buffered different numbers of samples (1S (9B) every 4ms; 2S (18B) every 8ms; 4S (36B) every 16ms) before calling HeartRate_enqueueMsg(). As the data streams, GATT_Notification() fails intermittently and I lose packets. I don't understand why since the data is ready every 4 or 8ms and fits into one PDU or 16ms and fits into two PDUs (I split it manually and call GATT_Notification() twice in this case). Also even if I just send one packet every 16ms, 24ms or even longer, I still see GATT_Notification() fail intermittently. My code is:
static void HeartRate_serviceCB(uint8_t event)
{
// Enqueue the message.
HeartRate_enqueueMsg(HEARTRATE_MEAS_EVT, event);
}
static void HeartRate_measNotify(void)
{
...
heartRateMeas.pValue = GATT_bm_alloc(gapConnHandle, ATT_HANDLE_VALUE_NOTI, HEARTRATE_MEAS_LEN, NULL);
if (heartRateMeas.pValue != NULL)
{
...
// Send notification.
if (HeartRate_MeasNotify(gapConnHandle, &heartRateMeas) != SUCCESS)
{
PINCC26XX_setOutputValue(Board_LED3, 1);
GATT_bm_free((gattMsg_t *)&heartRateMeas, ATT_HANDLE_VALUE_NOTI);
}
}
}
bStatus_t HeartRate_MeasNotify(uint16 connHandle, attHandleValueNoti_t *pNoti)
{
uint16 value = GATTServApp_ReadCharCfg(connHandle,
heartRateMeasClientCharCfg);
// If notifications enabled
if (value & GATT_CLIENT_CFG_NOTIFY)
{
// Set the handle.
pNoti->handle = heartRateAttrTbl[HEARTRATE_MEAS_VALUE_POS].handle;
// Send the notification.
return GATT_Notification(connHandle, pNoti, FALSE);
}
return bleIncorrectMode;
}
I don't understand why GATT_Notification() should fail if I'm calling it at a relatively slow rate and there are enough PDUs. Also, if I try to loop and resend data when GATT_Notification() fails, then I seem to hang the firmware. How can I fix these issues?
