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.

CC2340R5: Extended advertisement In CC2340R5

Part Number: CC2340R5
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi,

I have added new advertisement set for Extended advertisement in that i'm unable to add scan response data, and i have done below settings and parameters.

when we are starting advertisement but not visible on the BLE_scaner or any BLE applicaation.

Please provide solution we need to change anything in stack.

I have defined adv handle for second adv set.

SDK version: simplelink_lowpower_f3_sdk_8_10_01_02

CCS version : 12.5

thanks, and regards

Balaji Wankhede

  • Hi Balaji Wankhede,

    The extended advertising feature was provided in an Early Access state for the 8.10 release. I would suggest using the 8.40 release as the feature is bluetooth certified in that release. Regarding the feature, the vast majority of smart phone applications do not display extended advertising. They only display legacy advertising. To see what is happening over the air, I would recommend using a second launchpad that is scanning for extended advertisements or a bluetooth le sniffer to see if you can spot complaint extended advertisements.

    Best Regards,

    Jan

  • Hello Jan,

    Thanks, you for your response.

    Yes, we have tried it and now it is showing on some application now extended is working fine.

    I have one central device i made coded setting in that device device is scanning continuously but in BLEAPPUTIL_ADV_REPORT is not getting when we did coded Phy setting in central device given below.

    I have attached some screenshots of central device:

  • Hi,

    Glad to hear you are able to see the advertisements now! On the coded scanner, is the advertiser also using the same coded phy?

    Best Regards,

    Jan

  • Hello Jan,

    No, for scanning, we are using a different device that should receive the extended advertisement packets. It's continuously scanning, but the packets are not appearing in the BLEAPPUTIL_ADV_REPORT. Please provide some technical solutions that will be useful to us.

    Extended advertisement is visible on mobile phone but in central device we are unable to see any types of advertisement is not getting (it's not receiving any advertisement packet) when we did previous settings (provide in last reply)

    but when we tried scanning in legacy advertisement then we are receiving number of advertainment devices but scanning in extended (coded) PHY at that time no packet received in scan response.

    is there setting we are missing or needs to add any Events please let us know?

    note: If you need more information, please let me know.

    Thanks, and regards,

    Balaji Wankhede

  • Hello Jan,

    This side sanket is here. I am collogue of Balaji. 

    We have used the same coded phy at both side. Both side we are using CC2340 controller. We are able to see the extended ADV on the BLE Scanner (mobile application), but on other side the Central device not able to scan the extended ADV.  breakpoint at BLEAPPUTIL_ADV_REPORT not hitting. 

    This task is very much critical for us to solve to achieve the project milestone. 

    Note : This complete activity we are doing to increase the BLE range. I have seen in the datasheet with coded BLE range will be 2 times and more.

  • Hi,

    Can you share how you are modifying the scanning PHY to Coded?

    Best Regards,

    Jan

  • Hi,

    we already share system config setting screenshot attached in previous reply.

    we are changing scanning PHY from system config setting.

    Please check below setting we have done in central device:

  • Hi,

    My apologies, I missed that the image was already shared. These settings look okay to me. Can you share the code snippets where you enable scanning?

    Best Regards,

    Jan

  • Hello Jan,

    thanks for response.

    I am attaching the code here we are doing continuous scanning in one task is running continuous.
    as per your request, I have attached most of the function that we require for scanning and advertisement data to be receive from peripheral device.
    I am attaching the code here. We are performing continuous scanning in one task, and it is running continuously.

    I have attached the task running in the main_freertos.c file below.

    // Task created like
    xTaskCreate(vTask1Function, "Task1", 1024, NULL, tskIDLE_PRIORITY + 1, &xTask1Handle); // New task created

    void vTask1Function(void *ptr)
    {
    for(;;)
    {
    if(connect_flag == 0)
    {
    BLEAppUtil_invokeFunctionNoData((InvokeFromBLEAppUtilContext_t)Scan_connect);
    }

    vTaskDelay(pdMS_TO_TICKS(500));
    }
    }

    // New function added for scanning device
    void Scan_connect(void)
    {
    const BLEAppUtil_ScanStart_t centralScanStartParams =
    {
    /*! Zero for continuous scanning */
    .scanPeriod = 0, // DEFAULT_SCAN_PERIOD, /* Units of 1.28sec */

    /*! Scan Duration shall be greater than the scan interval. Zero means continuous scanning. */
    .scanDuration = 50, // DEFAULT_SCAN_DURATION, /* Units of 10ms */

    /*! If non-zero, the list of advertising reports will be generated and come with @ref GAP_EVT_SCAN_DISABLED. */
    .maxNumReport = 30 // APP_MAX_NUM_OF_ADV_REPORTS
    };

    BLEAppUtil_scanStart(&centralScanStartParams);
    }
    I have added the BLEAPPUTIL_ADV_REPORT event handler in the aap_central.c file.

    // Event handlers struct, contains the handlers and event masks
    // for the application central role module
    BLEAppUtil_EventHandler_t centralScanHandler =
    {
    .handlerType = BLEAPPUTIL_GAP_SCAN_TYPE,
    .pEventHandler = Central_ScanEventHandler,
    .eventMask = BLEAPPUTIL_SCAN_ENABLED |
    BLEAPPUTIL_SCAN_DISABLED |
    BLEAPPUTIL_ADV_REPORT
    };

    case BLEAPPUTIL_ADV_REPORT:
    {
    GapScan_Evt_AdvRpt_t advReport;
    int cnt;
    for(cnt = 0; cnt < 6; cnt++)
    {
    dat_buf[cnt] = scanMsg->pBuf->pAdvReport.addr[cnt];
    }
    }
    However, we are not receiving extended advertising data (BLEAPPUTIL_ADV_REPORT) in this event. Could you please provide a solution for this?

    As per your request, I have attached most of the functions required for scanning and receiving advertisement data from the peripheral device.

    Thanks and regards

    Balaji Wankhede

  • Hello Balaji,

    Thank you for your patience! I'm going to look into this and get back to you by end of day tomorrow (February 19th)!

    Best Regards,
    Tarek

  • Hello Balaji,

    Please help us clarifying some points first:

    1. How do you configured the peripheral? Sharing the SysConfig configuration can be useful. According to the Bluetooth Core Specification Version 5.3 | Vol 4, Part E section 7.8.53: LE Set Extended Advertising Parameters command: "If extended advertising PDU types are being used (bit 4 = 0) then: The advertisement shall not be both connectable and scannable" Therefore, it is not possible to have both in the same mode. You can have Scannable Advertising (only scan responses) or Connectable Advertising (only advertising data) advertisement. So which one of the two are you using? I would assume you have configured it for scan responses per your initial question. In any case this isn't something to focus much on considering you are actually receiving a report, but is good to clarify.
    2.  Now focusing on the central device, are you using the basic_ble example as a starting reference? Could we please start by using the main ble task instead of creating another one, which as I see it is not ICall_register? If you go to app_central, you would need to modify the following (similar to what you already have):
      1. Add BLEAPPUTIL_ADV_REPORT to centralScanHandler.
      2. Add case BLEAPPUTIL_ADV_REPORT inside the Central_ScanEventHandler Cb function. Lets start by toggling a LED first.
    3. Please increase your scanDuration time.
    4. If you have a Bluetooth LE sniffer, please check that the peripheral device is actually advertising (you already did with the mobile app for what I see, so good). Please also check that the central device is actually scanning, you can do this using the sniffer, or you can use EnergyTrace, you should be able to see the current draw increasing while scanning (window period) periodically.

    Let us know how it goes.

    BR,

    David.

  • Hello Devid,

    thanks for your response.

    I have followed the process you shared in your previous reply.

    Now, I am receiving extended advertisement data on the central device. However, the problem is that when I perform continuous scanning in a task, my peripheral device is not detected in BLEAPPUTIL_ADV_REPORT. What could be the issue when performing continuous scanning in the newly created task?

    Is there another method to perform continuous scanning without using a task?

    xTaskCreate(vTask1Function, "Task1", 1024, NULL, tskIDLE_PRIORITY + 1, &xTask1Handle);

    I am doing scanning in above created task 

    void vTask1Function(void *ptr)
    {
    for(;;)
     {
     BLEAppUtil_invokeFunctionNoData((InvokeFromBLEAppUtilContext_t)Scan_connect);
    vTaskDelay(pdMS_TO_TICKS(500));

    }
    }

    void Scan_connect(void)
    {

    const BLEAppUtil_ScanStart_t centralScanStartParams =
    {
    /*! Zero for continuously scanning */
    .scanPeriod = 0 ,//DEFAULT_SCAN_PERIOD, /* Units of 1.28sec */

    /*! Scan Duration shall be greater than to scan interval,*/
    /*! Zero continuously scanning. */
    .scanDuration = 100, //DEFAULT_SCAN_DURATION, /* Units of 10ms */

    /*! If non-zero, the list of advertising reports will be */
    /*! generated and come with @ref GAP_EVT_SCAN_DISABLED. */
    .maxNumReport = 20 //APP_MAX_NUM_OF_ADV_REPORTS
    };

    BLEAppUtil_scanStart(&centralScanStartParams);
    }

    SDK: simplelink_lowpower_f3_sdk_8_40_00_61
    CCS Version: 12.5

    central side device settings:

    Peripheral side device setting:

    Please provide response asap.

    Note: If you need more information please let know in 

  • Hello Balaji,

    Just to clarify, is the code you shared the one you are using and the one that successfully scanned the device that's using extended advertising? And could you also increase the maximum number of advertising reports? 

    Best Regards,

    Tarek

  • Hello Tarek,

    Yes, I am trying to scan using only the coded PHY (system config setting already shared in previous reply).

    Whenever I scan using the newly created task with continuous scanning enabled, I am not getting any extended advertisement devices.

    However, when I scan using the Button Press Menu callback, as per the basic_ble example code, with the same settings applied in the system config (as shared with you), I am able to get extended advertisement devices in the BLEAPPUTIL_ADV_REPORT event.

    But our problem is we need continuous scanning with coded PHY.

    Below is the code we've modified for continuous scanning:


    void vTask1Function(void *ptr)
    {
    for(;;)
    {
    BLEAppUtil_invokeFunctionNoData((InvokeFromBLEAppUtilContext_t)Scan_connect);
    vTaskDelay(pdMS_TO_TICKS(500));
    }
    }

    void Scan_connect(void)
    {
    const BLEAppUtil_ScanStart_t centralScanStartParams =
    {
    /*! Zero for continuously scanning */
    .scanPeriod = 0, //DEFAULT_SCAN_PERIOD, /* Units of 1.28sec */

    /*! Scan Duration shall be greater than the scan interval, */
    /*! Zero for continuous scanning. */
    .scanDuration = 100, //DEFAULT_SCAN_DURATION, /* Units of 10ms */

    /*! If non-zero, the list of advertising reports will be */
    /*! generated and come with @ref GAP_EVT_SCAN_DISABLED. */
    .maxNumReport = 30 //APP_MAX_NUM_OF_ADV_REPORTS
    };

    BLEAppUtil_scanStart(&centralScanStartParams);
    }
    I am trying to implement continuous scanning using the newly created task in main_freertos.c as shown above.

    The scanning is continuous, but I am not getting any extended advertisement devices in the BLEAPPUTIL_ADV_REPORT event.

    Is there any way to scan continuously without using the task?

    Please provide a solution that would help us resolve this issue.

    Thanks, and Regards

    Balaji W

  • Hello Balaji,

    Thank you for your patience! I don't think the external task is needed. You can use the GapScan_enable function inside the original task to start the scanning using code and not the button callback. The link I've attached explains the different configuration possibilities for this function. I hope this solves your problem!

    Best Regards,

    Tarek

  • Hello Tarek,

    We have tried calling GapScan_enable in the main task, but it is still not working properly. Even when we call GapScan_enable in the main task, the scan happens only once, and then it takes 5–6 minutes before the next scan occurs. This behavior is causing difficulties for us.

    We also tried scanning using the button callback and tested the range with coded PHY, but we are still not getting more range—only around 50 meters.

    I believe we may be missing something important. Could you kindly assist us in resolving this issue?

    Thank and Regards

    Balaji Wankhede

  • Hello Balaji,

    I'm looking into this. I'll get back to you ASAP.

    Best Regards,

    Tarek

  • Hello Balaji,

    Thank you for your patience! To achieve continuous scanning, GapScan_enable should be used. However, keep in mind that the duration and period entries should both be zero. The max number of reports will not affect the status of the scanning. Therefore, the function call would look like:

    GapScan_enable(0,0,x)  //Where x is the max number of adv reports
    

    I ran this function on my end, and as seen in the graph below, scanning was continuous:

    Then I manually turned off scanning, to confirm that a change would happen, and as you can see in the graph below, once scanning stopped, power went down:

    Best Regards,

    Tarek

  • Hello Tarek,

    Yes, we have tested as you shared above snapshot.

    Thanks for response.

    we are able to be scanning continuous.

    we have tried Extended scanning and extended advertisement still we are getting same range (i.e same as Lagacy advertisement).

    as per observation i think extended also we are not getting expected result.

    we have tried both S2 and S8 both still range is same in both cases.

    Please provide is there any other way to increase the range using the extended advertisement.

    Thanks, and Regards

    Balaji Wankhede

  • Hello Balaji,

    Could you please provide a packet sniffer log? We'd like to analyze and verify what is going on. 

    Best Regards,

    Tarek

  • yes,

    I will check and let you know.

    you have check and the mobile we are getting extended device continuous and scanning device also scanning using the coded phy only still we are getting same range.

    Thanks, and Regards

    Balaji Wankhede

  • Hello Balaji,

    I will run a test on my end, and get back to you ASAP. Also, providing the packet sniffer would be very helpful.

    Best Regards,

    Tarek

  • Hello Balaji,

    I just ran the test on my end. We tested Coded S2 and I was able to reach the expected distance in clear line of sight. Please provide a packet sniffer log if possible to we can attempt to solve your issue.

    Best Regards,

    Tarek