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.

CCS/CC2640R2F: Multi_Role stops advertising after connecting and disconnecting once.

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2640,

Tool/software: Code Composer Studio

I am using multi_role  example with simplelink_cc2640r2_sdk_1_40_00_45 simplelink_cc2640r2_sdk_1_40_00_45 sdk. The example is working fine. now initially when I turn on it start advertising and I can connect with the android phone using BLE Scanner and after disconnecting it stop advertising, So when power up the multi_role example advertise for once and connect with the device after disconnecting it never advertise again.

I found the similar issue on the following link

e2e.ti.com/.../2408142

but did not find the solution. I commented out the AssertHandler(HAL_ASSERT_CAUSE_HARDWARE_ERROR,0) also but its not working.

Thank You 

  • Pradeep,

    I can look into this, but in the meantime, have you looked into SDK v1.50 to see if it's reproducable? Are you using BLE5 or BLE4.2 stack?
    www.ti.com/.../SIMPLELINK-CC2640R2-SDK

    Also, do you have any sniffer logs of the connect/disconnect event and a bit after to see if it's advertising?

    If you do see it fail with SDK v1.50, can you try with an iPhone by chance as well?
  • Thanks for very quick response. I am using BLE4.2 stack right now. Ok I will check with BLE5 also and i'll let you know. I do not have any display so I can not show you but I can clearly see it in Ble Scanner whenever it advertises or connecting . But i'll check, if I am able to get any other information, i'll tell you.
    Thank You
  • So I have tested, For BLE5 multi_role example is working fine. I am getting the issue in Multi_role example for Ble 4.2
    Thank You
  • Pradeep,

    Can you test with SDK version 1.50.00.58 using BLE4.2? You can find the SDK at this URL:
    www.ti.com/.../SIMPLELINK-CC2640R2-SDK
  • I tried with SDK version 1.50.00.58 using BLE4.2 also but getting the same issue in this multi_role example.

    Thank You

  • I am having the exact problem while using multi_role sdk1.50.0.58 example as peripheral to multi masters (android smartphones).

    To specify I think it appears when all the connection slots are being used (at the same time, concurrently that "can't adv, no links" appears) and then some of them released.

    Fresh and clean multi_role example uses MAX_NUM_BLE_CONNS=1 in compiler predefined symbols, so when one device connects and then disconnects cc2640 doesn't advertise anymore. In my scenario I use MAX_NUM_BLE_CONNS=3, so when I connect one device and disconnect it advertises as it should be. When I connect two devices and disconnect one of them it still can discover cc2640. But when I connect three devices to cc2640 and then disconnect one or more it doesn't advertise! And of course it's impossible to connect to it afterwards without a reset.

    I used a workaround to force cc2640 to advertise which I DO NOT recommend because in my case it led to some issues with bonding and uncontrolled disconnecting. In multi.c in definition of 

    gapRole_processGapMsg (...) {
    ...
    switch(pMsg->opcode){
    ...
    case GAP_LINK_TERMINATED_EVENT:
    ...
      if (!gapRole_AdvEnabled)
          {
            gapAdvertisingParams_t params;
            Util_restartClock(&startAdvClock, gapRole_AdvertOffTime);
            params.eventType = gapRole_AdvEventType;
            params.initiatorAddrType = gapRole_AdvDirectType;
            VOID memcpy(params.initiatorAddr, gapRole_AdvDirectAddr, B_ADDR_LEN);
            params.channelMap = gapRole_AdvChanMap;
            params.filterPolicy = gapRole_AdvFilterPolicy;
            GAP_MakeDiscoverable(selfEntity, &params);
          }
    }
    break;
    ...
    }

    Please Ti, can you look into it and propose a solution?

  • Pradeep,

    Using the V1.50.00 SDK for CC2640R2F, I flashed multi_role without changing any parameters. Opened up a tera term session to interact with it and received the following:

    Here i am connected with my iPhone running LightBlue explorer app. From there, I disconnected from the launchpad and received the following:

    Here you are correct, I am not seeing any advertising, but if I interact with the menu here: I sellected "< Next Item" by clicking the left launchpad button (BTN-1) and then received the following menu:

    From here, I clicked the right launchpad button (BTN-2) to select "Advertise >" and my device started advertising again and I was able to connect.

    Please let me know if this doesn't resolve your issue. 

  • PawelN, I believe your workaround is not needed as the architecture of the program is written to require the user to interact with the program via buttons to get it to readvertise. If you look into this action, on a connection terminate event you can just ask the device to immediately start advertising again, but this would take some editing of the multi-role example.
  • Actually I am using a custom board in which there is no any button. So I can't use any button functionality. I was not able see any menu and button option also because in my board there is no any display interfaced,     and uart pins are connected with gps. So I couldn't verify that. Thanks for verifying. I think I have to change in code for readvertise if  advertising is not happening. Now my question is I have to use the scanning and advertising both. So let's say on power up board is advertising and after 1 min board need to scan the available peripheral devices. And this will happen continuously means device will advertise and then scan periodically. So can you suggest how should I do this.  In what part of multi role I need to change. Thank you.

  • Pradeep,

    In addition to the response above, you might find this code section helpful on restarting advertising on a link terminate event.
    software-dl.ti.com/.../gaprole.html

    Given that the issue of this thread is resolved, I recommend that you start a new thread. We try to keep each thread on the topic of the original question. If you have an unrelated question, please start a new thread.

    In the meantime, I would examine this lab in SimpleLink Academy on scanning and advertising:
    dev.ti.com/.../ble_scan_adv_basic.html
    As well as reading through the BLE Stack Users Guide:
    software-dl.ti.com/.../the-application.html

    I linked you to a section of the BLE Stack Users Guide that I think would be helpful in understanding at a higher level how to define application behaviour.

  • So i have generated a new thread.
    e2e.ti.com/.../684927
  • Thank you for hint,

    I have added following lines to multi.c and so far it looks like working (for 1 connection as well as 2 simultaneous):

    gapRole_processGAPMsg(gapEventHdr_t *pMsg){
    ...
    switch (pMsg->opcode)
    ...
    case GAP_LINK_TERMINATED_EVENT:
    ...
    if (!gapRole_AdvNonConnEnabled) //added
    {
    
    uint8_t adv = TRUE; //added
    GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &adv, NULL); //added
    
    } //added