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: No ble scan disable event callback

Part Number: CC2340R5

We start a ble scanning with duration 60s, and we can get BLEAPPUTIL_SCAN_ENABLED and BLEAPPUTIL_ADV_REPORT events normally.

In most of time, we can get the BLEAPPUTIL_SCAN_DISABLED event, but when we do a stress test, sometimes, we cannot get the BLEAPPUTIL_SCAN_DISABLED event even it is timeout.

image.png

After that, we tried to stop it by invoking BLEAppUtil_scanStop(), it returen SUCCESS. but when we tried to start ble again, it will be failed and return with code 0x11(bleAlreadyInRequestedMode).
image.png


More information:
1. No stack overflow
2. application task work normally

I suspect that's something wrong in the BLE stack, but i don't know how to analyse more. We appreciate if you can give us any analysis suggestions. Thank you!

  • Hello,

    Thanks for reaching out.

    Please consider that BLEAppUtil_scanStop() is queuing function that is being queued, meaning it might not execute right away. The SUCCESS return means it has been queued successfully. The 0x11 error indicates that even the scan stop was accepted, the stack hasnt fully completed the state transition. Please try introducing a short delay or wait for the scan stopped callback event before invoking a scan Start function again.
    Let me know how it goes.
    Best Regards,
    David
  • Hi David,
    Thanks for you response.
    However, as you can see on the last picture above, we start ble scan at 15:01:49 with timeout 60s, that is no stop event until 15:09:12, morn than 8min.

    BR,

  • Hello,

    Would you mind specifying the SDK version you are using and how you are implementing the stress testing? If you are using an example as a reference which one is it and what parameters are you configuring the BLEAppUtil_scanStart API call with.

    Thanks

    David.

  • Hi David,

    We use SDK simplelink_lowpower_f3_sdk_8_40_02_01.

    We inplement stress testing as below:
      - start ble scan by invoke BLEAppUtil_scanStart 

      - in BLEAPPUTIL_ADV_REPORT event , we will stored scan response to array, once array be full, will notify others thread to store array to flash, during this time , will ignore new scan response until store to flash done.
      - in BLEAPPUTIL_SCAN_DISABLED event, we will print some log.

      - do some sleep(10s) and then repeat above steps as stress test

     

    And below paramters are for BLEAppUtil_scanStart  API call:

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

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

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

    const BLEAppUtil_ScanInit_t observer_scan_init_params = {
        /*! Opt SCAN_PRIM_PHY_1M | SCAN_PRIM_PHY_CODED */
        .primPhy = SCAN_PRIM_PHY_1M,

        /*! Opt SCAN_TYPE_ACTIVE | SCAN_TYPE_PASSIVE */
        .scanType = SCAN_TYPE_PASSIVE,

        /*! Scan interval shall be greater than or equal to scan window */
        .scanInterval = 800, /* Units of 625 us */

        /*! Scan window shall be less than or equal to scan interval */
        .scanWindow = 800, /* Units of 625 us */

        /*! Select which fields of an advertising report will be stored */
        /*! in the AdvRptList, For mor field see @ref Gap_scanner.h */
        .advReportFields = SCAN_ADVRPT_FLD_ADDRESS,
     
        /*! Opt SCAN_PRIM_PHY_1M | SCAN_PRIM_PHY_CODED */
        .scanPhys = SCAN_PRIM_PHY_1M,

        /*! Opt SCAN_FLT_POLICY_ALL | SCAN_FLT_POLICY_WL | SCAN_FLT_POLICY_ALL_RPA
        * | SCAN_FLT_POLICY_WL_RPA */
        .fltPolicy = SCAN_FLT_POLICY_ALL,

        /*! For more filter PDU @ref Gap_scanner.h */
        .fltPduType = (SCAN_FLT_PDU_NONCONNECTABLE_ONLY | \
                               SCAN_FLT_PDU_NONSCANNABLE_ONLY | \
                               SCAN_FLT_PDU_UNDIRECTED_ONLY | \
                               SCAN_FLT_PDU_ADV_ONLY | \
                               SCAN_FLT_PDU_LEGACY_ONLY),

        /*! Opt SCAN_FLT_RSSI_ALL | SCAN_FLT_RSSI_NONE */
        .fltMinRssi = SCAN_FLT_RSSI_ALL,

        /*! Opt SCAN_FLT_DISC_NONE | SCAN_FLT_DISC_GENERAL | SCAN_FLT_DISC_LIMITED
        * | SCAN_FLT_DISC_ALL | SCAN_FLT_DISC_DISABLE */
        .fltDiscMode = SCAN_FLT_DISC_DISABLE,

        /*! Opt SCAN_FLT_DUP_ENABLE | SCAN_FLT_DUP_DISABLE | SCAN_FLT_DUP_RESET */
        .fltDup = SCAN_FLT_DUP_DISABLE
    }



    BR,

  • Hello,

    Thanks for sharing. I am trying to reproduce what you see but I am constantly getting a scan disable event. However I am not implementing the adv report to flash saving process. How are you notifying the other task (semaphore?) Would you mind not executing the 2 step to see if the issue does not reproduces, pointing that the issue might be related to the task that saves the array into flash? I would like to take it from there.

    Thanks.

    David.

  • Hi David,

    Thanks for your response.
    Yeah, in most of time we also get the scan disable event normally. 
    When the array is full, we will set a flag and notify other task by freertos TaskNotify function xTaskNotify(), when the new ble scan BLEAPPUTIL_ADV_REPORT event coming it will be ignore until the flag was reset.
    We will try to follow your suggesttion to test exclude step 2, but it maybe will need a long time to check if it will reproduce this issue again or not.

    BR,

  • Hello,

    Thanks, it would be quite useful to know that. I will keep testing without it as well.

    BR,

    David.