Other Parts Discussed in Thread: CC2650
Hi,
I'm working on a board where there appears to be coupling between BLE transmissions and some measurement circuitry. Due to this, I'm trying to synchronize my measurements to be immediately after the end of a connection event. I'm using the CC2640 IC, with the BLE Stack 2.2.1. (I've probed the antenna TX port with 1 GHz oscilloscope probe, and am noticing spikes with a period of the connection interval, which are also aligned with the noise I'm seeing in the analog measurement circuitry).
I've tried to use the HCI_EXT_ConnEventNoticeCmd() command to trigger my measurement, but I am not seeing that any synchronization is taking place. Am I misinterpreting the operation of this function? Or is there some large seemingly random latency (of many milliseconds) between the actual transmission and the connection event end notice? Or is there likely a bug in my code?
My code is based on the simple_peripheral example. The main changes I've made are to always enable connection events (I removed the other references to enabling/disabling connection events) and to call custom measurement code when the connection end event happens.
case GAPROLE_CONNECTED: { linkDBInfo_t linkInfo; uint8_t numActive = 0; Util_startClock(&periodicClock); numActive = linkDB_NumActive(); // Use numActive to determine the connection handle of the last // connection if ( linkDB_GetInfo( numActive - 1, &linkInfo ) == SUCCESS ) { uint16_t connHandle = 0; Display_print1(dispHandle, 2, 0, "Num Conns: %d", (uint16_t)numActive); Display_print0(dispHandle, 3, 0, Util_convertBdAddr2Str(linkInfo.addr)); // Enable connection events, shouldn't use much power, should it? if(GAPRole_GetParameter(GAPROLE_CONNHANDLE, &connHandle) == SUCCESS) HCI_EXT_ConnEventNoticeCmd(connHandle, selfEntity, SBP_CONN_EVT_END_EVT); }
And upon the event, I added a call to my custom function which toggles some I/O pins and starts a sensor controller task:
// Check for BLE stack events first if (pEvt->signature == 0xffff) { if (pEvt->event_flag & SBP_CONN_EVT_END_EVT) { // And initiate the SC if needed SimpleBLEPeripheral_InitSCConnEvent(); // Try to retransmit pending ATT Response (if any) SimpleBLEPeripheral_sendAttRsp(); } }
Thanks,
Nathan