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.

Bluetopia 4.0.2.2 GAP_LE_Create_Connection return -517

Other Parts Discussed in Thread: CC2564C

Hi,

I'm trying to make a connection with OOB information. I try to connect the 2 devices together (using public address, since I exchange them into the OOB information at first and to simplify things at first). Here my flow so far:

  1. Init devices
  2. Generate OOB data (hash, rand, BD_ADDR public) and exchange them on USB
  3. Upon receiving the OOB data and device address on each side, I add the address to the white list
  4. I start the advertissing the peripheral with ConnectableMode, public address with Direct_Address 0x000000000000
  5. I start the scan on the central with latPublic, fpWhiteList
  6. I receive the advertisse on the central, if the public address match the OOB address I try to connect with the GAP_LE_Create_Connection which return -517 (according to the BTErrors.h this is an HCI errors)

Here's the call parameters

GAP_LE_Create_Connection(BluetoothStackID, 100, 100, fpWhiteList, latPublic, &BD_ADDR, latPublic, &ConnectionParameters, getGAP_LE_Event_Callback(), 0); 

with connectionParamters:
ConnectionParameters.Connection_Interval_Min    = 50;
ConnectionParameters.Connection_Interval_Max    = 200;
ConnectionParameters.Minimum_Connection_Length  = 0;
ConnectionParameters.Maximum_Connection_Length  = 10000;
ConnectionParameters.Slave_Latency              = 0;
ConnectionParameters.Supervision_Timeout        = MINIMUM_LINK_SUPERVISION_TIMEOUT;

Not sure what is wrong or what should be done to fix this?

  • After some investigation if error is below BTPS_ERROR_CODE_HCI_STATUS_BASE which is -500 but and with CONVERT_ERROR_CODE_TO_HCI_STATUS_CODE() it give HCI error 17.

    If this is inline with the HCITypes.h file, it mean
    #define HCI_ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE 0x11

    I'm not sure which part of the connection parameters or features is not supported here!?
  • I also tried to remove the whole white list and go full public address and global advertissing (indirect). I receive the wanted device and try to create the connection and still got the same problem (try to simplify things to the max).

    I'm inside etLE_Advertising_Report event handler
    I do the following prior to ask the GAP_LE_Create_Connection:

    1- GAP_LE_Cancel_Scan
    2- GAP_LE_Disconnect if one device was already connected
    3- GAP_LE_Create_Connection

    Wonder if I have to stop de the scan or not, I'm a bit clueless why the HCI return 0x11 (17) error code?!? if anybody have an idea?!?
  • After some test, I made the advertising on both device upon init. This seem to remove the error I previously had and now the gap connect le return -512 --> HCI error 12 (0x0C) --> HCI_ERROR_CODE_COMMAND_DISALLOWED

    Maybe I don't get a part of the initialization here. Any place where I can have a description (not a code example) but something that explain what is required to be done t establish a connection with the Bluetopia LE v4.0.2.2 stack? I'm a bit confuse about what is required on the peripheral and the central unit to establish this connection. I don't have an eval board only a custom board, so the example won't run directly. Everything boot, scan and advertise properly but I can't connect.

    I have the following parameters set

    1. Advertise using public addr (simplify debugging for now, I already have set the random address into the init phase, I just don't use it yet)
    2. Connection mode is set to cmConnectableMode
    3. Discovery mode is set to dmGeneralDiscoverableMode
    4. Pairing IO capability licNoInputNoOutput
    5. MITM is 0
    6. OOB is 1

    I'm not sure about what is missing, I compare to an example and everything look equivalent in init phase, I can scan and see the peripheral, but get this HCI errors which I don't really have any clue about what they really mean or what is missing).

    1. Why does both device need to advertise during the init phase? Is this only to set the advertising data?
    2. What does the HCI error 12 (0x0C) mean? what can cause it?

    I'm trying to perform a selective connection by white listing the peripheral with the address received on OOB link.

    I can white list, I receive only my peripheral device advertising but I cannot connect to it the GAP_LE_CreateConnection return the error. I probably have a setting that is wrong, if anybody have some pro tips about what is required to make this work that would be welcom

    Thanks

    Jerome

  • Jerome,

    Both devices (central and peripheral) should not be advertising. The peripheral advertises and the central performs a scan and initiates the connection. For OOB pairing, there is no need to do a scan from central since the BD_ADDR of the advertising device would already be known by the central.

    When you have a device advertising, it is automatically considered a peripheral. So initiating the connection from that device (done by central) using the GAP_LE_Create_Connection will require the BLE controller to be central and peripheral at the same time. This is known as the Link Layer topology feature of the BT 4.1. The CC2564B does not support this feature, but the CC2564C does.

    The two errors you are seeing are both related to this issue. So please do not advertise from the device that you want to make the central of the connection.

    Best regards,

    Vihang

  • Thanks you Vihang, will remove the advertise from the central. As for the OOB, the wireless link MUST not be start until the device get unconnected, the OOB data are transfer way before the initial. So I might end up in need for a scan. Out of curiosity, if I don't advertise, do I need to set GAP_LE_Set_Advertising_Data() and GAP_LE_Set_Scan_Response_Data()?

    How does one stack choose it's either a central or peripheral? any explicit call or is it the first call that put the stack into a particular mode? any way to probe what is the current mode to ensure everything is ok before I do my calls (at least during the devel steps)?
  • Hi Jerome,

    Jerome Godbout86 said:
    Out of curiosity, if I don't advertise, do I need to set GAP_LE_Set_Advertising_Data() and GAP_LE_Set_Scan_Response_Data()?

    If the device is not advertising, there is no need to set the GAP_LE_Set_Advertising_Data() and GAP_LE_Set_Scan_Response_Data().

    Jerome Godbout86 said:
    How does one stack choose it's either a central or peripheral? any explicit call or is it the first call that put the stack into a particular mode?

    The stack or controller do not decide the role. It is part of the dual-mode BT specification. Additionally, as far as BLE is concerned, the initiating device will always be the central and the advertising device will be the peripheral.

    Jerome Godbout86 said:
    any way to probe what is the current mode to ensure everything is ok before I do my calls (at least during the devel steps)?

    Sure. You will see the etLE_Connection_Complete event in the GAP_LE_Event_Callback function when the LE connection has been established. The GAP_LE_Event_Data->Event_Data.GAP_LE_Connection_Complete_Event_Data->Master in this callback will indicate if the local device is master (central) or not (peripheral).

    Best regards,

    Vihang

  • Thanks, that's help a lot as a newcomer to Bluetooth, I find the specs and API a bit hard to understand at first, I start to understand the whole thing (big picture). Hope those thread will help other beginner like me to get kick start with the Bluetopia stack.