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.

CC2642R: Missing multiple Slave Advertising during the Scan

Part Number: CC2642R
Other Parts Discussed in Thread: CC2640, SYSCONFIG

Hi to everyone,

I'm working with CC2642, SDK_CC26X2_R2_4_40_00_44 and the example used as starting point for my project is the multi_role, heavily modified. The board is a custom board.

This product constantly scan for two different kind of slave and it can be also connected itself from smartphones.

The two kind of slave (let's call them "A" and "B") that must be scanned and (eventually) connected are also custom boards, both based on CC2640_R2. 

The slave "A"  make Advertising frequently, and once the multi_role scan found it, a connection is formed and kept indefinitely. No problem with it.

The slave "B" works as TAG and because its battery powered, its make one single Advertising every 3 seconds (on the three channels 37,38 and 39). 

With no Slave B around multi_role, the multi_role scan is On for 3.5 seconds and Off for 0.2 seconds, indefinitely.

Once the multi_role during the scan found the slave "B",  I change the scan parameters timing in order to sincronize the multi_role scanning with Slave B Advertising (this in order to be able to find every next advertising from slave "B").

So once the multi_role have found the first slave B Advertising, the multi_role Scan is set:

- Off for 2.8 seconds (because the next advertising from Slave B will arrive not early than 3 seconds)

Then

- On for just the amount of time to get the next advertising, so ideally for only 0.2 seconds. (On for max 3.5 seconds  if no Advertising are found).

And so on

Scan Interval and Scan Wind are both set to 16 (10 millisecond)    

The Scan work with white_list of the two Slave

The function called for the scan is GapScan_enable(0, T_ScanDuration, DEFAULT_MAX_SCAN_RES);  

I've tryed DEFAULT_MAX_SCAN_RES from 25 to 250 but since I'm working with white list and because I stop the scan if Slave A or B Advertising is found, I thinks this variable is not relevant at all (I'm also not using the function multi_role_addsScanInfo which require this variable to be not greater than a certain value ). 

The problem is that often, the scan is missing not one, but three or four Advertising of the Salve B consecutively.

I've tried many different Scan and Interval values, and (thinking also that the multi_role must be connected from smartphone and must keep the connection on with the Slave A) the value 16 for both seems the best option.

I've also check the behaviour of the radio during the scan to be sure everything is working as expected, using 

// Map LNA enable pin RFC_GPO0 to DIO06
IOCPortConfigureSet(DIO06, IOC_PORT_RFC_GPO0, IOC_IOMODE_NORMAL);

And I didn't find any issue: when I trigger the Scan On, the radio is working correctly.

I've also tried the multi_role as Central device only, keeping out the PERIPHERAL_CFG configuration. But this doesn't make it better results.  

Do you konw if there is a way to obain better result or if am I missing something?

Many thanks for your support

Federico

  • Hi Federico,

    Thank you for reaching out. We will look into this and get back to you as soon as possible. In the meantime, do you have access to a Bluetooth LE Sniffer? If so, then could you take a sniff log when the missed scanned events occur? This will help us verify that the advertisements are being sent out over the air when the multirole device misses them. Are you able to run your custom code on a launchpad or is the functionality tied to the custom board? I am asking to see if its possible for us to reproduce the issue on our side.

    Best Regards,

    Jan

  • Hi Jan,

    I can do it. In the meantime I have found that:

    - with MAX_NUM_BLE_CONN=1, the scan from my multi_role can find easily almost all the advertising from my TAG (1 Adv each 3 seconds).                            This with or without connecting the smartphone to the multi_role.

    - with MAX_NUM_BLE_CONN=2, the scan from my multi_role can find easily almost all the advertising from my TAG (1 Adv each 3 seconds) ONLY if I don't      connect the Smartphone to the multi_role. Since I connect the Smartphone, the scan from multi_role start to work very badly, missing many TAG Adv.

    I've check the Heap, and it seems everything is ok. I'm attaching the 4 cases with heap log. Also the Stack Size are okay(I have also tried to reduce them, but with same results). 

    Why adding just 1 connection to MAX_NUM_BLE_CONN (even using only one of them) make such great difference? If the problem is the heap, I guess I should see it through heapmgrFail.

    What can I do? At least I should work with MAX_NUM_BLE_CONN=2 ....

    Thanks, Federico

     

  • Hello Federico, 

    We look forward to seeing your sniffer logs. Is it possible that the code that includes the MAX_NUM_BLE_CONN was modified? Additionally, could you test setting MAX_NUM_BLE_CONN to a number other than 1 or 2?  

    Thanks, 

    Isaac

  • Hi Isaac,
    as you asked me, i have prepared a very simple custom code based on multi_role example that you can use directly into the launchpad to verify the behavior.


    Starting from muli_role original example, I have only modified the multi_role.c file: you can replace it the multi_role.c with mine.

    - In this file, searc for "TAG_Mac_Addr" in order to write the mac address you would like to use as slave to be searched from multi_role
    - slave should advertise every 3 seconds

    8156.multi_role.zip


    The multi_role search for TAG (through white list) and the scanning time is for max 3.5 seconds. If the TAG is not found, multi_role wait for 0.2 Seconds and then re-start with a new scan.
    When the TAG is found, the scan is stopped immediately and a new scan start again after 2.8 seconds (because TAG slave make an advertising every 3 seconds, so I'm always ready to find it over the air)
    I have used the two LED to better visual through the oscilloscope the result:

    RED LED is ON when multi_role is scanning
    GEEN LED is ON for few milliseconds when TAG is found

    I have try many different setting into ti_ble_configh.h such as:


    MAX_NUM_BLE_CONNS from 1 to 8

    DEFAULT_SCAN_INTERVAL from 16 to 800
    DEFAULT_SCAN_WINDOW from 16 to 800

    DEFAULT_UPDATE_MIN_CONN_INTERVAL from 100 to 800
    DEFAULT_UPDATE_MAX_CONN_INTERVAL from 100 to 800

    But the only way for multi_role (connected with a Smartphone) to find the TAG almost every 3 seconds is to keep conn.interval between multi_role and smartphone over 600 (through DEFAULT_UPDATE_MAX_CONN_INTERVAL 600)
    If you try a value below, there is no way to get the TAG advertising regulary every 3 seconds.


    Whit DEFAULT_UPDATE_MAX_CONN_INTERVAL < 600 the scan start to missing many TAG advertising: checking with the sniffer, the problem is from multi_role, which seem to start the scan correctly ( GAP_SCAN_ENABLE(); function always return SUCCESS) but in reality, the sniffer show that when the TAG advertising is missing, this happen because there is no SCAN REQUEST from multi_role, even if the TAG is doing advertising work correctly, making an advertise every 3 seconds.


    In this situation ( DEFAULT_UPDATE_MAX_CONN_INTERVAL < 600 and 1 or more master connected to multi_role), I've notice that the scan result follow a similar sinewave, were for few seconds TAG is found correctly every 3 seconds, then for many other seconds, multi_role scan struggle to find the TAG, and so on. The scan period were the TAG is found with no problem and the period were the TAG advertising is missed change accordingly with the value of DEFAULT_UPDATE_MAX_CONN_INTERVAL(higher value, longer period were multi_role can find correctly the TAG).

    My problem is that DEFAULT_UPDATE_MAX_CONN_INTERVAL = 600 is already inusable value for my use, because makes the comunication between Smartphone APP and multi_role too slowly (the delay from the smartphone APP command and the execution action from multi_role is too big and also from customer view is not accetable).

    So I'm asking help to understand if really there is a problem (and in this case if it possible to fix) or I can't do anything for my need ?

    Many thanks, Federico

  • Hello Federico, 

    I will have to get back to you Monday. We need to use the sniffer to determine if we are missing peripheral advertisements on our end. Additionally, can you let us know if you have modified anything else within SysConfig? If so can you provide us with your SysConfig file? 

    Thanks, 

    Isaac

  • Hi Isaac,
    starting from TI's original example, I've changed only multi_role.c. This in order to make very quick and easy for you to reproduce with LP the problem. About the sysconfig, I I've been playing only with connection and scan parameters as I wrote above, through ti_ble_configh.h

    Thanks, Federico

  • Hello Federico, 

    This seems like a case where you need to optimize your parameters dependent on your use case. Since you can't scan 100% of the time, you are bound to miss some advertisements. We will be testing this more tomorrow and can hopefully find some additional information. Additionally, I will attach a past E2E thread here and our Advertising and Scanning SLA here for more information on this topic. 

    Also, can this be replicated using another board, or have you been primarily testing this with the iOS/Android app?

    Thanks, 

    Isaac

  • Hi Isaac,

    thanks for your help. I know i can't scan 100% of the time, my problem is a complete miss of any advertising for 16 (sometime more, somtime less) times consecutively. I think this is a bit strange.. Thanks for the link: I've try every Scan Wind and Scan intervall values focusing to miss less advertinig possiblle when a Master is connected to the multi_role LP, but the only way to get the Advertising from my TAG is to keep the Connection Interval to 600 or higher. I have try scan wind and scan interval from 16 to 800, but if connection interval is kept below 600, multi_role start to missing too many advertising consecutively anyway.

    I've been working with my custom board + my custom android APP, but as your requested, now you can repluicate easily with LP + multi_role.c I've attached 4 days ago. You can use any kind of smartphone: the connection interval start with different values from different smartphone, but during the update_link_parameter the connection interval is set to the value present in ti_ble_configh.h

    So if for example I set the DEFAULT_UPDATE_MAX_CONN_INTERVAL = 300 but the connection between smartphone and LP start with a connection interval = 30, after few seconds the "link paramter update" will set the new connection interval at the value 300. Starting from this state, with any kind of scan interval and wind, multi_role keep missing the TAG advertising for too many times consecutively. Only If I use DEFAULT_UPDATE_MAX_CONN_INTERVAL > 600 It start to work correctly, but 600 or more is a really huge value as I 've explained for my application.

    So if my goal is to use a connection interval around 100 maxium to spped up the comunication between SPhone and multi_role, how can I fix the missing of the Advertising from the scan if I have already tried any scan interval and wind? 

    Can you suggest me scan wind and scan interval parameter values to work with connection interval =100 without facing the scan issue?

    Did you find anything with sniffer to explaine this behavour ?  

    Thanks , Federico

  • Hello Federico, 

    First can you provide me with your desired connection interval? Also, you mentioned you were altering your scan interval, did you see one that worked best for you? Second, can you provide any logs from the tx, rx pins of the device? This can help us indicate if the everything is transmitting and being received properly. Third, how many connections are you attempting to initiate? Fourth, can you clarify what roles everything is? My thought right now is that the connection events are interfering with the scanning events since the scanning intervals are set to 3.5s on 0.2s off. Let me know about the questions and sorry for the inconvenience. 

    Thanks, 

    Isaac

  • Hi Isaac,

    as I wrote above, max connection interval = 100 can be enough for my application.

    Tx Pin and Rx pin work correctly as I've already check with through IOCPortConfigureSet function and I didn't find any problem. Trasmitting and receiving are done correctly following the timing I've configured.  

    Usually my multi_role custom application should manage 2-3 connections: 1 in slave mode from smartphone and 1-2 in master mode (1-2 slave). 

    I can increment the scan interval, but the result still be the same: many advertising are missed even if I use continuos sanning.

    Did you have the chance to try to replicate my issue with a LP using the multi_role.c I've attached in my previously post? Because with it I can find the same exactly behaviour

    Thanks in advance, Federico  

  • Hello Federico, 

    We have collected some sniffer logs and tx rx logs using your program. The connection interval was set to 100 to replicate what would be enough for you application, and the scan wind/interval was set to 500. I will include the two logs below. Can you verify if you are seeing any of the same activity on our logs as your logs? Additionally, could you try scanning for a shorter interval, but increase the number of times you are scanning? Let me know if this fixes your issue. scanningadvertisingandconnectionevents.btttxrxpinactivity.sal

     

    Thanks, 

    Isaac

  • Hi Isaac,

    thanks for your help. I was not able to open your log file (.btt and .sal extension), can you send me in a different format?

    I've tested the LP with:

    scan interval and scan wind = 500

    DEFAULT_UPDATE_MAX_CONN_INTERVAL = 100

    And the result is the same as before:

    1 -TAG mac address is teh only one set in LP withlist

    2 - LP without SPhone connected can always find the Advertising sent from TAG every 3 seconds

    3 - SPhone bonded and connectet to LP start wirh lower than 100 connection interval (for example 30 or 40).

    4 - LP with SPhone connected start missing many Advertising sent from TAG every 3 seconds

    5 - With link update the connection the connection interval is succesfully set to 100 

    6- LP with SPhone connected still missing many Advertising sent from TAG every 3 seconds

     

    I've tried also to reduce the scanning time from 3.5 seconds to 1 seconds, but the result was the same. 

    Did you manage to make the LP able to find correctly every TAG advertising with connection interval =100 and scan wint/interval=500 or with any different parameter setting?

    My goal is to use a connection interval = 100 (or lower) between LP and SPhone and at the same time getting properly with the LP the advertising sent from the TAG every 3 seconds.

    if you have found different scan interval/scan wind/scanning time/parameters to use in order to set my goal, please share me so I can replicate.     

    Again, thanks for your support

    Federico

  • Hello Federico,

    My apologies, to open these logs you will need some additional software that you can download online. 

    The .btt file is an ellisys bluetooth sniffer log. You can read these files by downloading the ellisys bluetooth analyzer software: 

    Ellisys - Bluetooth Tracker - Download

    The .sal file requires the saleae logic analyzer software, which can be downloaded here: 

    Logic analyzer software from Saleae

    Can you download this software and open the logs on your side so you can see the behavior that I am seeing locally using your image? 

    Can you try using a smaller scanning interval, window and duration? I would like to see if having shorter, more frequent scans leads to better results, while still maintaining the 100-connection interval value. Can you try something as low as 10ms for the scan interval and window, and as low as 20 ms for the scan duration? We can work our way up from there. At this point I am thinking it's possible that the very long and frequent scanning is being preempted by the connection event, which is causing some scans to be skipped, reducing the scan frequency and length will help us verify if this is the case. 

    Thanks, 

    Isaac

  • Hi Isaac,

    actually in my custom application I'm using scan wind =16 and scan intervall = 16 already,  because it was the best combination I could find during my previously test (keeping 3.5 seconds as scan duration). 

    As you asked, keeping scan wind and scan interval = 16, I've try to decrease also the scan duration till 20 milliseconds, but with such small value, the multi_role is not able to find any advertising at all. 

    -----------------------------

    I downloaded the sw and check the log you've sent me. I've try to make the log at the same condition: connection interval = 100, scan wind and scan interval= 500, scan duration 3.5 second. I've also added the RF pin debug into the LP code, so I was also able to monitor with the oscilloscope 4 signal:

    - 1° probe(yellow)    -> LNA (IOC_PORT_RFC_GPO0)

    - 1° probe (green)   -> Tx (IOC_PORT_RFC_GPO3)

    - 1° probe(blue)      -> Scan ON / Scan OFF

    -  4 ° probe(purple) -> TAG advertise detected/not detected 

       You can find attached both the LOG captured with Frontline BT sniffer (mult_role with no connection and multi_role connected with a SPhone) and the relative Oscilloscope waveform.

    2604.LOG.zip 

    Thanks, Federico

  • Hello Federico,

    To confirm, it seems the advertising interval is 3 seconds on the peripheral side. Is there a reason you are using this specific value? Is it possible to reduce the advertising interval to give the scanner more opportunities to catch the advertisements? Even if you must use 3 second advertising interval, can you try setting the advertising interval 20ms to see if the problem is still there? During this test, please set the scan window, interval and duration to smaller values. 

    Based on your use case, periodic advertisement may work best for you. I will link the documents for periodic advertisement here. Can you please look into that section and see if it may be helpful for your use case. If periodic advertisement is useful for your use case, can you please try following the directions in the document to implement the feature. 

    Also, are you in control of the peripheral? If so, can you modify the peripherals advertising? 

    Thanks, 

    Isaac

  • Hi Isaac, 

    thank for the feedback. The reason we use 3 seconds for TAG advertising interval is because our TAG is battery powered, so we must keep low as possible the consumptions. I will try with 20 ms as advertising intervall and I'm sure it will improve the scanning results, but we can't  use it for production, unfortunately. Thank you for the link, I will study it to see if can help me.

    Regards, Federico 

  • Hello Federico, 

    Thanks for testing this out. Periodic advertisements may work but can you also try just minimizing the advertisement interval to a value that works for your use case? Let me know how all of this works. 

    Thanks, 

    Isaac