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.

CC2640: AoA RTLS toolbox coming data delay

Part Number: CC2640

Hello,

" It will take ~30 seconds before the graph starts showing data." this is written in http://dev.ti.com/tirex/content/simplelink_academy_cc2640r2sdk_2_40_03_00/modules/blestack/rtls_intro/rtls_intro.html  .

We are getting results for a tag then terminate link and connect the second tag then get results for the second tag. When we just run the python script it takes ~30 seconds to get results for the first tag.

Then we connect to the second tag and we wait again to get results. After the first time, it only takes ~2 seconds to get the result. We terminate link, connect new tag and get the new results very quickly. When the new tag comes in the test environment and master connect it too, again we wait for ~30 for the first time, then it gives results quickly too. 

This process is same for every time so why does first time take so long?

Why does it happen? If there are 20 tags then we will wait for 10 minutes to get results from all. How can we solve this problem?

Thanks.

  • Hi Alig,
    Assigning one of the experts to comment.
  • Hi,

    Before reporting RTLS data the devices will pair and encrypt using authenticated LE Secure Connections pairing.
    This is because the ToF security seed is to be sent to the slave via BLE and thus the link should be encrypted with the highest security. (if ToF is used) this is also done for AoA as well.

    The delay is coming from two things:

    1. The Connection interval is 100ms
    2. Pairing takes many connection events because it does a crypto operation on every single bit of the passkey.

    This can be reduced by:

    1. Enabling bonding (it will still take time on first connect, but pairing will not be needed on subsequent connections)
    2. Disabling pairing (since you are using AoA perhaps you do not need an encrypted connection)
  • In the code bonding was already enabled with this GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);
    and to disable pairing I replaced GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode); with GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE_NO_PAIRING, sizeof(uint8_t), &pairMode); . Now it starts, enable AoA but doesnt give results. I was wrong when I disable pairing?
  • It seems it doesn't work without pairing. Am I right?
  • Part Number: CC2640

    Hello,

    We are getting raw data from RTLS Toolbox. But we are waiting 30 seconds for pairing at first connection. We asked a solution for this and Sean suggested two things for that like in this link https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/792344?tisearch=e2e-sitesearch&keymatch=%20user:398873.   Two things are disabling pairing and enabling bonding.

    Things we did to disable pairing at master:

    {
    // Don't send a pairing request after connecting; the device waits for the
    // application to start pairing
    uint8_t pairMode = GAPBOND_PAIRING_MODE_NO_PAIRING;
    // Do not use authenticated pairing
    // uint8_t mitm = FALSE;
    // This is a display only device
    // uint8_t ioCap = DEFAULT_IO_CAPABILITIES;
    // Create a bond during the pairing process
    uint8_t bonding = FALSE;
    // Whether to replace the least recently used entry when bond list is full,
    // and a new device is bonded.
    // Alternative is pairing succeeds but bonding fails, unless application has
    // manually erased at least one bond.
    // uint8_t replaceBonds = TRUE;

    GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);
    // GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);
    // GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);
    GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);
    // GAPBondMgr_SetParameter(GAPBOND_LRU_BOND_REPLACEMENT, sizeof(uint8_t), &replaceBonds);
    }

    Things we did to disable pairing at slave:

    {
    // Don't send a pairing request after connecting; the peer device must
    // initiate pairing
    uint8_t pairMode = GAPBOND_PAIRING_MODE_NO_PAIRING;
    // Use authenticated pairing: require passcode.
    // uint8_t mitm = FALSE;
    // This device only has display capabilities. Therefore, it will display the
    // passcode during pairing. However, since the default passcode is being
    // used, there is no need to display anything.
    // uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_YES_NO;
    // Request bonding (storing long-term keys for re-encryption upon subsequent
    // connections without repairing)
    uint8_t bonding = FALSE;

    GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);
    // GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);
    // GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);
    GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);
    }
    Things we did to enable bonding at master:
    {
    // Don't send a pairing request after connecting; the device waits for the
    // application to start pairing
    uint8_t pairMode = DEFAULT_PAIRING_MODE;
    // Do not use authenticated pairing
    uint8_t mitm = DEFAULT_MITM_MODE;
    // This is a display only device
    uint8_t ioCap = DEFAULT_IO_CAPABILITIES;
    // Create a bond during the pairing process
    uint8_t bonding = TRUE;
    // Whether to replace the least recently used entry when bond list is full,
    // and a new device is bonded.
    // Alternative is pairing succeeds but bonding fails, unless application has
    // manually erased at least one bond.
    uint8_t replaceBonds = TRUE;

    GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);
    GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);
    GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);
    GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);
    GAPBondMgr_SetParameter(GAPBOND_LRU_BOND_REPLACEMENT, sizeof(uint8_t), &replaceBonds);
    }
    Things we did to enable bonding at slave:
    {
    // Don't send a pairing request after connecting; the peer device must
    // initiate pairing
    uint8_t pairMode = GAPBOND_PAIRING_MODE_WAIT_FOR_REQ;
    // Use authenticated pairing: require passcode.
    uint8_t mitm = TRUE;
    // This device only has display capabilities. Therefore, it will display the
    // passcode during pairing. However, since the default passcode is being
    // used, there is no need to display anything.
    uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_YES_NO;
    // Request bonding (storing long-term keys for re-encryption upon subsequent
    // connections without repairing)
    uint8_t bonding = TRUE;

    GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);
    GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);
    GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);
    GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);
    }

    We tried both of those, but we couldn't see raw data. Then we sniffed connections and we saw empty PDU s are coming from slave to master as expected. But passive can't see this and don't give us results. Sniffed data is here

    withoutPairing.zip

    Are the changes we did correct? If yes, why we cant get the raw data? And what we should do to get raw data?

    Thanks.

  • Hi there,

    Please do not make multiple threads as it in fact slows our ability to answer threads appropriately. Currently we are working hard on an update to for RTLS for the new SDK and are doing our best to support both E2E and the SDK release.

    As a note, Sean's comment was to do either one of the two. Either enable bonding and in subsequent connnections everything will be fine OR disable pairing and it should be fine.

    Please also make sure when you run the python file, use unbuffered cmd calls i.e. "py -u example.py"

  • Thanks for the reply. Without enabling bonding or disabling pairing system is working fine. Then I enabled bonding and run it again, slave gave "Bonding saved" message after pairing, also it gave the raw data. Then I terminate the link and rerun it, slave said "Bonding success" but it doesn't give us raw data. I tried many times and I saw same thing always. What should I do?

  • Hello,

    This is likely because the rtls_master currently doesn't support bonding and thus it isn't the L2CAP connection oriented channel (CoC) between master and slave which is used to comunicate AOA start.

    Please see: RTLSMaster_processPairState().

    I would add handlers for GAPBOND_PAIRING_STATE_BONDED and GAPBOND_PAIRING_STATE_BOND_SAVED to open the CoC using RTLSMaster_openL2CAPChanCoc() and inform of connection using RTLSCtrl_connResultEvt().

    You can essentially copy the logic that is already there for GAPBOND_PAIRING_STATE_COMPLETE
  • That resolved everything, thank you so much, we can also get data without pairing. Reason of duplicate question is that sometimes reply time takes too long and I don't know if you have a reply or not, please put a little comment under the question that says "we saw that, don't worry" then I won't ask a new question. Also when TI mark it as resolved, and it doesn't solve my question then I ask a new question under that question. Most of the community members don't look at it because they think its resolved. Anyways thank you.