This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BT stack connection latency and CPU blocking

Other Parts Discussed in Thread: CC2540

Hi All,

 I am building my project on the SimpleBLEPeripheral for CC2540. All is going OK.

Part of my project is some data acquisition which will block the CPU for 500ms.

Clearly I can set my Bluetooth connection intervals to allow for this (DEFAULT_DESIRED_MIN_CONN_INTERVAL etc. etc.).

However, I would like to synchronise my data acquisition with the BT stack sleeping for this interval.

Is there any way to determine when the BT stack is going to sleep for the connection interval, so I can jump in and not upset the BT timing?

Many thanks,

Chris.

  • Hi Chris,

    You can refer to the HCI_EXT_ConnEventNoticeCmd. When enabled, you will receive a connection event notice event upon completion of the connection event. However, I would caution that you should ensure you are actually using a conn interval that does not interfere with the RF processing.

    Best wishes
  • Hi JXS,
    Can you clarify the expected behaviour when I use this command please (I can't find any documentation apart from the info in the .h file function prototype).
    I call HCI_EXT_ConnEventNoticeCmd( xxx_TaskID, xx_CONN_EVENT_FINISHED );

    And then in function xxx_ProcessEvent() I can switch on the event,
    if ( events & xxx_CONN_EVENT_FINISHED )
    {
    printf("*");
    return (events ^ xxx_CONN_EVENT_FINISHED);
    }

    Now I have my device connected, but I don't see any '*' appearing in the terminal I/O windows.

    Is my expectation correct? If so, am I missing something to make this work?

    Many thanks,

    Chris.
  • Aha, just found the documentation in TI_BLE_Vendor_Specific_HCI_Guide.pdf...

    It seems I am getting an error HCI_ERROR_CODE_INVALID_HCI_CMD_PARAMS

    Tomorrow I will look at what that means........

    Chris.
  • Sorted.


    You have to make the call after a connection has completed rather than at the start.

        case GAPROLE_CONNECTED:
          {        
            hciStatus_t hci_res;
            hci_res = HCI_EXT_ConnEventNoticeCmd( reader_TaskID, READER_CONN_EVENT_FINISHED ); // Reader_ProcessEvent gets called with READER_CONN_EVENT_FINISHED each time a connection event finishes
            if (hci_res!=HCI_SUCCESS) printf("HCI_EXT_ConnEventNoticeCmd() failed!!!\r\n"); // note that printf will break the stack if used here......
          }


    And it does indeed generate the event at DEFAULT_DESIRED_MIN_CONN_INTERVAL intervals.

    Chris.

  • If the connection parameter update request is set to TRUE, then there is a possibility that the peripheral device connection interval values updated with the values set by connected central device. So please take this into consideration.