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.

SIMPLELINK-CC26X2-SDK: Switching time

Part Number: SIMPLELINK-CC26X2-SDK


In multi_role example code for cc26x2, changed from peripheral+central to peripheral+observer, can both scan and advertise be enabled at the same time. If so does this mean TI cc26x2 supports background scanning and 0 tx to rx switching time?What is time between two scans if its kept in continuous scan. When keeping continuous scan enabled, and running connectable advertisements, even though adv interval was set as 100ms it takes 465ms-500ms between advertisements, while when scanning is disabled, the advertising interval seems proper in this case about 100ms. In order to advertise, does scan have to be disabled? 

  • Hi etoem,

    Are you using BLE5? Scan and advertise can be enabled at the same time but typically when multiple BLE procedures are running simultaneously on the same device, there can be timing delays. In a non-multirole application, the time between the two scans is whatever scanning interval that is set in the application; however, since you are trying to scan and advertise at the same time it will take longer since the CC26x2 is trying to interleave advertising/connection events. This is why it was taking longer than your advertising interval to send advertisements.
  • cc26x2 sdk uses a ble5 stack, if you mean whether its using ble 5 features like extended advertising, then no, this is to send 31byte packets. When using following code:

    GAP_EVT_ADV_END:
          adv_flag = 1;
          GapAdv_disable(adv2);
          GapScan_enable(0,0,0);//continuous scan
    break;

    Posting an event in timer cb which executes following:

    if(adv_flag){
    adv_ref = 0;
    // edit advertisement data if necessary
    GapScan_disable();
    GapAdv_enable(adv2, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
    }


    So switching between advertising and scanning it seems to be working. But if two different advertisement sets are being sent, how do i distinguish between them in GAP_EVT_ADV_END, as in whether advertisement from handle 1 or handle 2 ended.

  • Just to clarify, you are advertising both sets simultaneously, not alternating? Also are you checking GAP_EVT_ADV_END in a function like SimplePeripheral_advCallback?
  • example code used: ble5_multi_role_cc26x2r1lp_app

    GAP_EVT_ADV_END is checked in multi_role_processAdvEvent() //function already exists in example code to process adv evts

    advertisement sets are initialized in the adv_init function, the two advertisement sets are set at different advertisement intervals, one sending connectable advertisements continuously at 200ms adv interval, while the other advertisement handle is used to relay filtered scanned packets, i.e, not running continuously. But because scanning and advertising simultaneously causes delays, switching between scan and advertise seems necessary, I guess the application can alternate between the two but is there any function to identify if an advertising set is currently advertising, i.e, when an advertisement is enabled if adv interval is set at 200ms does it take that long to trigger GAP_EVT_ADV_END, or will it take the same time as it would if the advertising interval was 20ms.

    If I were to use GapAdv_enable() for an advertisement set at 200ms adv interval and then at GAP_EVT_ADV_END disable the advertisement set, would it take 200ms to trigger the adv_end evt. What I was considering was sent out a connectable advertisement every 200ms and between two connectable advertisements, put device in scanning, and if packet matches the filter set relay it with the other advertisement handle (20ms adv interval) and go back to scanning mode when that adv_evt is done.

    If adv_end evt is triggered only after the advertisement interval it makes more sense to use 20ms for first adv handle as well and use application code to manage sending advertisements every 200ms.

  • Hi eteom,

    Thanks for the information. You can distinguish the advertisement sets by checking which handle gets passed into multi_role_processAdvEvent(). For GAP_EVT_ADV_END, the pBuf that gets passed in via *pEventData should be cast to a uint8_t which will contain the advertising handle.