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.

CC2642R-Q1: Setting of Advertising parameters for direct advertisement

Part Number: CC2642R-Q1

I am trying to do direct advertisement in runtime in the following way

//Disable the advertisement
GAP_DisableAdvertisement();

uint16 eventprops_u16 = GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_LEGACY | GAP_ADV_PROP_DIRECTED;
uint8 directedMacAddr_a[B_ADDR_LEN] = {0x2e, 0x20, 0xcd, 0x46, 0x74, 0x74};  //mobile mac in reverse format
//Create Advertisement set
GapAdv_create(&GAP_BleClusterAdvCallback, &advParams1, &advHandleDirected_u8);

//Set advertising parameters for directed advertising
GapAdv_setParam(advHandleDirected_u8, GAP_ADV_PARAM_PROPS, &eventprops_u16);

GapAdv_setParam(advHandleDirected_u8, GAP_ADV_PARAM_PEER_ADDRESS, directedMacAddr_a);


// Load advertising data for set #1 that is statically allocated by the app
GapAdv_loadByHandle(advHandleDirected_u8, GAP_ADV_DATA_TYPE_ADV, sizeof(advData1), advData1);

GapAdv_setEventMask(advHandleDirected_u8, GAP_ADV_EVT_MASK_START_AFTER_ENABLE 

                                                                                | GAP_ADV_EVT_MASK_END_AFTER_DISABLE

                                                                                | GAP_ADV_EVT_MASK_SET_TERMINATED);

//Enable advertising with new Handle
GapAdv_enable(advHandleDirected_u8, GAP_ADV_ENABLE_OPTIONS_USE_MAX, 0);

when I set uint16 eventprops_u16 = GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_LEGACY | GAP_ADV_PROP_DIRECTED; in this I can't see my peripheral in mobile

but when I set it uint16 eventprops_u16 = GAP_ADV_PROP_DIRECTED; in this way I can see my device but it is not showing connect option in mobile

To be more clear while uint16 eventprops_u16 = GAP_ADV_PROP_DIRECTED; then advertising type is extension mode instead legacy mode

How could I make my central device both directed and connectable? I am using simplelink_cc13xx_cc26xx_sdk_6_20_00_29 sdk

