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.

CC2640R2F: How to Advertise non connectable

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2541

Hi,

 I want advertise data including scan response data in non connectable mode while connected other device, I refereed Muti Role Application and made some changes but i'm not able to achieve it. Can anyone suggest  me how to achieve this functionality.

Regards,

Vijay Rakesh

  • Hello Vijay,
    You can define PLUS_BROADCASTER in the simple_peripheral example project to enable combined GAP roles of Peripheral and Broadcaster. Please refer to this old thread that discuss the matter on our previous platform, perhaps it can be ported to your use case:
    e2e.ti.com/.../1637964
  • Hi Eirik,

    Thanks for the reply, Will this PLUS_BROADCASTER work in project zero application also? My aim is to make my device advertising even after a connection.

    Regards,
    Vijay Rakesh
  • Hello Vijay,
    I am not sure, you will need to search in source for the PLUS_BROADCASTER define sections to observe how it is implemented.
  • Hi Eirik V,

     After BLE Connection made with another device i am calling  GAP_MakeDiscoverable(); function (Whether correct or not) which is making an advertisement as per my requirement. But when i try to reconnect again it is not connecting and the code in which i made changes in project zero is attached below.

    case GAPROLE_CONNECTED:
          {
            uint8_t peerAddress[B_ADDR_LEN];
            gapAdvertisingParams_t params;
    
            GAPRole_GetParameter(GAPROLE_CONN_BD_ADDR, peerAddress);
            char *cstr_peerAddress = Util_convertBdAddr2Str(peerAddress);
            Log_info1("Connected. Peer address: \x1b[32m%s\x1b[0m", (IArg)cstr_peerAddress);
    
            params.eventType = GAP_ADTYPE_ADV_SCAN_IND;
            params.initiatorAddrType = GAPROLE_ADV_EVENT_TYPE;
            params.channelMap = GAP_ADVCHAN_ALL;
            params.filterPolicy = GAP_FILTER_POLICY_ALL;
    
            GAP_MakeDiscoverable(selfEntity, &params);
           }
          break;

    Regards,

    Vijay Rakesh.

  • Hello Vijay,

    As I mentioned refer to the code contained in the PLUS_BROADCASTER defines in simple_peripheral. Then you can try to alter the type of advertisement in peripheral.c from GAP_ADTYPE_ADV_NONCONN_IND to GAP_ADTYPE_ADV_SCAN_IND in      

    gapRole_taskFxn

    ....

    if (events & START_ADVERTISING_EVT)

    ....

               // Only advertise non-connectable undirected.

               params.eventType = GAP_ADTYPE_ADV_NONCONN_IND;

    Does that work?

  • Hi Eirik V,

    If i do so, My device is advertising as Non Connectable but my requirement is after a Successful BLE connection with other device it should advertise as non connectable with maintaining a connection. But above code is working completely as non connectable.

    Thanks and Regards,

    Vijay Rakesh 

  • Vijay,
    Altough this thread relates to the CC2541 stack I believe should apply for your case as well:
    e2e.ti.com/.../445310