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-Q1: What do these two parameters Scan period and ScanDuration mean?

Part Number: CC2340R5-Q1

Tool/software:

Hi  TI

Generally , the BLE SCAN settings usually only have Scan Windows and Scan interval(Figure1).

Why are there two more settings, Scan period and ScanDuration in TI's BLE parameters settings?(Figure2)

I don't understand what the corresponding behaviors are?Does TI have any documentation or some current waveforms to explain?

As shown in the figure below(Figure1), which phase do these two additional parameters correspond to?

Thanks

Figure1

TI  BLE parameterSetting

Figure2

FII Qin

  • Hello,

    Window: The time we spend scanning a singular primary advertising channel. It must be smaller than the interval.

    Interval: Time from when the controller starts its last scan until it begins the subsequent scan on the primary advertising channels. In the diagram, the window is the actual amount of time scanning, and the interval is the amount of time before the next scan window is started.

    If the window is 10ms, and the interval is 30ms, then your scanning a singular advertising channel for 10ms, and not scanning anything for 20ms. 

    Duration: The duration determines how many intervals we have in a period. For instance, if the duration is 2 times the interval, then we can fit two intervals in a scan procedure. In the diagram below, our duration is ~3x the interval, so we can fit three intervals. This means we scan all three channels.

    Scan Period: The time until the next scan session is started. This is set if you want to scan periodically without having to use a timer to turn on/off scanning manually. If this is zero, then scanning will occur continuously, according to the window, interval, and duration parameters.

    Hope that helps.

    Best,

    Nima Behmanesh

  • Nima

    Thanks

    My understanding is that the sleep section in the figure below should be in low power mode.Normally, the current in the sleep section should be less than10uA, or even less than 1ua. I don't know if my understanding is correct.

    We tested CC2340 and found that the current in the sleep section is at the mA level. There should be something wrong.

  • HI Nima

      I‘m’ set Scan Period :128s、Scan Interval:50ms、Scan Window :30ms、Scan Duration :90000ms.

      Judging from the current, 2340 has been scanning continuously, However, from the log, it can be seen that 2340 stops scanning after one second, and then repeats the scan for one second after two minutes and stops.Is this a normal phenomenon? Or is there anything wrong with the Settings of my scanning parameters?

      

     

  • Hello,

    Scanning every 2 minutes makes sense to me, since the scan period is 128 seconds, which comes out about 2 minutes. However, the scan duration being 90000ms means that you should get at least 1800 intervals in there. So if the window is 30ms, that would mean actively scanning for (1800 * 30ms), or about 54 seconds.

    Out of curiosity, what is the maximum number of advertising reports you have set? If it's non-zero, do you mind changing it to 0?

    When you're scanning, are there any connections taking place? For instance, in the log you provided it has lines like "foundMatch doing." etc. what is the application doing when this occurs?

    Best,

    Nima Behmanesh

  • Hello,

    It depends. If there is enough time to go to sleep before the next interval begins, then yes. However, it also depends on if there are any active connections, or anything else the chip is doing. during this period of non-scanning, the chip may have enough time to go service other tasks.

    Best,

    Nima Behmanesh

  • Hello,

    According to what you say, the parameters that I set up should be repeated scan 1800*30ms every two minutes.Judging from the current, it is indeed so.However, from the log, it only scanned for one second. The program I set stops scanning and connects only when it scans the broadcast name I set.

    I can only make the connection when the log shows that it is "foundMatch ".The connection was not made in the second when the log appeared, and it can't make a connection for the next two minutes when the log did not appear.

    The maximum number of advertising reports I have set it's non-zero.I tried to change it to 0,It seems that nothing has changed.

    The following picture is the log that will be displayed when my connection is successful.The following code is my "foundMatch "section.

    static bool CheckScanEventLegacy(GapScan_Evt_AdvRpt_t* pAdvReport)
    {
        uint32_t index = 0;
        bool foundMatch = FALSE;
        uint8_t Receive_Ecu_Data[6] = {0x39, 0x59, 0x59, 0x59, 0x59, 0x5A};
    
        while (index < pAdvReport->dataLen)
        {
            gapAdStructure_t adElement;
    
            adElement.length = pAdvReport->pData[index];
            adElement.adType = pAdvReport->pData[index + 1U];
            adElement.aData = &pAdvReport->pData[index + 2U];
    
            if(adElement.adType == 0x09U)
            {
    //            MenuModule_printf(APP_MENU_SCAN_EVENT, 0, "XXXXX:[%s]\n", BLEAppUtil_convertBdAddr2Str(adElement.aData));
                foundMatch = FLib_MemCmp(&(adElement.aData[0]), &(Receive_Ecu_Data[0]), 6);
                PHSCA_ESELOG_PRINTF("%s","foundMatch doing.\r\n");
                PHSCA_ESELOG_HEX_PRINTF(Receive_Ecu_Data,6);
                if(foundMatch)
                {
    //                MenuModule_printf(APP_MENU_SCAN_EVENT, 0, "match!!! localname:[%s]\n", BLEAppUtil_convertBdAddr2Str(adElement.aData));
                    break;
                }
            }
    
            /* Move on to the next AD element type */
            index += (uint32_t)adElement.length + sizeof(uint8_t);
        }
    
        return foundMatch;
    }

  • Hello,

    By any chance do you have duplicate filtering turned on?

    Best,

    Nima Behmanesh

  • Hi Nima,

    Thank you for your answer. My question has been resolved.