Thanks in Advance.

  • Hi,

    From our offline conversation, here is your ask

    "

    Cluster with TI chip (Peripheral) is paired and connected to smartphone(Central) and need to disconnect from the previously connected smartphone and connect to the new device.

    This includes

    1. Previously connected smartphone does not connect to the cluster back(Because connected iPhone will try to connect back when advertising)
    2. Should connect to the smartphone only to the specified device with provided mac address.

    "

    External tool provides phones mac address, but I assumed that the provided addr will be mostly RPA right? If you want to use a direct advertisement to device uses RPA, then you need to do direct adv with RPA intead of public addr.

  • I used RPA also but still I can't find ti peripheral name in mobile scanned list

  • 8688.simple_peripheral_CC26X2R1_LAUNCHXL_tirtos7_ticlang.zip

    In simple peripheral example I made the following changes to do direct advertisement But I can't see the target as SP in mobile scanner

  • Hi Pavan,

    It'll take me a day to digest the information already given in this thread. I'll give a response tomorrow.

    To clarify the above, the issue is that the TI device (peripheral) directed advertisements using an RPA is not seen in the mobile scanner (iPhone).

    What mobile scanner are you using?

    Best,

    Nima Behmanesh

  • Hi Nima,

    We are using nRF scanner app and I am scanning in Android phone

  • Hi Pavan,

    Has the peripheral device and the Android phone paired and bonded/exchanged IRK before sending out directed advertisements?

    Best,

    Nima Behmanesh

  • Hi Nima,

    No they are not paired.

    Our actual requirement is block all the connections except a new device(not paired before) connect to only that device based on MAC address.

    Requirement:

     

    Cluster with TI chip (Peripheral) is paired and connected to smartphone(Central) and need to disconnect from the previously connected smartphone and connect to the new device.

     

    This includes

    1. Previously connected smartphone does not connect to the cluster back(Because connected iPhone will try to connect back when advertising)
    2. Should connect to the smartphone only to the specified device with provided mac address.

     

    Steps we followed(Method – 1):

    1. Stop the existing connection and disable the advertisement so that previously connected device shall not reconnect
    2. Create new advertisement set with adv parameters as follows
      1. Event properties to GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_LEGACY | GAP_ADV_PROP_DIRECTED .
      2. peerType  as Public ID
      3. Setting macAddress of new Device in reverse order (if A:B:C is mac we are set it as C:B:A).
    3. Loading Advertising set with Advertising data with device name and flag as GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED | GAP_ADTYPE_FLAGS_GENERAL
    4. Setting Event Mask with GAP_ADV_EVT_MASK_START_AFTER_ENABLE | GAP_ADV_EVT_MASK_END_AFTER_DISABLE | GAP_ADV_EVT_MASK_SET_TERMINATED.
    5. Enabling Advertisement with enable option of GAP_ADV_ENABLE_OPTIONS_USE_MAX.

     

    Issue we are facing:

    New device(using smart phone as new device) can’t detect the TI peripheral advertising

     

    ­Steps Followed(Method - 2):

    1. Stop the existing connection and disable the advertisement.
    2. By using HCI_LE_AddWhiteListCmd API we add the mac address of new device with peerType being Public Id again
    3. Set filter Policy to GAP_ADV_WL_POLICY_WL_CONNECT_IND for existing advertising param set.
    4. Started advertising

     

    Issue we faced:

    New device can see the advertisement when attempting to connect, connection is not happening.

    Only if bond information exists in TI peripheral already then it is working, but not for a unbonded device.

  • Hi Pavan,

    Thank you for clarifying that. If you are using an RPA for directed advertisements, then the IRK will need to be shared to the device. I believe that's why it works when the bonding information is present the advertising works.

    I'm going to try to reproduce on my end to see if I can get directed advertisements to work using the public address. I'll update you no later than Monday on that progress.

    Best,

    Nima Behmanesh

  • Hi Nima,

    We tested by setting peertype as both public and private but it hasn't worked.

    We need to block all connections (without removing bond information) expect a new device whose mac address is specified but never paired before.

    Could you please look into this, it is a critical issue for us

  • Hi Pavan,

    So this device has never been connected before, it's address has been added to the whitelist, and IRKs are shared?

    Additionally you are seeing the advertisements now but connection is failing? Can you share an ellisys (or OTA log) log of what you're seeing?

    That should help me diagnose the issue further?

  • Hi Pavan,

    It seems like direct adv won't work with apple devices as stated here: https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf section 49.3 advertising PDU. 

    Regards,

    Marvin

  • No Irks are not shared because we never paired before so no chance of sharing irks and white list method hasn't worked

    No the new device can't see advertisement at all if we set evet props as uint16 eventprops = GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_LEGACY | GAP_ADV_PROP_DIRECTED;

    We can see only adv if we set as uint16 eventprops = GAP_ADV_PROP_DIRECTED; but it is showing like not connectable

    We traced ota sniffer by following below steps

    DirectAdv.zip

        uint8 mac[6] = {0xCE, 0x5A, 0xBD, 0xB9, 0xCE, 0x80}; this is the mac address  in reverse format I added for a specified target

    Steps Followed 

    1) Connected normal phone via normal advertisement

    2) Triggered direct advertisement with the mac address by disonnecting current connected device

    3) This new mac address is not paired previously

    4) searched for peripheral name in nrf Connect app of new device whose mac address is specified

    Result 

    1) not observed peripheral name in nrf Connect app

    NOTE : We are not testing with iPhone we are only tesing with android

  • Hi Marvin,

    We are only testing android not with iPhone

  • Can you please look fast into this issue it has become like a blocker for us

  • I am able to see that the TI device is advertising to the correct MAC address through the sniffer, so the TI device is working fine for me.

    As I understand you want to connect to the phone using direct adv, without having paired with the phone before. Do I understand it correctly? This won't be possible from the phone side as is now. You would need to add software to handle this. The phone won't let you connect with just the mac address. 

    Can you give more details as to why you want to use direct adv to connect to the new phone?  

    Regards,

    Marvin

  • We want to connect a new bluetooth device to our peripheral and when we are connecting that new device we want block other connections without unpairing them, how can we acheive this

  • Hi,

    You can enable filter accept list to accept only certain device at any given time.

    This is accomplished by updating the adverting parameters filterPolicy, by default (GAP_ADV_WL_POLICY_ANY_REQ) the policy takes all the request. But you can change it to "GAP_ADV_WL_POLICY_WL_CONNECT_IND" which is used for  

    /**
       * Process scan requests from all devices and only connection requests
       * from devices that are in the White List.
       */

    To add device into filter Acceptlist (whitelist), you can use https://dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_7_40_00_77/docs/ble5stack/ble_user_guide/doxygen/ble/html/group___h_c_i.html#ga5034b56f0d3c79d6382f7fea041e58af
    to remove the device from FA list, you can use https://dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_7_40_00_77/docs/ble5stack/ble_user_guide/doxygen/ble/html/group___h_c_i.html#gad05927cc6b7ba91244c98fc6e5c97165