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.

RTOS/CC2640R2F: Using HCI_LE_CreateConnCmd instead of GAPCentralRole_EstablishLink

Part Number: CC2640R2F

Tool/software: TI-RTOS

Hi.

Using GAPCentralRole_EstablishLink seems not to be able to resolve a random address and do a connection request inside the same advertisement slot. To resolve and connect it uses at least two consecutive advertisements. This leads to a latency problem in our application.

So I have tried to replace it with the direct HCI-command HCI_LE_CreateConnCmd. Is there a chance to speed up the application with it?

I have tried to use the HCI command, but it does not work. The return status is always SUCCESS independent on my parameters (also parameters out of range are not changing the status). On my tracer Ellisys I don't see a connection request and there isn't sent a "command complete" event or anything else.

What is wrong?

Thanks in advance

Michael

  • Hi Michael,
    What SDK version are you using?
  • Hi Joakim

    simplelink_cc2640r2_sdk_1_35_00_33_original

    Regards, Michael
  • Hello. No, you should not use HCI_LE_CreateConnCmd() as this is essentially cutting out the host and will lead to undefined behavior. In general, you should always use the highest level of abstraction provided.
  • Interesting to hear for me. But I wonder why even the answer of the HCI_LE_CreateConnCmd command does not give the correct feedback when wrong parameters are used.

    For me it looks like the command is disabled somehow and does not reach the Bluetooth controller.

    And I'm currently using commands like

    HCI_EXT_SetMaxDataLenCmd, HCI_LE_ClearWhiteListCmd, HCI_LE_AddWhiteListCmd, HCI_EXT_DisconnectImmedCmd and so on without problems.

    Can you confirm, it is NOT possible to resolve a random resolvable address and make an immediate connect using only one received advertisement when GAPCentralRole_EstablishLink is used?

    Regards Michael

  • We have not done this type of profiling. If you can provide steps to set up this test, I can make a feature request for R&D to investigate.

    Regarding the "Success" status, this just means that the command has been accepted. It is essentially useless information. The meaningful status of the result of the command will come in a command complete event. This is as defined per the spec. See also here: dev.ti.com/.../hci.html
  • Ok, I have extended the function "static void SimpleBLECentral_processCmdCompleteEvt(hciEvt_CmdComplete_t *pMsg)". It works for other HCI-Commands like ClearWhiteList or AddWhiteList, but a complete message for HCI_LE_CreateConnCmd is not received:

    static void SimpleBLECentral_processStackMsg(ICall_Hdr *pMsg)
    {
      switch (pMsg->event)
      {
      case GAP_MSG_EVENT:
        SimpleBLECentral_processRoleEvent((gapCentralRoleEvent_t *)pMsg);
        break;
       
      case GATT_MSG_EVENT:
        SimpleBLECentral_processGATTMsg((gattMsgEvent_t *)pMsg);
        break;

     case HCI_GAP_EVENT_EVENT:
        {
          // Process HCI message
          switch(pMsg->status)
          {
          case HCI_COMMAND_COMPLETE_EVENT_CODE:
            SimpleBLECentral_processCmdCompleteEvt((hciEvt_CmdComplete_t *)pMsg);  //<<-- no complete msg is received from HCI_LE_CreateConnCmd
            break;
           
          case HCI_BLE_HARDWARE_ERROR_EVENT_CODE:
            AssertHandler(HAL_ASSERT_CAUSE_HARDWARE_ERROR,0);
            break;
         
          default:       
            break;
          }
        }

    Or is it no HCI_GAP_EVENT_EVENT?

  • The command complete is swallowed by lower levels of the stack so you will not receive it. It should get used by the host and then returned to you as a GAP_LINK_ESTABLISHED_EVENT. That is of course assuming that what you are doing will work: it is essentially undefined behavior as the host is receiving a connection established event for a connection that it did not establish (as you circumvented the host by using a controller API).
  • OK, I don't receive GAP_LINK_ESTABLISHED_EVENT when I use HCI_LE_CreateConnCmd instead of the other one.

    I have carefully checked the parameters of HCI_LE_CreateConnCmd and played with it, no change.

    And I don't see a connection request in the air with my Ellisys sniffer.

    So it seems to be impossible to directly use this command.