CC2642R: Scan results data mixed up when running AoA demo SDK 6.20.0029

Part Number: CC2642R
Other Parts Discussed in Thread: SYSCONFIG

Hi,

Background:

rtls_responder_CC26X2R1_LAUNCHXL_tirtos7_ticlang

rtls_coordinator_CC26X2R1_LAUNCHXL_tirtos7_ticlang

SDK 6.20.00.29

Modified projects to embed MAC address inside adv data (inside GAP_DEVICE_INIT_DONE_EVENT), as such:

// AiRISTA added
advertData[19] = pPkt->devAddr[0];
advertData[20] = pPkt->devAddr[1];
advertData[21] = pPkt->devAddr[2];
advertData[22] = pPkt->devAddr[3];
advertData[23] = pPkt->devAddr[4];
advertData[24] = pPkt->devAddr[5];

The problem - inside RC_EVT_ADV_REPORT event handler, when we check to make sure the MAC address reported from the stack matches the corresponding bytes inside the ADV data, we do get occasional discrepancies where BLE stack reported MAC is NOT the same as the MAC inside the adv data. We checking the last 3 of the mac because the first three bytes are never changing for our devices, and we can see the line below printing occasionally...

case RC_EVT_ADV_REPORT:
{
    GapScan_Evt_AdvRpt_t* pAdvRpt = (GapScan_Evt_AdvRpt_t*) (pMsg->pData);
    uint8_t status;

    if (pAdvRpt->addr[2] != pAdvRpt->pData[21] || pAdvRpt->addr[1] != pAdvRpt->pData[20] || pAdvRpt->addr[0] != pAdvRpt->pData[19])
        AiRISTA_DEBUG_SendDataToBackend_String("*** MISMATCH1 ***");

LOGS:

You can see the occasional "MISMATCH1" prints when MACs do not match.

At  this point we have two tags advertising with primary adv interval of 100msec and periodic adv interval of 100 msec also, At this point the coordinator has synced to both tags and it is also receiving IQ samples. Our concern is if Adv Data is getting mixed up with the actual source BLE mac, is it possible this to cause the IQ samples to be mixed up between the two tags? if this is happening then obviously the angles will be wrong when calculated

Last 3 of the MACs are:

29c2 80 and 12 12 12

Lines where things are normal look like this (notice "29c280,29c280" - mac from BLE vs mac from adv data - SAME)

"2023-01-04 00:23:24:314",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,26,0,0,1,87

Lines that are mismatched (Notice "29c280,121212" - BLE MAC is 29c280 and MAC from adv data is: 121212)

2023-01-04 00:23:24:515",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-68,213,0,0,1,87

here is the code that prints these lines to help you make sense of what are we looking at:

char id_rx[12];
char id_tx[12];
char ble_tx[7];
char ble_tx_adv[7];
char interval[7];
char rssi[5];

itoa(AIRISTA_LOC_ID, id_rx,10);
itoa(((pAdvRpt->addr[2]<<16) + (pAdvRpt->addr[1]<<8) + pAdvRpt->addr[0]), id_tx, 10);
itoa(((pAdvRpt->addr[2]<<16) + (pAdvRpt->addr[1]<<8) + pAdvRpt->addr[0]), ble_tx, 16);//THIS IS MAC FROM BLE STACK
itoa(((pAdvRpt->pData[21]<<16) + (pAdvRpt->pData[20]<<8) + pAdvRpt->pData[19]), ble_tx_adv, 16); //THIS IS MAC FROM Adv Data
itoa(pAdvRpt->periodicAdvInt,interval,10);
itoa(pAdvRpt->rssi,rssi,10);

//2022/09/26 - change the @ to $ sign before AdvRpt
//strcpy(buffer, "@AdvRpt,");

strcpy(buffer, "$AdvRpt,");
strcat(buffer,id_rx);
strcat(buffer, ",");
strcat(buffer, id_tx);
strcat(buffer, ",");
strcat(buffer, ble_tx);
strcat(buffer, ",");
strcat(buffer, ble_tx_adv);
strcat(buffer, ",");
strcat(buffer, interval);
strcat(buffer, ",");
strcat(buffer, rssi);
strcat(buffer, ",");


2063.log.txt
Line   663923: "2023-01-04 00:22:52:647",$AdvRpt,2981883,1184274,121212,121212,80,-67,169,0,0,1,87
Line   663937: "2023-01-04 00:22:53:503",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,246,0,0,1,87
Line   663945: "2023-01-04 00:22:53:988",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-46,251,0,0,1,87
Line   663953: "2023-01-04 00:22:54:373",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-54,185,0,0,1,87
Line   663955: "2023-01-04 00:22:54:436",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,255,0,0,1,87
Line   663965: "2023-01-04 00:22:54:853",$AdvRpt,2981883,2736768,29c280,29c280,80,-49,3,0,0,1,87
Line   663973: "2023-01-04 00:22:55:222",$AdvRpt,2981883,1184274,121212,121212,80,-56,190,0,0,1,87
Line   663981: "2023-01-04 00:22:55:706",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,11,0,0,1,87
Line   663983: "2023-01-04 00:22:55:738",$AdvRpt,2981883,1184274,121212,121212,80,-60,197,0,0,1,87
Line   663989: "2023-01-04 00:22:55:922",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,13,0,0,1,87
Line   663991: "2023-01-04 00:22:55:954",$AdvRpt,2981883,1184274,121212,121212,80,-60,199,0,0,1,87
Line   664005: "2023-01-04 00:22:56:776",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-46,18,0,0,1,87
Line   664007: "2023-01-04 00:22:56:776",$AdvRpt,2981883,1184274,121212,121212,80,-67,207,0,0,1,87
Line   664009: "2023-01-04 00:22:56:870",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,22,0,0,1,87
Line   664015: "2023-01-04 00:22:57:076",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,24,0,0,1,87
Line   664027: "2023-01-04 00:22:57:856",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-67,217,0,0,1,87
Line   664035: "2023-01-04 00:22:58:146",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,34,0,0,1,87
Line   664043: "2023-01-04 00:22:58:542",$AdvRpt,2981883,2736768,29c280,29c280,80,-48,38,0,0,1,87
Line   664045: "2023-01-04 00:22:58:579",$AdvRpt,2981883,1184274,121212,121212,80,-54,224,0,0,1,87
Line   664053: "2023-01-04 00:22:59:059",$AdvRpt,2981883,2736768,29c280,29c280,80,-49,43,0,0,1,87
Line   664059: "2023-01-04 00:22:59:228",$AdvRpt,2981883,1184274,121212,121212,80,-60,230,0,0,1,87
Line   664067: "2023-01-04 00:22:59:682",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,49,0,0,1,87
Line   664075: "2023-01-04 00:23:00:150",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-62,239,0,0,1,87
Line   664085: "2023-01-04 00:23:00:684",$AdvRpt,2981883,1184274,121212,121212,80,-67,244,0,0,1,87
Line   664093: "2023-01-04 00:23:01:116",$AdvRpt,2981883,1184274,121212,121212,80,-69,248,0,0,1,87
Line   664095: "2023-01-04 00:23:01:163",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,63,0,0,1,87
Line   664103: "2023-01-04 00:23:01:463",$AdvRpt,2981883,1184274,121212,121212,80,-70,251,0,0,1,87
Line   664111: "2023-01-04 00:23:01:848",$AdvRpt,2981883,1184274,121212,121212,80,-55,255,0,0,1,87
Line   664119: "2023-01-04 00:23:02:302",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,74,0,0,1,87
Line   664131: "2023-01-04 00:23:03:019",$AdvRpt,2981883,1184274,121212,121212,80,-59,10,0,0,1,87
Line   664139: "2023-01-04 00:23:03:467",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-47,85,0,0,1,87
Line   664145: "2023-01-04 00:23:03:636",$AdvRpt,2981883,1184274,121212,121212,80,-59,16,0,0,1,87
Line   664147: "2023-01-04 00:23:03:667",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,87,0,0,1,87
Line   664161: "2023-01-04 00:23:04:522",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-46,94,0,0,1,87
Line   664167: "2023-01-04 00:23:04:722",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,96,0,0,1,87
Line   664175: "2023-01-04 00:23:05:207",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-69,30,0,0,1,87
Line   664183: "2023-01-04 00:23:05:640",$AdvRpt,2981883,1184274,121212,121212,80,-68,34,0,0,1,87
Line   664189: "2023-01-04 00:23:05:824",$AdvRpt,2981883,1184274,121212,121212,80,-55,36,0,0,1,87
Line   664191: "2023-01-04 00:23:05:893",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,107,0,0,1,87
Line   664199: "2023-01-04 00:23:06:357",$AdvRpt,2981883,1184274,121212,121212,80,-54,41,0,0,1,87
Line   664201: "2023-01-04 00:23:06:425",$AdvRpt,2981883,2736768,29c280,29c280,80,-48,112,0,0,1,87
Line   664209: "2023-01-04 00:23:06:842",$AdvRpt,2981883,2736768,29c280,29c280,80,-49,116,0,0,1,87
Line   664217: "2023-01-04 00:23:07:111",$AdvRpt,2981883,1184274,121212,121212,80,-57,46,0,0,1,87
Line   664225: "2023-01-04 00:23:07:558",$AdvRpt,2981883,1184274,121212,121212,80,-60,49,0,0,1,87
Line   664227: "2023-01-04 00:23:07:596",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,123,0,0,1,87
Line   664229: "2023-01-04 00:23:07:627",$AdvRpt,2981883,1184274,121212,121212,80,-60,53,0,0,1,87
Line   664237: "2023-01-04 00:23:08:028",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-61,57,0,0,1,87
Line   664245: "2023-01-04 00:23:08:445",$AdvRpt,2981883,1184274,121212,121212,80,-67,61,0,0,1,87
Line   664253: "2023-01-04 00:23:08:946",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,136,0,0,1,87
Line   664259: "2023-01-04 00:23:09:178",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-46,138,0,0,1,87
Line   664267: "2023-01-04 00:23:09:594",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-67,72,0,0,1,87
Line   664275: "2023-01-04 00:23:10:017",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-46,146,0,0,1,87
Line   664287: "2023-01-04 00:23:10:650",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-49,152,0,0,1,87
Line   664295: "2023-01-04 00:23:11:152",$AdvRpt,2981883,1184274,121212,121212,80,-60,87,0,0,1,87
Line   664301: "2023-01-04 00:23:11:352",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,159,0,0,1,87
Line   664309: "2023-01-04 00:23:11:769",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,163,0,0,1,87
Line   664321: "2023-01-04 00:23:12:401",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-67,99,0,0,1,87
Line   664339: "2023-01-04 00:23:13:508",$AdvRpt,2981883,1184274,121212,121212,80,-68,108,0,0,1,87
Line   664341: "2023-01-04 00:23:13:571",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,180,0,0,1,87
Line   664349: "2023-01-04 00:23:13:925",$AdvRpt,2981883,1184274,121212,121212,80,-55,110,0,0,1,87
Line   664357: "2023-01-04 00:23:14:411",$AdvRpt,2981883,2736768,29c280,29c280,80,-49,188,0,0,1,87
Line   664359: "2023-01-04 00:23:14:411",$AdvRpt,2981883,1184274,121212,121212,80,-55,118,0,0,1,87
Line   664365: "2023-01-04 00:23:14:628",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-57,120,0,0,1,87
Line   664367: "2023-01-04 00:23:14:628",$AdvRpt,2981883,2736768,29c280,29c280,80,-49,190,0,0,1,87
Line   664375: "2023-01-04 00:23:15:092",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-60,124,0,0,1,87
Line   664383: "2023-01-04 00:23:15:562",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,199,0,0,1,87
Line   664389: "2023-01-04 00:23:15:762",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,201,0,0,1,87
Line   664391: "2023-01-04 00:23:15:762",$AdvRpt,2981883,1184274,121212,121212,80,-62,131,0,0,1,87
Line   664399: "2023-01-04 00:23:16:194",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,205,0,0,1,87
Line   664407: "2023-01-04 00:23:16:579",$AdvRpt,2981883,1184274,121212,121212,80,-67,135,0,0,1,87
Line   664409: "2023-01-04 00:23:16:611",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,209,0,0,1,87
Line   664411: "2023-01-04 00:23:16:633",$AdvRpt,2981883,1184274,121212,121212,80,-68,139,0,0,1,87
Line   664417: "2023-01-04 00:23:16:817",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,211,0,0,1,87
Line   664425: "2023-01-04 00:23:17:250",$AdvRpt,2981883,1184274,121212,121212,80,-68,145,0,0,1,87
Line   664433: "2023-01-04 00:23:17:751",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,220,0,0,1,87
Line   664439: "2023-01-04 00:23:17:951",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-48,222,0,0,1,87
Line   664447: "2023-01-04 00:23:18:368",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-49,226,0,0,1,87
Line   664455: "2023-01-04 00:23:18:785",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-50,230,0,0,1,87
Line   664457: "2023-01-04 00:23:18:785",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-60,160,0,0,1,87
Line   664463: "2023-01-04 00:23:19:001",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,232,0,0,1,87
Line   664465: "2023-01-04 00:23:19:001",$AdvRpt,2981883,1184274,121212,121212,80,-60,162,0,0,1,87
Line   664483: "2023-01-04 00:23:20:086",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,241,0,0,1,87
Line   664491: "2023-01-04 00:23:20:619",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,247,0,0,1,87
Line   664499: "2023-01-04 00:23:21:021",$AdvRpt,2981883,1184274,121212,121212,80,-70,181,0,0,1,87
Line   664505: "2023-01-04 00:23:21:221",$AdvRpt,2981883,1184274,121212,121212,80,-67,183,0,0,1,87
Line   664507: "2023-01-04 00:23:21:244",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,253,0,0,1,87
Line   664515: "2023-01-04 00:23:21:661",$AdvRpt,2981883,2736768,29c280,29c280,80,-50,1,0,0,1,87
Line   664523: "2023-01-04 00:23:22:093",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-50,5,0,0,1,87
Line   664531: "2023-01-04 00:23:22:579",$AdvRpt,2981883,1184274,121212,121212,80,-60,196,0,0,1,87
Line   664539: "2023-01-04 00:23:22:995",$AdvRpt,2981883,1184274,121212,121212,80,-59,200,0,0,1,87
Line   664549: "2023-01-04 00:23:23:396",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,14,0,0,1,87
Line   664551: "2023-01-04 00:23:23:396",$AdvRpt,2981883,1184274,121212,121212,80,-61,204,0,0,1,87
Line   664559: "2023-01-04 00:23:23:866",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-65,208,0,0,1,87
Line   664567: "2023-01-04 00:23:24:314",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,26,0,0,1,87
Line   664573: "2023-01-04 00:23:24:515",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-68,213,0,0,1,87
Line   664575: "2023-01-04 00:23:24:537",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,28,0,0,1,87
Line   664577: "2023-01-04 00:23:24:569",$AdvRpt,2981883,1184274,121212,121212,80,-70,215,0,0,1,87
Line   664585: "2023-01-04 00:23:24:985",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-68,219,0,0,1,87
Line   664593: "2023-01-04 00:23:25:370",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,36,0,0,1,87
Line   664595: "2023-01-04 00:23:25:417",$AdvRpt,2981883,1184274,121212,121212,80,-55,222,0,0,1,87
Line   664605: "2023-01-04 00:23:25:939",$AdvRpt,2981883,1184274,121212,121212,80,-54,227,0,0,1,87
Line   664607: "2023-01-04 00:23:26:017",$AdvRpt,2981883,2736768,29c280,29c280,80,-48,42,0,0,1,87
Line   664615: "2023-01-04 00:23:26:433",$AdvRpt,2981883,2736768,29c280,29c280,80,-49,46,0,0,1,87
Line   664617: "2023-01-04 00:23:26:433",$AdvRpt,2981883,1184274,121212,121212,80,-58,232,0,0,1,87
Line   664625: "2023-01-04 00:23:26:772",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-60,235,0,0,1,87
Line   664633: "2023-01-04 00:23:27:173",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,53,0,0,1,87
Line   664635: "2023-01-04 00:23:27:204",$AdvRpt,2981883,1184274,121212,121212,80,-60,239,0,0,1,87
Line   664647: "2023-01-04 00:23:27:807",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,59,0,0,1,87
Line   664655: "2023-01-04 00:23:28:246",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-46,63,0,0,1,87
Line   664667: "2023-01-04 00:23:28:910",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-70,254,0,0,1,87
Line   664675: "2023-01-04 00:23:29:380",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-46,74,0,0,1,87
Line   664677: "2023-01-04 00:23:29:411",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-55,4,0,0,1,87
Line   664685: "2023-01-04 00:23:29:897",$AdvRpt,2981883,2736768,29c280,29c280,80,-48,79,0,0,1,87
Line   664687: "2023-01-04 00:23:29:897",$AdvRpt,2981883,1184274,121212,121212,80,-55,9,0,0,1,87
Line   664695: "2023-01-04 00:23:30:252",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-57,12,0,0,1,87
Line   664711: "2023-01-04 00:23:31:116",$AdvRpt,2981883,1184274,121212,121212,80,-60,17,0,0,1,87
Line   664713: "2023-01-04 00:23:31:170",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-60,21,0,0,1,87
Line   664721: "2023-01-04 00:23:31:586",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,95,0,0,1,87
Line   664739: "2023-01-04 00:23:32:720",$AdvRpt,2981883,1184274,121212,121212,80,-70,36,0,0,1,87
Line   664747: "2023-01-04 00:23:33:158",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-46,110,0,0,1,87
Line   664753: "2023-01-04 00:23:33:352",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-54,42,0,0,1,87
Line   664755: "2023-01-04 00:23:33:390",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-47,112,0,0,1,87
Line   664763: "2023-01-04 00:23:33:807",$AdvRpt,2981883,2736768,29c280,29c280,80,-48,116,0,0,1,87
Line   664771: "2023-01-04 00:23:34:224",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-49,120,0,0,1,87
Line   664777: "2023-01-04 00:23:34:409",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-48,122,0,0,1,87
Line   664785: "2023-01-04 00:23:34:980",$AdvRpt,2981883,2736768,29c280,29c280,80,-47,127,0,0,1,87
Line   664787: "2023-01-04 00:23:35:027",$AdvRpt,2981883,1184274,121212,121212,80,-60,57,0,0,1,87
Line   664795: "2023-01-04 00:23:35:397",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,131,0,0,1,87
Line   664797: "2023-01-04 00:23:35:428",$AdvRpt,2981883,1184274,121212,121212,80,-62,61,0,0,1,87
Line   664805: "2023-01-04 00:23:35:898",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-46,136,0,0,1,87
Line   664813: "2023-01-04 00:23:36:268",$AdvRpt,2981883,1184274,121212,121212,80,-69,69,0,0,1,87
Line   664821: "2023-01-04 00:23:36:647",$AdvRpt,2981883,2736768,29c280,29c280,80,-45,143,0,0,1,87
Line   664829: "2023-01-04 00:23:37:064",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-46,147,0,0,1,87
Line   664831: "2023-01-04 00:23:37:117",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-55,77,0,0,1,87
Line   664839: "2023-01-04 00:23:37:470",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-47,151,0,0,1,87
Line   664845: "2023-01-04 00:23:37:687",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-48,153,0,0,1,87
Line   664847: "2023-01-04 00:23:37:771",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-55,83,0,0,1,87
Line   664861: "2023-01-04 00:23:38:636",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-47,162,0,0,1,87
Line   664867: "2023-01-04 00:23:38:836",*** MISMATCH1 ***$AdvRpt,2981883,1184274,121212,29c280,80,-47,164,0,0,1,87
Line   664875: "2023-01-04 00:23:39:236",*** MISMATCH1 ***$AdvRpt,2981883,2736768,29c280,121212,80,-61,97,0,0,1,87
Line   664877: "2023-01-04 00:23:39:236",$AdvRpt,2981883,2736768,29c280,29c280,80,-46,168,0,0,1,87
Line   664889: "2023-01-04 00:23:39:921",$AdvRpt,2981883,1184274,121212,121212,80,-67,102,0,0,1,87
Line   664891: "2023-01-04 00:23:39:975",$AdvRpt,2981883,1184274,121212,121212,80,-68,104,0,0,1,87

  • In the meantime, tried removing the syncing from the coordinator and also removed the periodic adv on the responder side and still can see the behavior:

  • If I make responder to advertise legacy type:

    /// Default parameters for legacy, scannable, connectable advertising
    #define GAPADV_PARAMS_LEGACY_SCANN_CONN {                                 \
     .eventProps = GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_SCANNABLE |        \
                   GAP_ADV_PROP_LEGACY,                                       \
     .primIntMin = 160,                                                       \
     .primIntMax = 160,                                                       \
     .primChanMap = GAP_ADV_CHAN_ALL,                                         \
     .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID,                       \
     .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },                      \
     .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ,                               \
     .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE,                               \
     .primPhy = GAP_ADV_PRIM_PHY_1_MBPS,                                      \
     .secPhy = GAP_ADV_SEC_PHY_1_MBPS,                                        \
     .sid = 0                                                                 \
    }

    and also modify the coordinator to scan for legacy only:

    temp16 = SCAN_FLT_PDU_LEGACY_ONLY | SCAN_FLT_PDU_COMPLETE_ONLY;
    GapScan_setParam(SCAN_PARAM_FLT_PDU_TYPE, &temp16);

    I have not gotten any MISMATCH prints for over 10 mins now:

    It is clear, the mix up of physical BLE MAC vs actual adv data is only happening when adv type is extended adv.

    Please advise if you can replicate this case and possible fix for it.

    log_legacy.txt
    2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-58,211,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-64,212,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,2736768,29c280,29c280,0,-61,43,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-61,213,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,2736768,29c280,29c280,0,-56,44,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-55,214,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,2736768,29c280,29c280,0,-67,45,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-64,215,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,2736768,29c280,29c280,0,-56,47,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-55,217,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-61,218,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-60,219,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-54,220,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,51,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-60,222,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-54,223,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,54,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-61,224,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,2736768,29c280,29c280,0,-62,55,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-60,225,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,56,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-54,226,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,57,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,58,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:340",$AdvRpt,2981883,1184274,121212,121212,0,-60,228,0,0,1,87
    "2023-01-04 12:11:41:340",#
    "2023-01-04 12:11:41:355",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,59,0,0,1,87
    "2023-01-04 12:11:41:355",#
    "2023-01-04 12:11:41:509",$AdvRpt,2981883,1184274,121212,121212,0,-61,230,0,0,1,87
    "2023-01-04 12:11:41:509",#
    "2023-01-04 12:11:41:556",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,61,0,0,1,87
    "2023-01-04 12:11:41:556",#
    "2023-01-04 12:11:41:725",$AdvRpt,2981883,1184274,121212,121212,0,-60,232,0,0,1,87
    "2023-01-04 12:11:41:725",#
    "2023-01-04 12:11:41:772",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,63,0,0,1,87
    "2023-01-04 12:11:41:772",#
    "2023-01-04 12:11:41:941",$AdvRpt,2981883,1184274,121212,121212,0,-61,234,0,0,1,87
    "2023-01-04 12:11:41:941",#
    "2023-01-04 12:11:41:988",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,65,0,0,1,87
    "2023-01-04 12:11:41:988",#
    "2023-01-04 12:11:42:041",$AdvRpt,2981883,1184274,121212,121212,0,-60,235,0,0,1,87
    "2023-01-04 12:11:42:041",#
    "2023-01-04 12:11:42:072",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,66,0,0,1,87
    "2023-01-04 12:11:42:072",#
    "2023-01-04 12:11:42:125",$AdvRpt,2981883,1184274,121212,121212,0,-54,236,0,0,1,87
    "2023-01-04 12:11:42:125",#
    "2023-01-04 12:11:42:172",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,67,0,0,1,87
    "2023-01-04 12:11:42:172",#
    "2023-01-04 12:11:42:294",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,68,0,0,1,87
    "2023-01-04 12:11:42:294",#
    "2023-01-04 12:11:42:341",$AdvRpt,2981883,1184274,121212,121212,0,-60,238,0,0,1,87
    "2023-01-04 12:11:42:341",#
    "2023-01-04 12:11:42:394",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,69,0,0,1,87
    "2023-01-04 12:11:42:394",#
    "2023-01-04 12:11:42:441",$AdvRpt,2981883,1184274,121212,121212,0,-54,239,0,0,1,87
    "2023-01-04 12:11:42:441",#
    "2023-01-04 12:11:42:509",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,70,0,0,1,87
    "2023-01-04 12:11:42:509",#
    "2023-01-04 12:11:42:559",$AdvRpt,2981883,1184274,121212,121212,0,-61,240,0,0,1,87
    "2023-01-04 12:11:42:559",#
    "2023-01-04 12:11:42:658",$AdvRpt,2981883,1184274,121212,121212,0,-60,241,0,0,1,87
    "2023-01-04 12:11:42:658",#
    "2023-01-04 12:11:42:724",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,72,0,0,1,87
    "2023-01-04 12:11:42:724",#
    "2023-01-04 12:11:42:757",$AdvRpt,2981883,1184274,121212,121212,0,-54,242,0,0,1,87
    "2023-01-04 12:11:42:757",#
    "2023-01-04 12:11:42:811",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,73,0,0,1,87
    "2023-01-04 12:11:42:811",#
    "2023-01-04 12:11:42:864",$AdvRpt,2981883,1184274,121212,121212,0,-61,243,0,0,1,87
    "2023-01-04 12:11:42:864",#
    "2023-01-04 12:11:42:927",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,74,0,0,1,87
    "2023-01-04 12:11:42:927",#
    "2023-01-04 12:11:42:973",$AdvRpt,2981883,1184274,121212,121212,0,-60,244,0,0,1,87
    "2023-01-04 12:11:42:973",#
    "2023-01-04 12:11:43:027",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,75,0,0,1,87
    "2023-01-04 12:11:43:027",#
    "2023-01-04 12:11:43:074",$AdvRpt,2981883,1184274,121212,121212,0,-54,245,0,0,1,87
    "2023-01-04 12:11:43:074",#
    "2023-01-04 12:11:43:189",$AdvRpt,2981883,1184274,121212,121212,0,-61,246,0,0,1,87
    "2023-01-04 12:11:43:189",#
    "2023-01-04 12:11:43:290",$AdvRpt,2981883,1184274,121212,121212,0,-60,247,0,0,1,87
    "2023-01-04 12:11:43:290",#
    "2023-01-04 12:11:43:327",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,78,0,0,1,87
    "2023-01-04 12:11:43:327",#
    "2023-01-04 12:11:43:396",$AdvRpt,2981883,1184274,121212,121212,0,-54,248,0,0,1,87
    "2023-01-04 12:11:43:396",#
    "2023-01-04 12:11:43:496",$AdvRpt,2981883,1184274,121212,121212,0,-61,249,0,0,1,87
    "2023-01-04 12:11:43:496",#
    "2023-01-04 12:11:43:543",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,80,0,0,1,87
    "2023-01-04 12:11:43:543",#
    "2023-01-04 12:11:43:643",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,81,0,0,1,87
    "2023-01-04 12:11:43:643",#
    "2023-01-04 12:11:43:759",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,82,0,0,1,87
    "2023-01-04 12:11:43:759",#
    "2023-01-04 12:11:43:812",$AdvRpt,2981883,1184274,121212,121212,0,-54,252,0,0,1,87
    "2023-01-04 12:11:43:812",#
    "2023-01-04 12:11:43:859",$AdvRpt,2981883,2736768,29c280,29c280,0,-64,83,0,0,1,87
    "2023-01-04 12:11:43:859",#
    "2023-01-04 12:11:43:914",$AdvRpt,2981883,1184274,121212,121212,0,-61,253,0,0,1,87
    "2023-01-04 12:11:43:914",#
    "2023-01-04 12:11:43:961",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,84,0,0,1,87
    "2023-01-04 12:11:43:961",#
    "2023-01-04 12:11:44:029",$AdvRpt,2981883,1184274,121212,121212,0,-60,254,0,0,1,87
    "2023-01-04 12:11:44:029",#
    "2023-01-04 12:11:44:060",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,85,0,0,1,87
    "2023-01-04 12:11:44:060",#
    "2023-01-04 12:11:44:134",$AdvRpt,2981883,1184274,121212,121212,0,-54,255,0,0,1,87
    "2023-01-04 12:11:44:134",#
    "2023-01-04 12:11:44:169",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,86,0,0,1,87
    "2023-01-04 12:11:44:169",#
    "2023-01-04 12:11:44:243",$AdvRpt,2981883,1184274,121212,121212,0,-61,0,0,0,1,87
    "2023-01-04 12:11:44:243",#
    "2023-01-04 12:11:44:243",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,87,0,0,1,87
    "2023-01-04 12:11:44:274",#
    "2023-01-04 12:11:44:359",$AdvRpt,2981883,1184274,121212,121212,0,-60,1,0,0,1,87
    "2023-01-04 12:11:44:359",#
    "2023-01-04 12:11:44:375",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,88,0,0,1,87
    "2023-01-04 12:11:44:375",#
    "2023-01-04 12:11:44:459",$AdvRpt,2981883,1184274,121212,121212,0,-54,2,0,0,1,87
    "2023-01-04 12:11:44:459",#
    "2023-01-04 12:11:44:559",$AdvRpt,2981883,1184274,121212,121212,0,-61,3,0,0,1,87
    "2023-01-04 12:11:44:559",#
    "2023-01-04 12:11:44:659",$AdvRpt,2981883,1184274,121212,121212,0,-60,4,0,0,1,87
    "2023-01-04 12:11:44:659",#
    "2023-01-04 12:11:44:776",$AdvRpt,2981883,1184274,121212,121212,0,-54,5,0,0,1,87
    "2023-01-04 12:11:44:776",#
    "2023-01-04 12:11:44:798",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,92,0,0,1,87
    "2023-01-04 12:11:44:798",#
    "2023-01-04 12:11:44:983",$AdvRpt,2981883,1184274,121212,121212,0,-60,7,0,0,1,87
    "2023-01-04 12:11:44:983",#
    "2023-01-04 12:11:45:019",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,94,0,0,1,87
    "2023-01-04 12:11:45:019",#
    "2023-01-04 12:11:45:080",$AdvRpt,2981883,1184274,121212,121212,0,-54,8,0,0,1,87
    "2023-01-04 12:11:45:080",#
    "2023-01-04 12:11:45:114",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,95,0,0,1,87
    "2023-01-04 12:11:45:114",#
    "2023-01-04 12:11:45:234",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,96,0,0,1,87
    "2023-01-04 12:11:45:234",#
    "2023-01-04 12:11:45:299",$AdvRpt,2981883,1184274,121212,121212,0,-60,10,0,0,1,87
    "2023-01-04 12:11:45:299",#
    "2023-01-04 12:11:45:393",$AdvRpt,2981883,1184274,121212,121212,0,-54,11,0,0,1,87
    "2023-01-04 12:11:45:393",#
    "2023-01-04 12:11:45:430",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,98,0,0,1,87
    "2023-01-04 12:11:45:430",#
    "2023-01-04 12:11:45:493",$AdvRpt,2981883,1184274,121212,121212,0,-61,12,0,0,1,87
    "2023-01-04 12:11:45:499",#
    "2023-01-04 12:11:45:531",$AdvRpt,2981883,2736768,29c280,29c280,0,-62,99,0,0,1,87
    "2023-01-04 12:11:45:531",#
    "2023-01-04 12:11:45:615",$AdvRpt,2981883,1184274,121212,121212,0,-60,13,0,0,1,87
    "2023-01-04 12:11:45:615",#
    "2023-01-04 12:11:45:647",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,100,0,0,1,87
    "2023-01-04 12:11:45:647",#
    "2023-01-04 12:11:45:716",$AdvRpt,2981883,1184274,121212,121212,0,-54,14,0,0,1,87
    "2023-01-04 12:11:45:716",#
    "2023-01-04 12:11:45:747",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,101,0,0,1,87
    "2023-01-04 12:11:45:747",#
    "2023-01-04 12:11:45:816",$AdvRpt,2981883,1184274,121212,121212,0,-61,15,0,0,1,87
    "2023-01-04 12:11:45:816",#
    "2023-01-04 12:11:45:932",$AdvRpt,2981883,1184274,121212,121212,0,-61,16,0,0,1,87
    "2023-01-04 12:11:45:932",#
    "2023-01-04 12:11:45:963",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,103,0,0,1,87
    "2023-01-04 12:11:45:963",#
    "2023-01-04 12:11:46:032",$AdvRpt,2981883,1184274,121212,121212,0,-54,17,0,0,1,87
    "2023-01-04 12:11:46:032",#
    "2023-01-04 12:11:46:063",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,104,0,0,1,87
    "2023-01-04 12:11:46:063",#
    "2023-01-04 12:11:46:137",$AdvRpt,2981883,1184274,121212,121212,0,-62,18,0,0,1,87
    "2023-01-04 12:11:46:137",#
    "2023-01-04 12:11:46:184",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,105,0,0,1,87
    "2023-01-04 12:11:46:184",#
    "2023-01-04 12:11:46:280",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,106,0,0,1,87
    "2023-01-04 12:11:46:280",#
    "2023-01-04 12:11:46:380",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,107,0,0,1,87
    "2023-01-04 12:11:46:380",#
    "2023-01-04 12:11:46:453",$AdvRpt,2981883,1184274,121212,121212,0,-54,21,0,0,1,87
    "2023-01-04 12:11:46:453",#
    "2023-01-04 12:11:46:483",$AdvRpt,2981883,2736768,29c280,29c280,0,-62,108,0,0,1,87
    "2023-01-04 12:11:46:483",#
    "2023-01-04 12:11:46:549",$AdvRpt,2981883,1184274,121212,121212,0,-61,22,0,0,1,87
    "2023-01-04 12:11:46:549",#
    "2023-01-04 12:11:46:665",$AdvRpt,2981883,1184274,121212,121212,0,-60,23,0,0,1,87
    "2023-01-04 12:11:46:665",#
    "2023-01-04 12:11:46:697",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,110,0,0,1,87
    "2023-01-04 12:11:46:697",#
    "2023-01-04 12:11:46:766",$AdvRpt,2981883,1184274,121212,121212,0,-54,24,0,0,1,87
    "2023-01-04 12:11:46:766",#
    "2023-01-04 12:11:46:803",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,111,0,0,1,87
    "2023-01-04 12:11:46:803",#
    "2023-01-04 12:11:46:866",$AdvRpt,2981883,1184274,121212,121212,0,-60,25,0,0,1,87
    "2023-01-04 12:11:46:866",#
    "2023-01-04 12:11:46:920",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,112,0,0,1,87
    "2023-01-04 12:11:46:920",#
    "2023-01-04 12:11:46:982",$AdvRpt,2981883,1184274,121212,121212,0,-60,26,0,0,1,87
    "2023-01-04 12:11:46:982",#
    "2023-01-04 12:11:47:083",$AdvRpt,2981883,1184274,121212,121212,0,-54,27,0,0,1,87
    "2023-01-04 12:11:47:083",#
    "2023-01-04 12:11:47:221",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,115,0,0,1,87
    "2023-01-04 12:11:47:221",#
    "2023-01-04 12:11:47:306",$AdvRpt,2981883,1184274,121212,121212,0,-61,29,0,0,1,87
    "2023-01-04 12:11:47:306",#
    "2023-01-04 12:11:47:306",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,116,0,0,1,87
    "2023-01-04 12:11:47:337",#
    "2023-01-04 12:11:47:406",$AdvRpt,2981883,1184274,121212,121212,0,-54,30,0,0,1,87
    "2023-01-04 12:11:47:406",#
    "2023-01-04 12:11:47:406",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,117,0,0,1,87
    "2023-01-04 12:11:47:438",#
    "2023-01-04 12:11:47:522",$AdvRpt,2981883,1184274,121212,121212,0,-62,31,0,0,1,87
    "2023-01-04 12:11:47:522",#
    "2023-01-04 12:11:47:522",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,118,0,0,1,87
    "2023-01-04 12:11:47:553",#
    "2023-01-04 12:11:47:622",$AdvRpt,2981883,1184274,121212,121212,0,-61,32,0,0,1,87
    "2023-01-04 12:11:47:622",#
    "2023-01-04 12:11:47:622",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,119,0,0,1,87
    "2023-01-04 12:11:47:654",#
    "2023-01-04 12:11:47:722",$AdvRpt,2981883,1184274,121212,121212,0,-55,33,0,0,1,87
    "2023-01-04 12:11:47:722",#
    "2023-01-04 12:11:47:722",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,120,0,0,1,87
    "2023-01-04 12:11:47:753",#
    "2023-01-04 12:11:47:823",$AdvRpt,2981883,1184274,121212,121212,0,-62,34,0,0,1,87
    "2023-01-04 12:11:47:823",#
    "2023-01-04 12:11:47:823",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,121,0,0,1,87
    "2023-01-04 12:11:47:854",#
    "2023-01-04 12:11:47:938",$AdvRpt,2981883,1184274,121212,121212,0,-61,35,0,0,1,87
    "2023-01-04 12:11:47:938",#
    "2023-01-04 12:11:48:038",$AdvRpt,2981883,1184274,121212,121212,0,-55,36,0,0,1,87
    "2023-01-04 12:11:48:038",#
    "2023-01-04 12:11:48:038",$AdvRpt,2981883,2736768,29c280,29c280,0,-56,123,0,0,1,87
    "2023-01-04 12:11:48:054",#
    "2023-01-04 12:11:48:139",$AdvRpt,2981883,1184274,121212,121212,0,-62,37,0,0,1,87
    "2023-01-04 12:11:48:139",#
    "2023-01-04 12:11:48:139",$AdvRpt,2981883,2736768,29c280,29c280,0,-65,124,0,0,1,87
    "2023-01-04 12:11:48:169",#
    "2023-01-04 12:11:48:248",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,125,0,0,1,87
    "2023-01-04 12:11:48:248",#
    "2023-01-04 12:11:48:248",$AdvRpt,2981883,1184274,121212,121212,0,-61,38,0,0,1,87
    "2023-01-04 12:11:48:269",#
    "2023-01-04 12:11:48:339",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,126,0,0,1,87
    "2023-01-04 12:11:48:339",#
    "2023-01-04 12:11:48:339",$AdvRpt,2981883,1184274,121212,121212,0,-55,39,0,0,1,87
    "2023-01-04 12:11:48:371",#
    "2023-01-04 12:11:48:471",$AdvRpt,2981883,1184274,121212,121212,0,-62,40,0,0,1,87
    "2023-01-04 12:11:48:471",#
    "2023-01-04 12:11:48:556",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,128,0,0,1,87
    "2023-01-04 12:11:48:556",#
    "2023-01-04 12:11:48:556",$AdvRpt,2981883,1184274,121212,121212,0,-60,41,0,0,1,87
    "2023-01-04 12:11:48:587",#
    "2023-01-04 12:11:48:671",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,129,0,0,1,87
    "2023-01-04 12:11:48:671",#
    "2023-01-04 12:11:48:671",$AdvRpt,2981883,1184274,121212,121212,0,-55,42,0,0,1,87
    "2023-01-04 12:11:48:687",#
    "2023-01-04 12:11:48:772",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,130,0,0,1,87
    "2023-01-04 12:11:48:772",#
    "2023-01-04 12:11:48:772",$AdvRpt,2981883,1184274,121212,121212,0,-61,43,0,0,1,87
    "2023-01-04 12:11:48:787",#
    "2023-01-04 12:11:48:872",$AdvRpt,2981883,1184274,121212,121212,0,-61,44,0,0,1,87
    "2023-01-04 12:11:48:872",#
    "2023-01-04 12:11:48:872",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,131,0,0,1,87
    "2023-01-04 12:11:48:903",#
    "2023-01-04 12:11:49:009",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,132,0,0,1,87
    "2023-01-04 12:11:49:009",#
    "2023-01-04 12:11:49:088",$AdvRpt,2981883,1184274,121212,121212,0,-55,46,0,0,1,87
    "2023-01-04 12:11:49:088",#
    "2023-01-04 12:11:49:088",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,133,0,0,1,87
    "2023-01-04 12:11:49:110",#
    "2023-01-04 12:11:49:288",$AdvRpt,2981883,1184274,121212,121212,0,-60,48,0,0,1,87
    "2023-01-04 12:11:49:288",#
    "2023-01-04 12:11:49:288",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,135,0,0,1,87
    "2023-01-04 12:11:49:310",#
    "2023-01-04 12:11:49:389",$AdvRpt,2981883,1184274,121212,121212,0,-54,49,0,0,1,87
    "2023-01-04 12:11:49:389",#
    "2023-01-04 12:11:49:389",$AdvRpt,2981883,2736768,29c280,29c280,0,-56,136,0,0,1,87
    "2023-01-04 12:11:49:427",#
    "2023-01-04 12:11:49:510",$AdvRpt,2981883,1184274,121212,121212,0,-62,50,0,0,1,87
    "2023-01-04 12:11:49:510",#
    "2023-01-04 12:11:49:510",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,137,0,0,1,87
    "2023-01-04 12:11:49:526",#
    "2023-01-04 12:11:49:604",$AdvRpt,2981883,1184274,121212,121212,0,-61,51,0,0,1,87
    "2023-01-04 12:11:49:604",#
    "2023-01-04 12:11:49:604",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,138,0,0,1,87
    "2023-01-04 12:11:49:626",#
    "2023-01-04 12:11:49:726",$AdvRpt,2981883,1184274,121212,121212,0,-55,52,0,0,1,87
    "2023-01-04 12:11:49:726",#
    "2023-01-04 12:11:49:805",$AdvRpt,2981883,1184274,121212,121212,0,-61,53,0,0,1,87
    "2023-01-04 12:11:49:805",#
    "2023-01-04 12:11:49:805",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,140,0,0,1,87
    "2023-01-04 12:11:49:842",#
    "2023-01-04 12:11:50:027",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,142,0,0,1,87
    "2023-01-04 12:11:50:027",#
    "2023-01-04 12:11:50:027",$AdvRpt,2981883,1184274,121212,121212,0,-55,55,0,0,1,87
    "2023-01-04 12:11:50:058",#
    "2023-01-04 12:11:50:127",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,143,0,0,1,87
    "2023-01-04 12:11:50:127",#
    "2023-01-04 12:11:50:127",$AdvRpt,2981883,1184274,121212,121212,0,-61,56,0,0,1,87
    "2023-01-04 12:11:50:158",#
    "2023-01-04 12:11:50:243",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,144,0,0,1,87
    "2023-01-04 12:11:50:243",#
    "2023-01-04 12:11:50:243",$AdvRpt,2981883,1184274,121212,121212,0,-60,57,0,0,1,87
    "2023-01-04 12:11:50:274",#
    "2023-01-04 12:11:50:343",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,145,0,0,1,87
    "2023-01-04 12:11:50:343",#
    "2023-01-04 12:11:50:343",$AdvRpt,2981883,1184274,121212,121212,0,-54,58,0,0,1,87
    "2023-01-04 12:11:50:374",#
    "2023-01-04 12:11:50:460",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,146,0,0,1,87
    "2023-01-04 12:11:50:460",#
    "2023-01-04 12:11:50:460",$AdvRpt,2981883,1184274,121212,121212,0,-61,59,0,0,1,87
    "2023-01-04 12:11:50:479",#
    "2023-01-04 12:11:50:573",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,147,0,0,1,87
    "2023-01-04 12:11:50:573",#
    "2023-01-04 12:11:50:657",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,148,0,0,1,87
    "2023-01-04 12:11:50:657",#
    "2023-01-04 12:11:50:694",$AdvRpt,2981883,1184274,121212,121212,0,-54,61,0,0,1,87
    "2023-01-04 12:11:50:694",#
    "2023-01-04 12:11:50:794",$AdvRpt,2981883,1184274,121212,121212,0,-61,62,0,0,1,87
    "2023-01-04 12:11:50:794",#
    "2023-01-04 12:11:50:878",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,150,0,0,1,87
    "2023-01-04 12:11:50:878",#
    "2023-01-04 12:11:50:878",$AdvRpt,2981883,1184274,121212,121212,0,-60,63,0,0,1,87
    "2023-01-04 12:11:50:910",#
    "2023-01-04 12:11:51:010",$AdvRpt,2981883,1184274,121212,121212,0,-54,64,0,0,1,87
    "2023-01-04 12:11:51:010",#
    "2023-01-04 12:11:51:094",$AdvRpt,2981883,2736768,29c280,29c280,0,-63,152,0,0,1,87
    "2023-01-04 12:11:51:094",#
    "2023-01-04 12:11:51:094",$AdvRpt,2981883,1184274,121212,121212,0,-61,65,0,0,1,87
    "2023-01-04 12:11:51:125",#
    "2023-01-04 12:11:51:195",$AdvRpt,2981883,2736768,29c280,29c280,0,-59,153,0,0,1,87
    "2023-01-04 12:11:51:195",#
    "2023-01-04 12:11:51:226",$AdvRpt,2981883,1184274,121212,121212,0,-60,66,0,0,1,87
    "2023-01-04 12:11:51:226",#
    "2023-01-04 12:11:51:325",$AdvRpt,2981883,1184274,121212,121212,0,-55,67,0,0,1,87
    "2023-01-04 12:11:51:325",#
    "2023-01-04 12:11:51:442",$AdvRpt,2981883,1184274,121212,121212,0,-61,68,0,0,1,87
    "2023-01-04 12:11:51:442",#
    "2023-01-04 12:11:51:541",$AdvRpt,2981883,1184274,121212,121212,0,-60,69,0,0,1,87
    "2023-01-04 12:11:51:541",#
    "2023-01-04 12:11:51:642",$AdvRpt,2981883,1184274,121212,121212,0,-55,70,0,0,1,87
    "2023-01-04 12:11:51:642",#
    "2023-01-04 12:11:51:726",$AdvRpt,2981883,2736768,29c280,29c280,0,-56,158,0,0,1,87
    "2023-01-04 12:11:51:726",#
    "2023-01-04 12:11:51:726",$AdvRpt,2981883,1184274,121212,121212,0,-63,71,0,0,1,87
    "2023-01-04 12:11:51:758",#
    "2023-01-04 12:11:51:842",$AdvRpt,2981883,2736768,29c280,29c280,0,-64,159,0,0,1,87
    "2023-01-04 12:11:51:842",#
    "2023-01-04 12:11:51:874",$AdvRpt,2981883,1184274,121212,121212,0,-61,72,0,0,1,87
    "2023-01-04 12:11:51:874",#
    "2023-01-04 12:11:51:942",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,160,0,0,1,87
    "2023-01-04 12:11:51:942",#
    "2023-01-04 12:11:52:042",$AdvRpt,2981883,2736768,29c280,29c280,0,-56,161,0,0,1,87
    "2023-01-04 12:11:52:042",#
    "2023-01-04 12:11:52:147",$AdvRpt,2981883,2736768,29c280,29c280,0,-64,162,0,0,1,87
    "2023-01-04 12:11:52:147",#
    "2023-01-04 12:11:52:147",$AdvRpt,2981883,1184274,121212,121212,0,-63,75,0,0,1,87
    "2023-01-04 12:11:52:180",#
    "2023-01-04 12:11:52:258",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,163,0,0,1,87
    "2023-01-04 12:11:52:258",#
    "2023-01-04 12:11:52:294",$AdvRpt,2981883,1184274,121212,121212,0,-60,76,0,0,1,87
    "2023-01-04 12:11:52:294",#
    "2023-01-04 12:11:52:366",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,164,0,0,1,87
    "2023-01-04 12:11:52:366",#
    "2023-01-04 12:11:52:396",$AdvRpt,2981883,1184274,121212,121212,0,-54,77,0,0,1,87
    "2023-01-04 12:11:52:396",#
    "2023-01-04 12:11:52:496",$AdvRpt,2981883,1184274,121212,121212,0,-61,78,0,0,1,87
    "2023-01-04 12:11:52:496",#
    "2023-01-04 12:11:52:580",$AdvRpt,2981883,2736768,29c280,29c280,0,-60,166,0,0,1,87
    "2023-01-04 12:11:52:580",#
    "2023-01-04 12:11:52:596",$AdvRpt,2981883,1184274,121212,121212,0,-60,79,0,0,1,87
    "2023-01-04 12:11:52:596",#
    "2023-01-04 12:11:52:680",$AdvRpt,2981883,2736768,29c280,29c280,0,-55,167,0,0,1,87
    

  • Hey Ivan,

    Thanks for posting on e2e. I hope you don't mind, I reformatted your post to make it more readable. In the future, I would recommend making use of the code insertion tool as well as saving your log statements in a log.txt file and uploading them (both of which can be done using the Insert menu).

    I've assigned your post to my colleague who can help with your AoA question. He is currently on business travel so there may be a slight delay in his reply, I hope that is ok and truly appreciate your patience.

  • Ammar, Thanks for response!

    This is rather urgent for us.
    If any additional info is needed in order to replicate this case, please post a response and I will promptly follow up.
    I will be remote for next 2 weeks, I will have my colleagues monitor this thread and follow up when needed.

    I will look forward to TI responses - thanks for your support in advance!

    Ivan Slavov

  • Hi Ivan,

    To confirm, has the address mode been changed to something other than public address? How do you change the advertising data? Are you using the GapAdv_prepareLoadByBuffer() function? The Scanning and Advertising SLA lab provides some valuable information on how to modify the advertising data during runtime which may be helpful here.

    Best Regards,

    Jan

  • Hi Jan,

    We set the MAC address bytes into adv data byte array inside device init event, before enabling advertising. below is the initial function "RTLSResponder_advertInit" which is called inside "GAP_DEVICE_INIT_DONE_EVENT" handler in RTLSResponder_processGapMessage. we added the lines that basically copy the 6 bytes of the MAC given to the app from the "GAP_DEVICE_INIT_DONE_EVENT" params and set those inside the adv data - we then expect when the scanner detects these beacons, BLE MAC address from the "GapScan_Evt_AdvRpt_t" param inside RC_EVT_ADV_REPORT on the coordinator side to match with the 6 bytes inside the adv data that was just detected. And here is where we see the discrepancies....

    I hope  below is enough to answer your questions. please let me know if you need anything else.

    thanks,

    Ivan

    static void RTLSResponder_advertInit(gapDeviceInitDoneEvent_t *pPkt)
    {
      bStatus_t status = FAILURE;
    
      
    #ifdef USE_PERIODIC_ADV
      // Create non connectable & non scannable advertising set #3
    
        GapAdv_params_t advParamNonConn = GAPADV_PARAMS_AE_NC_NS;
    
      // AiRISTA added
      // shorten advertizing interval on the primary channel
      advParamNonConn.primIntMax = RR_NCNS_ADV_PRIM_INT_625US; // 2021.12.3
      advParamNonConn.primIntMin = RR_NCNS_ADV_PRIM_INT_625US;
      // end AiRISTA added
    
      // Create Advertisement set #3 and assign handle
      status = GapAdv_create(&RTLSResponder_advCb, &advParamNonConn,
                                                       &advHandleNCNS);
      RTLSRESPONDER_ASSERT(status == SUCCESS);
    
      // AiRISTA added
      advertData[20] = pPkt->devAddr[0];
      advertData[21] = pPkt->devAddr[1];
      advertData[22] = pPkt->devAddr[2];
      advertData[23] = pPkt->devAddr[3];
      advertData[24] = pPkt->devAddr[4];
      advertData[25] = pPkt->devAddr[5];
      // end AiRISTA added
    
      // Load advertising data for set #3 that is statically allocated by the app
      status = GapAdv_loadByHandle(advHandleNCNS, GAP_ADV_DATA_TYPE_ADV,
                                         sizeof(advertData), advertData);
      RTLSRESPONDER_ASSERT(status == SUCCESS);
    
      // Set event mask for set #3
      status = GapAdv_setEventMask(advHandleNCNS,
                                   GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
                                   GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
                                   GAP_ADV_EVT_MASK_SET_TERMINATED
                                   | GAP_ADV_EVT_MASK_END//(2022/09/23 - Ivan)
                                   );
    
      // Enable non connectable & non scannable advertising for set #3
    
      status = GapAdv_enable(advHandleNCNS, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0); 
    
      RTLSRESPONDER_ASSERT(status == SUCCESS);
    
      // Set Periodic Advertising parameters
      GapAdv_periodicAdvParams_t perParams = {PERIDIC_ADV_INTERVAL_MIN, PERIDIC_ADV_INTERVAL_MAX, 0x40};
      status = GapAdv_SetPeriodicAdvParams(advHandleNCNS, &perParams);
      RTLSRESPONDER_ASSERT(status == SUCCESS);
    
    #endif
    }

    Here are the adv data settings from GAPADV_PARAMS_AE_NC_NS

    /// Non-Connectable & Non-Scannable advertising set
    #define GAPADV_PARAMS_AE_NC_NS {                                           \
      .eventProps = 0,                                                         \
      .primIntMin = 160,                                                       \
      .primIntMax = 160,                                                       \
      .primChanMap = GAP_ADV_CHAN_ALL,                                         \
      .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID,                       \
      .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },                      \
      .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ,                               \
      .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE,                               \
      .primPhy = GAP_ADV_PRIM_PHY_1_MBPS,                                      \
      .secPhy = GAP_ADV_SEC_PHY_1_MBPS,                                        \
      .sid = 1                                                                 \
    }

    PS:

    We give device a MAC address from "TI flash programmer" MAC address tab, and that MAC address is used from the BLE as the source MAC. We use this concept to give MAC address to our tags and has worked 100% for us.

  • Jan,

    I think you may have asked for this setting and I misunderstood earlier:

    we did not change that setting, it is ADDRMODE_PUBLIC

    // Address mode of the local device
    // Note: When using the DEFAULT_ADDRESS_MODE as ADDRMODE_RANDOM or
    // ADDRMODE_RP_WITH_RANDOM_ID, GAP_DeviceInit() should be called with
    // it's last parameter set to a static random address
    #define DEFAULT_ADDRESS_MODE                  ADDRMODE_PUBLIC

    When we have only one tag around the results/prints are fine, when we power up a second tag then we start getting the occasional discrepancies....

  • Hi Ivan,

    Got it. No worries! Thank you for clarifying. Do you have access to a sniffer? If so, then could you take a sniffer log of the over the air traffic when both devices are advertising? This will help us ensure that the packets being sent are what we expect. At this point, I think that something might be going on on the central side, so this will help us narrow down where the behavior is coming from. If you do not have a sniffer, then you may be able to use the SmartRF Packet Sniffer 2  software with an additional launchpad to sniff the advertisement packets.

    Best Regards,

    Jan

  • Hi Jan,

    We attempted to capture BLE extended advertisements using the SmartRF Packet Sniffer 2 tool, but we received no packets from our two tags that use extended advertising.

      

    However, we receive legacy advertisements from other devices in our MAC address range.

    Is there something wrong with our configuration, or is this tool only capable of receiving legacy BLE advertisements?

    Thank you,

    Shayan

  • Hi Jan,

    we are trying the sniffing, but seems these tools are only capturing legacy advertisements. Can you please guys try to replicate the issue using steps from the initial thread starting response:

    1. set last 3 of mac inside the adv data bytes

    2. modify coordinator to compare the mac address bytes from the stack vs the bytes in adv data and assert the mismatch - I am sure you will see the discrepancy

    it should be rather simple to replicate, you will need 3 LPs - 1 coordinator and 2 responders.

    Please let us know if are  able to see it. We are  waiting for your response

    Thanks,

    Ivan

  • Hi,

    You are correct. The packet sniffer 2 software is only able to sniff legacy advertisements. To sniff extended packets, a dedicated sniffer will be required here. Can you share the application code for us to use and try to reproduce this behavior?

    Best Regards,

    Jan

  • Hi Jan,

    how do you suggest we share the code? Can you send me an email address so we can email you rather than publicly sharing it here?

    Thanks,

    Ivan

  • Hi Ivan,

    Do you have a project or a version of the application code that contains the minimum modifications required to exhibit the behavior? No need to share your custom application. Specifically, if you have a project with only the following modifications that exhibit the observed behavior, then that would be ideal.

    1. set last 3 of mac inside the adv data bytes

    2. modify coordinator to compare the mac address bytes from the stack vs the bytes in adv data and assert the mismatch - I am sure you will see the discrepancy

    Best Regards,

    Jan

  • Hi Jan,

    if you send me an email I would be happy to email you the two projects that your team can just run and hopefully able to reproduce.

    My email is: ivan.slavov@airista.com

    i tried to outline the changes, which are simple too.

    In words, embed the mac address bytes inside the adv data on the responder side, and then on coordinator side, compare the MAC bytes from the adv data with the MAC that the being reported by the stack,

    Responder project changes:

    1. we modified adv data, not very  relevant but here is how we have it:

    // Advertisement data
    uint8_t advertData[] =
    {
      0x0E,							// Length of this data
      GAP_ADTYPE_LOCAL_NAME_SHORT,  // Type of this data
      'R',
      'T',
      'L',
      'S',
      'R',
      'e',
      's',
      'p',
      'o',
      'n',
      'd',
      'e',
      'r',
      0x02,   // length of this data
      GAP_ADTYPE_FLAGS,
      DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
      0x0B,//AiRISTA Added //11 more bytes to follow
      GAP_ADTYPE_MANUFACTURER_SPECIFIC,//0xFF
      0xFF,//i20 MAC1
      0xFF,//i21 MAC2
      0xFF,//i22 MAC3
      0xFF,//i23 MAC4
      0xFF,//i24 MAC5
      0xFF,//i25 MAC6
      0x00,//(2022/09/23, Ivan), index[26] - SQN8
      0x00,//(2022/09/23, Ivan), index[27] - reason code
      0x00,//(2022/09/23, Ivan), index[28] - additional info(bit0=Charging, bit1=Safety Switch)
      0x00,//(2022/09/23, Ivan), index[29] - battery %
        //size of advData is now 30
    };

    2. update adv data to embed the device mac, and enable adv.

    static void RTLSResponder_advertInit(gapDeviceInitDoneEvent_t *pPkt)
    {
      bStatus_t status = FAILURE;
    
      // Setup and start Advertising
      // For more information, see the GAP section in the User's Guide:
      // http://software-dl.ti.com/lprf/ble5stack-latest/
    
      // Temporary memory for advertising parameters for set #1. These will be copied
      // by the GapAdv module
    
      //AiRISTA - disable legacy
    //  GapAdv_params_t advParamLegacy = GAPADV_PARAMS_LEGACY_SCANN_CONN;
    //
    //  BLE_LOG_INT_INT(0, BLE_LOG_MODULE_APP, "APP : ---- call GapAdv_create set=%d,%d\n", 0, 0);
    //  // Create Advertisement set #1 and assign handle
    //  status = GapAdv_create(&RTLSResponder_advCb, &advParamLegacy, &advHandleLegacy);
    //  RTLSRESPONDER_ASSERT(status == SUCCESS);
    //
    //  // Load advertising data for set #1 that is statically allocated by the app
    //  status = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_ADV,
    //                               sizeof(advertData), advertData);
    //  RTLSRESPONDER_ASSERT(status == SUCCESS);
    //
    //  // Load scan response data for set #1 that is statically allocated by the app
    //  status = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_SCAN_RSP, sizeof(scanRspData), scanRspData);
    //  RTLSRESPONDER_ASSERT(status == SUCCESS);
    //
    //  // Set event mask for set #1
    //  status = GapAdv_setEventMask(advHandleLegacy,
    //                               GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
    //                               GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
    //                               GAP_ADV_EVT_MASK_SET_TERMINATED);
    //
    //  BLE_LOG_INT_TIME(0, BLE_LOG_MODULE_APP, "APP : ---- GapAdv_enable", 0);
    //  // Enable legacy advertising for set #1
    //  status = GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
    //  RTLSRESPONDER_ASSERT(status == SUCCESS);
    
    #ifdef USE_PERIODIC_ADV
      // Create non connectable & non scannable advertising set #3
    
      GapAdv_params_t advParamNonConn = GAPADV_PARAMS_AE_NC_NS;
    
      // AiRISTA added
      // shorten advertizing interval on the primary channel
      advParamNonConn.primIntMax = RR_NCNS_ADV_PRIM_INT_625US; // 2021.12.3
      advParamNonConn.primIntMin = RR_NCNS_ADV_PRIM_INT_625US;
      // end AiRISTA added
    
      // Create Advertisement set #3 and assign handle
      status = GapAdv_create(&RTLSResponder_advCb, &advParamNonConn,
                                                       &advHandleNCNS);
      RTLSRESPONDER_ASSERT(status == SUCCESS);
    
      // AiRISTA added
      advertData[20] = pPkt->devAddr[0];
      advertData[21] = pPkt->devAddr[1];
      advertData[22] = pPkt->devAddr[2];
      advertData[23] = pPkt->devAddr[3];
      advertData[24] = pPkt->devAddr[4];
      advertData[25] = pPkt->devAddr[5];
      // end AiRISTA added
    
      // Load advertising data for set #3 that is statically allocated by the app
      status = GapAdv_loadByHandle(advHandleNCNS, GAP_ADV_DATA_TYPE_ADV,
                                         sizeof(advertData), advertData);
      RTLSRESPONDER_ASSERT(status == SUCCESS);
    
      // Set event mask for set #3
      status = GapAdv_setEventMask(advHandleNCNS,
                                   GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
                                   GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
                                   GAP_ADV_EVT_MASK_SET_TERMINATED
                                   | GAP_ADV_EVT_MASK_END//(2022/09/23 - Ivan)
                                   );
    
      // Enable non connectable & non scannable advertising for set #3
    
        status = GapAdv_enable(advHandleNCNS, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0); // Original
    
      RTLSRESPONDER_ASSERT(status == SUCCESS);
    
      // Set Periodic Advertising parameters
      GapAdv_periodicAdvParams_t perParams = {PERIDIC_ADV_INTERVAL_MIN, PERIDIC_ADV_INTERVAL_MAX, 0x40};
      status = GapAdv_SetPeriodicAdvParams(advHandleNCNS, &perParams);
      RTLSRESPONDER_ASSERT(status == SUCCESS);
    
    
      Xpert_Board_Keys_Led2_Green_Swap();
    
    #endif
    }

    3. at this point nothing else is relevant on the responder project. here are the adv params which i dont belive we have modified:

    /// Non-Connectable & Non-Scannable advertising set
    #define GAPADV_PARAMS_AE_NC_NS {                                           \
      .eventProps = 0,                                                         \
      .primIntMin = 160,                                                       \
      .primIntMax = 160,                                                       \
      .primChanMap = GAP_ADV_CHAN_ALL,                                         \
      .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID,                       \
      .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },                      \
      .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ,                               \
      .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE,                               \
      .primPhy = GAP_ADV_PRIM_PHY_1_MBPS,                                      \
      .secPhy = GAP_ADV_SEC_PHY_1_MBPS,                                        \
      .sid = 1                                                                 \
    }
    

    Coordinator project changes:

    1. enable scanning:

        case GAP_DEVICE_INIT_DONE_EVENT:
        {
          uint8_t temp8;
          int8_t signed_temp8;
          uint16_t temp16;
    
          BLE_LOG_INT_TIME(0, BLE_LOG_MODULE_APP, "APP : ---- got GAP_DEVICE_INIT_DONE_EVENT", 0);
          // Setup scanning
          // For more information, see the GAP section in the User's Guide:
          // http://software-dl.ti.com/lprf/ble5stack-latest/
    
          // Register callback to process Scanner events
          GapScan_registerCb(RTLSCoordinator_scanCb, NULL);
    
          // Set Scanner Event Mask
          GapScan_setEventMask(GAP_EVT_SCAN_ENABLED | GAP_EVT_SCAN_DISABLED |
                               GAP_EVT_ADV_REPORT);
    
          // AiRISTA modified
          // Set Scan PHY parameters
          //GapScan_setPhyParams(DEFAULT_SCAN_PHY, SCAN_TYPE_PASSIVE,
          //                     200, 100); // Original
          GapScan_setPhyParams(DEFAULT_SCAN_PHY, SCAN_TYPE_PASSIVE,
                               SCAN_PARAM_INTERVAL_625US, SCAN_PARAM_WINDOW_625US); // 2021.12.1
    
          // Set Advertising report fields to keep
          temp16 = RC_ADV_RPT_FIELDS;
          GapScan_setParam(SCAN_PARAM_RPT_FIELDS, &temp16);
          // Set Scanning Primary PHY
          temp8 = DEFAULT_SCAN_PHY;
          GapScan_setParam(SCAN_PARAM_PRIM_PHYS, &temp8);
          // Set RSSI Filter // Added 2021.11.30
          signed_temp8 = -128;//-90;
          GapScan_setParam(SCAN_PARAM_FLT_MIN_RSSI, &signed_temp8);
          // Set LL Duplicate Filter
          temp8 = SCAN_FLT_DUP_DISABLE;
          //temp8 = SCAN_FLT_DUP_ENABLE;
          GapScan_setParam(SCAN_PARAM_FLT_DUP, &temp8);
    
          // Set PDU type filter -
          // Only 'Complete' packets are desired.
          // It doesn't matter if received packets are
          // whether Scannable or Non-Scannable, whether Directed or Undirected,
          // whether Connectable or Non-Connectable, whether Scan_Rsp's or Advertisements,
          // and whether Legacy or Extended.
          // temp16 = SCAN_FLT_PDU_COMPLETE_ONLY; // Original
    
          temp16 = SCAN_FLT_PDU_EXTENDED_ONLY | SCAN_FLT_PDU_COMPLETE_ONLY; // 2021.12.1
    
          BLE_LOG_INT_TIME(0, BLE_LOG_MODULE_APP, "APP : ---- GapScan_setParam", 0);
          GapScan_setParam(SCAN_PARAM_FLT_PDU_TYPE, &temp16);
          // End AiRISTA modified
    
          // AiRISTA added
          AiRISTA_CL_Init((gapDeviceInitDoneEvent_t *)pMsg); // 2021.10.28
          // end AiRISTA added
        }
        
        
        
        static void AiRISTA_CL_Init(gapDeviceInitDoneEvent_t *pPkt)
    {
        // Locator ID is last 3 bytes of MAC address
        AIRISTA_LOC_ID = (pPkt->devAddr[2]<<16) + (pPkt->devAddr[1]<<8) + pPkt->devAddr[0];
        #ifdef AiRISTA_DEBUG
          AiRISTA_SendDataToBackend_String("\r\nAIRISTA_LOC_ID:");
          AiRISTA_SendDataToBackend_Int(AIRISTA_LOC_ID);
        #else
          AiRISTA_sendRxDeviceId(AIRISTA_LOC_ID);
        #endif
    
        // Allocate memory for sync terminated device
        pTerminateSyncDevice = RTLSCtrl_malloc(sizeof(AiRISTA_terminateSyncDevice_t)); // 2021.12.29
        if (pTerminateSyncDevice == NULL)
        {
            #ifdef AiRISTA_DEBUG //2021.12.29
              AiRISTA_SendDataToBackend_String("\r\nAiRISTA_CL_Init - pTerminateSyncDevice, malloc error");
            #endif
            return;
        }
    
        // Allocate memory for sync linked list
        AiRISTA_pSyncLinkList = RTLSCtrl_malloc(sizeof(AiRISTA_syncLinkList_t)); // 2021.11.12
        if (AiRISTA_pSyncLinkList != NULL)
        {
            AiRISTA_pSyncLinkList->count = 0;
            AiRISTA_pSyncLinkList->devicesHead = NULL;
            AiRISTA_pSyncLinkList->devicesTail = NULL;
    
            #ifdef AiRISTA_DEBUG //2021.11.11
              AiRISTA_SendDataToBackend_String("\r\nAiRISTA_CL_Init - pSyncLinkList, count:");
              AiRISTA_SendDataToBackend_Int((AiRISTA_pSyncLinkList->count));
            #endif
        }
        else
        {
            #ifdef AiRISTA_DEBUG //2021.11.11
              AiRISTA_SendDataToBackend_String("\r\nAiRISTA_CL_Init - pSyncLinkList, malloc error");
            #endif
            return;
        }
    
        if (AiRISTA_USE_PERIODIC_ADV_LIST == 1)
        {
            // Allocate memory for periodic advertisers linked list
            AiRISTA_pPerAdvLinkList = RTLSCtrl_malloc(sizeof(AiRISTA_perAdvLinkList_t)); // 2021.12.13 // 1234
            if (AiRISTA_pPerAdvLinkList != NULL)
            {
                AiRISTA_pPerAdvLinkList->count = 0;
                AiRISTA_pPerAdvLinkList->devicesHead = NULL;
                AiRISTA_pPerAdvLinkList->devicesTail = NULL;
    
                #ifdef AiRISTA_DEBUG
                  AiRISTA_SendDataToBackend_String("\r\nAiRISTA_CL_Init - pPerAdvLinkList, count:");
                  AiRISTA_SendDataToBackend_Int((AiRISTA_pSyncLinkList->count));
                #endif
            }
            else
            {
                #ifdef AiRISTA_DEBUG
                  AiRISTA_SendDataToBackend_String("\r\nAiRISTA_CL_Init - pPerAdvLinkList, malloc error");
                #endif
                return;
            } // 1234
        }
    
        // Start scan
        scanRes = 0;
        uint8_t status = GapScan_enable(AIRISTA_SCAN_PERIOD_1280MS,AIRISTA_SCAN_DUR_10MS,AIRISTA_SCAN_MAX_RPT_NUM);
        // uint8_t status = GapScan_enable(0, DEFAULT_SCAN_DURATION,DEFAULT_MAX_SCAN_RES); // single scan
        #ifdef AiRISTA_DEBUG
          AiRISTA_DEBUG_SendDataToBackend_String("\r\nGapScan_enable");
          AiRISTA_DEBUG_SendDataToBackend_String(", status:");
          AiRISTA_DEBUG_SendDataToBackend_Int(status);
        #endif
    }
    
    
    defines:
    // AiRISTA added
    #define RTLS_CMD_AOA_RESULT_RAW             0x24
    #define AiRISTA_USE_PERIODIC_ADV_LIST       1
    //#define SCAN_PARAM_INTERVAL_625US           176*2                   // scan interval (in 625 us ticks) // 2021.12.3
    //#define SCAN_PARAM_WINDOW_625US             176                     // scan window (in 625 us ticks) // 2021.12.3
    #define SCAN_PARAM_INTERVAL_625US           176                     // scan interval (in 625 us ticks) // 2021.12.3
    #define SCAN_PARAM_WINDOW_625US             160                     // scan window (in 625 us ticks) // 2021.12.3
    //#define AiRISTA_SYNC_TIMEOUT_10MS           25                      // sync timeout (in 10ms units) // 2021.12.07
    //#define AiRISTA_SYNC_TIMEOUT_10MS           500
    #define AiRISTA_SYNC_TIMEOUT_10MS           100
    //#define AiRISTA_SYNC_TIMEOUT_10MS           1600
    #define AIRISTA_SCAN_PERIOD_1280MS          0                       // no period
    #define AIRISTA_SCAN_DUR_10MS               0                       // continuous scan
    #define AIRISTA_SCAN_MAX_RPT_NUM            DEFAULT_MAX_SCAN_RES    // user-defined limit
    

    2. here is the  discrepancy inside the report event:

    you can see the "MISMATCH1" print that we captured and shared in the logs

    case RC_EVT_ADV_REPORT:
        {
          GapScan_Evt_AdvRpt_t* pAdvRpt = (GapScan_Evt_AdvRpt_t*) (pMsg->pData);
          uint8_t status;
    
    
    
          char responderScanRsp[] = {'R','T','L','S','R','e','s','p','o','n','d','e','r'};
    
          // Filter results to only consider the testng tags 
          if (memcmp(&pAdvRpt->pData[2], responderScanRsp, sizeof(responderScanRsp)) == 0)
          {
              if (pAdvRpt->addr[2] != pAdvRpt->pData[22] || pAdvRpt->addr[1] != pAdvRpt->pData[21] || pAdvRpt->addr[0] != pAdvRpt->pData[20])
            {
                //we should not be coming here...
                //it happens from time to time when there are two or more tags adverstising, and the MAC addresses are getting mixed up....
                AiRISTA_DEBUG_SendDataToBackend_String("*** MISMATCH1 ***");
            }
            // AiRISTA added
            #ifdef AiRISTA_DEBUG // temporary // 2021.11.30
    //          char buffer[128];
    //          char temp[12];
    //          strcpy(buffer, "\r\n Adv Report: ");
    //          itoa(pAdvRpt->addr[2], temp, 16);
    //          strcat(buffer,temp);
    //          itoa(pAdvRpt->addr[1], temp, 16);
    //          strcat(buffer,temp);
    //          itoa(pAdvRpt->addr[0], temp, 16);
    //          strcat(buffer,temp);
    //          strcat(buffer, ", ");
    //          itoa(pAdvRpt->periodicAdvInt, temp, 10);
    //          strcat(buffer,temp);
    //          strcat(buffer, ", ");
    //          itoa(pAdvRpt->dataLen,temp,10);
    //          strcat(buffer,temp);
    //          strcat(buffer, ", ");
    //          itoa(pAdvRpt->pData[21],temp,16);
    //          strcat(buffer,temp);
    //          itoa(pAdvRpt->pData[20],temp,16);
    //          strcat(buffer,temp);
    //          itoa(pAdvRpt->pData[19],temp,16);
    //          strcat(buffer,temp);
    
    //          ICall_heapStats_t stats;
    //          ICall_getHeapStats(&stats);
    //          AiRISTA_DEBUG_SendDataToBackend_String("\r\nICall_getHeapStats, tot. free size:");
    //          AiRISTA_DEBUG_SendDataToBackend_Int(stats.totalFreeSize);
            #else
              AiRISTA_sendAdvRptData(pAdvRpt);
            #endif
    
        
            // End AiRISTA added
            // RTLSCoordinator_addDeviceInfo(pAdvRpt); // original // Commented out 2021.11.09
          }
    
          // Free report payload data
          if (pAdvRpt->pData != NULL)
          {
            ICall_free(pAdvRpt->pData);
          }
        }
        break;
    

    Thanks,
    Ivan

  • Hi Ivan,

    This is helpful! I will try to use this code to replicate the behavior on my end.

    Best Regards,

    Jan

  • Hi Ivan,

    I am still looking into this. I will provide an update on the current status sometime on Tuesday. My apologies for any inconvenience.

    Best Regards,

    Jan

  • Thanks for  the update, Jan!

    I will wait for your response when you are ready.

    Thanks,

    Ivan

  • Hi Ivan,

    I am having issues building the coordinator and responder project with your given modifications. On the responder project, I am only missing the definition of RR_NCNS_ADV_PRIM_INT_625US. On the coordinator project, I am missing many of your custom functions.

    Taking a step back, it seems the behavior can be simplified to the following. 

    1. Responder - Is advertising its own BLE address in its advertising data

    2. Coordinator - Is scanning for responder advertisements and occasionally sees that the scanned advertising packets contain a mismatch between the address advertised and the address of the device that sent the advertisement.

    Is this correct? If so, then could you take an unmodified rtls_coordinator and rtls_responder and implement the minimum amount of modifications needed to recreate the behavior you are seeing? This will help us isolate the potential cause of this behavior.

    Best Regards,

    Jan

  • Jan,

    Yes, your summary is exactly correct - this is exactly what i was trying to describe - it should be simple to compile and run. You can ignore any custom functions, and just try what you described - the moment you start a second responder, we begin to see the discrepancies on the coordinator side.

    here are the defines you were missing:

    //this is primary adv interval
    #define AiRISTA_RR_NCNS_ADV_PRIM_INT_625US  160    // 100ms
    
    //below are the intervals of the PERIDIC_ADV
    //!< Minimum periodic advertising interval; Range: 0x0006 to 0xFFFF Time = N * 1.25 ms Time Range: 7.5ms to 81.91875s
    //old values were 80 (100msec)
    #define AiRISTA_PERIDIC_ADV_INTERVAL_MIN    80  // 100 ms
    #define AiRISTA_PERIDIC_ADV_INTERVAL_MAX    80  // 100 ms
    
    
    

    Please let us know if you are able to run it.

  • Hi Ivan,

    Got it! Understood. I will set up the examples on my side to replicate this behavior with the minimal amount of changes necessary. I will report back once as soon as possible.

    Best Regards,

    Jan

  • Hi Ivan,

    I have not had time to test this on my side yet. I truly apologize. I will update you tomorrow with any progress i am able to do. I sincerely apologize for any inconvenience this may be causing.

    Best Regards,

    Jan

  • Hi Ivan,

    I was having some issues adding the functionality to the rtls example, so I took a step back and was able to quickly add it to the simple_central and simple_peripheral examples. On those examples, I did not see the issue described, but I want to share the projects and changes I did with you in case I may have missed something.

    1. Simple Peripheral was set to use Public Address (SysConfig)

    2. Simple Peripherals Advertisement Data was changed to contain a unique UUID for identification and space for its address (Sysconfig)

    3. Simple Peripheral's advertising data was loaded as shown below before the advHandle was created: (GAP_DEVICE_INIT_DONE_EVENT inside SimplePeripheral_processGapMessage()

    4. Advdata2 and the long range advertising handle was removed from the project. (SysConfig and entire simple_peripheral.c)

    5. Simple Central enabled discovery by UUID (SysConfig)

    6. Logic was added to Simple Central to check if the unique UUID is present and to determine if the address in the advert data and the address of the device are the same (in SC_EVT_ADV_REPORT event of SimpleCentral_processAppMsg()) [Some of this logic can be seen below]

    I have uploaded the projects here:

    simple_peripheral_CC26X2R1_LAUNCHXL_tirtos7_ticlang.zip

    simple_central_CC26X2R1_LAUNCHXL_tirtos7_ticlang.zip

    Once the projects have been flashed on two devices, when the central devices scans it will look for the simple_peripheral device and check its advertising data and address:

    Could you take a look at the project and see if you can see the same behavior on your end? As a quick test can you try setting the device address in the advert data array before you call the Gap_advCreate() function?

    Best Regards,

    Jan

  • Jan,

    I think you are probably using legacy advertising (I am pretty sure the simple_peripheral_CC26X2R1 projects use legacy), but the problem does not happen when  tags advertise legacy, it only happens when they use extended advertising.

    I am trying to run your projects and confirm, but cant import them... I downloaded then and trying to import projects into a workspace. I am using CCS 12.1.0.00007 and I am getting the error below.

    What CCS version are you using?

    I will keep trying and respond shortly with more details.

    thanks,

    Ivan

  • Jan,

    I still cant compile your projects, but in the meantime can you change the adv to not be legacy and try running your samples?

    for example use these settings

    /// Non-Connectable & Non-Scannable advertising set
    #define GAPADV_PARAMS_AE_NC_NS {                                           \
      .eventProps = 0,                                                         \
      .primIntMin = 160,                                                       \
      .primIntMax = 160,                                                       \
      .primChanMap = GAP_ADV_CHAN_ALL,                                         \
      .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID,                       \
      .peerAddr = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },                      \
      .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ,                               \
      .txPower = GAP_ADV_TX_POWER_NO_PREFERENCE,                               \
      .primPhy = GAP_ADV_PRIM_PHY_1_MBPS,                                      \
      .secPhy = GAP_ADV_SEC_PHY_1_MBPS,                                        \
      .sid = 1                                                                 \
    }

    I think, you are using something like this which is the legacy and we never observe the mixup when using legacy adv

    GapAdv_params_t advParams1 = {
      .eventProps =   GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_LEGACY | GAP_ADV_PROP_SCANNABLE,
      .primIntMin =   160,
      .primIntMax =   160,
      .primChanMap =  GAP_ADV_CHAN_ALL,
      .peerAddrType = PEER_ADDRTYPE_PUBLIC_OR_PUBLIC_ID,
      .peerAddr =     { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa },
      .filterPolicy = GAP_ADV_WL_POLICY_ANY_REQ,
      .txPower =      GAP_ADV_TX_POWER_NO_PREFERENCE,
      .primPhy =      GAP_ADV_PRIM_PHY_1_MBPS,
      .secPhy =       GAP_ADV_SEC_PHY_1_MBPS,
      .sid =          0
    };

    If you are using the SysConfig to edit, then change the legacy to extended, and please try running again with two peripherals and one central

    thanks,

    Ivan

  • Hi Ivan,

    My apologies. I used the legacy advertisement type on my test. Have you unzipped the projects i sent you before importing them? This may be the cause of the error. Can you try this and see if the project works on your end? If it does, then can you try changing it to extended to see if you observe the same behavior? If you have any issues with getting the project to properly import, then please let me know and I will run this test on my end and repackage the project.

    Best Regards,

    Jan

  • Jan,

    I cannot import your projects, getting this error:

    please let me know do you think i can fix it OR just try switching the adv to extended

    thanks,

    Ivan

  • Hi Ivan,

    Can you try expanding the window and pasting the full error here? This may help us understand why CCS is not able to import the project. I may not have time to run the test until tomorrow.

    Best Regards,

    Jan

  • Jan, I tried using unchanged simple peripheral and central from 6.20 sdk, make the changes you described and made the advertising extended, not legacy - the result is - NO MISMTACHES.

    I had two tags running and I could see both MACs and not a single mismtach.

    I will work tomorrow on comparing the simple periph and central projects with rtls responder and coordinator - something on the RTLS side of things has to be causing the mismtaches - will update this thread with more details tomorrow.

    Thanks,

    Ivan

  • Hi Ivan,

    Sounds good! I am glad you were able to reproduce the behavior I am seeing on simple_peripheral and confirmed the behavior holds for extended advertising. I look forward to seeing your update.

    Best Regards,

    Jan

  • Jan,

    here is my update from the morning - I am running the SAME 2 simple peripheral clients to advertise, then I ran the RTLS coordinator and modify the scan results to print any mismatches, and I am seeing the MISMATCHES

    here is where/how I am printing them:

    case RC_EVT_ADV_REPORT:
        {
          GapScan_Evt_AdvRpt_t* pAdvRpt = (GapScan_Evt_AdvRpt_t*) (pMsg->pData);
          uint8_t status;
          
          if (pAdvRpt->pData[2] == 'S' && pAdvRpt->pData[3] == 'P')
          {
              AiRISTA_DEBUG_SendDataToBackend_String("+");
    
              if (
                      pAdvRpt->addr[0] == pAdvRpt->pData[15] &&
                      pAdvRpt->addr[1] == pAdvRpt->pData[16] &&
                      pAdvRpt->addr[2] == pAdvRpt->pData[17] &&
                      pAdvRpt->addr[3] == pAdvRpt->pData[18] &&
                      pAdvRpt->addr[4] == pAdvRpt->pData[19] &&
                      pAdvRpt->addr[5] == pAdvRpt->pData[20]
              )
              {
                  ++matches;
                  AiRISTA_DEBUG_SendDataToBackend_String("+");
              }
              else
              {
                  ++mismatches;
                  AiRISTA_DEBUG_SendDataToBackend_String("\r\n");
                  AiRISTA_DEBUG_SendDataToBackend_String(Util_convertBdAddr2Str(&pAdvRpt->addr[0]));
                  AiRISTA_DEBUG_SendDataToBackend_String(" MISMATCH ");
                  AiRISTA_DEBUG_SendDataToBackend_String(Util_convertBdAddr2Str(&pAdvRpt->pData[15]));
                  //AiRISTA_DEBUG_SendDataToBackend_String();
              }
          }
    
          // Free report payload data
          if (pAdvRpt->pData != NULL)
          {
            ICall_free(pAdvRpt->pData);
          }
        }

    Next, I will try to do the same starting with OEM rtls coordinator, and i will clearly document my changes and then share the RTLS coordinator project inline in this thread for you to review.

  • Hi Ivan,

    Thank you for the update! That is interesting, it seems the scanning of the coordinator is introducing the mismatch for some reason. This could be a simple logic discrepancy in the application code. I completely agree, I think the next step is to try to reproduce this on an unmodified coordinator example (with only the mismatch logic from the simple central project added). Thank you for the detailed updates and thorough debugging!

    Best Regards,

    Jan

  • Jan,

    Attached is the rtls_coordinator with ONLY a few changes, all commented out with a line starting like this: //AiRISTA

    You should be able to import stock rtls_coordinator project, overwrite this file and then run it. If you search for the "//AiRISTA" you will see the changes and I am sure they will make sense.

    /******************************************************************************
    
     @file  rtls_coordinator.c
    
     @brief This file contains the RTLS Coordinator sample application for use
            with the CC2650 Bluetooth Low Energy Protocol Stack.
    
     Group: WCS, BTS
     Target Device: cc13xx_cc26xx
    
     ******************************************************************************
     
     Copyright (c) 2013-2022, Texas Instruments Incorporated
     All rights reserved.
    
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:
    
     *  Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
    
     *  Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in the
        documentation and/or other materials provided with the distribution.
    
     *  Neither the name of Texas Instruments Incorporated nor the names of
        its contributors may be used to endorse or promote products derived
        from this software without specific prior written permission.
    
     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
     ******************************************************************************
     
     
     *****************************************************************************/
    
    /*********************************************************************
     * INCLUDES
     */
    #include <string.h>
    
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/knl/Clock.h>
    #include <ti/sysbios/knl/Event.h>
    #include <ti/sysbios/knl/Queue.h>
    
    #include "bcomdef.h"
    #include "l2cap.h"
    
    #include <icall.h>
    #include "util.h"
    /* This Header file contains all BLE API and icall structure definition */
    #include <icall_ble_api.h>
    #include "osal_list.h"
    #include "board_key.h"
    #include <ti_drivers_config.h>
    
    #include "ble_user_config.h"
    
    #include "rtls_coordinator.h"
    
    #include "rtls_ctrl_api.h"
    #include "rtls_ble.h"
    #ifdef RTLS_CTE
    #include "rtls_aoa_api.h"
    #endif /* RTLS_CTE*/
    
    /*********************************************************************
     * MACROS
     */
    
    /*********************************************************************
     * CONSTANTS
     */
    
    // Application events
    #define RC_EVT_SCAN_ENABLED        0x01
    #define RC_EVT_SCAN_DISABLED       0x02
    #define RC_EVT_ADV_REPORT          0x03
    #define RC_EVT_ADV_EVT             0x04
    #define RC_EVT_PAIR_STATE          0x05
    #define RC_EVT_PASSCODE_NEEDED     0x06
    #define RC_EVT_INSUFFICIENT_MEM    0x07
    #define RC_EVT_RTLS_CTRL_MSG_EVT   0x08
    #define RC_EVT_RTLS_SRV_MSG_EVT    0x09
    #define RC_EVT_CONN_EVT            0x0A
    
    // RTLS Coordinator Task Events
    #define RC_ICALL_EVT                         ICALL_MSG_EVENT_ID  // Event_Id_31
    #define RC_QUEUE_EVT                         UTIL_QUEUE_EVENT_ID // Event_Id_30
    
    #define RC_ALL_EVENTS                        (RC_ICALL_EVT | RC_QUEUE_EVT)
    
    // Address mode of the local device
    // Note: When using the DEFAULT_ADDRESS_MODE as ADDRMODE_RANDOM or
    // ADDRMODE_RP_WITH_RANDOM_ID, GAP_DeviceInit() should be called with
    // it's last parameter set to a static random address
    #define DEFAULT_ADDRESS_MODE                 ADDRMODE_PUBLIC
    
    // General discoverable mode: advertise indefinitely
    #define DEFAULT_DISCOVERABLE_MODE            GAP_ADTYPE_FLAGS_GENERAL
    
    // Minimum connection interval (units of 1.25ms, 80=100ms) for parameter update request
    #define DEFAULT_DESIRED_MIN_CONN_INTERVAL    80
    
    // Maximum connection interval (units of 1.25ms, 104=130ms) for  parameter update request
    #define DEFAULT_DESIRED_MAX_CONN_INTERVAL    104
    
    // Default PHY for scanning and initiating
    #define DEFAULT_SCAN_PHY                     SCAN_PRIM_PHY_1M
    #define DEFAULT_INIT_PHY                     INIT_PHY_1M
    
    // Default scan duration in 10 ms
    #define DEFAULT_SCAN_DURATION                200 // 2 sec
    
    // Default supervision timeout in 10ms
    #define DEFAULT_UPDATE_CONN_TIMEOUT          200
    
    // Task configuration
    #define RC_TASK_PRIORITY                     1
    
    #ifndef RC_TASK_STACK_SIZE
    #define RC_TASK_STACK_SIZE                   1024
    #endif
    
    // Advertising report fields to keep in the list
    // Interested in only peer address type and peer address
    #define RC_ADV_RPT_FIELDS   (SCAN_ADVRPT_FLD_ADDRTYPE | SCAN_ADVRPT_FLD_ADDRESS)
    
    // Connection event registration
    typedef enum
    {
      NOT_REGISTERED     = 0x0,
      FOR_RTLS            = 0x2,
    } connectionEventRegisterCause_u;
    
    // Spin if the expression is not true
    #define RTLSCOORDINATOR_ASSERT(expr) if (!(expr)) rtls_coordinator_spin();
    
    // Set the register cause to the registration bit-mask
    #define CONNECTION_EVENT_REGISTER_BIT_SET(RegisterCause) (connEventRegCauseBitmap |= RegisterCause)
    // Remove the register cause from the registration bit-mask
    #define CONNECTION_EVENT_REGISTER_BIT_REMOVE(RegisterCause) (connEventRegCauseBitmap &= (~RegisterCause))
    // Gets whether the current App is registered to the receive connection events
    #define CONNECTION_EVENT_IS_REGISTERED (connEventRegCauseBitmap > 0)
    // Gets whether the RegisterCause was registered to receive connection event
    #define CONNECTION_EVENT_REGISTRATION_CAUSE(RegisterCause) (connEventRegCauseBitmap & RegisterCause)
    
    // Hard coded PSM for passing data between central and peripheral
    #define RTLS_PSM      0x0080
    #define RTLS_PDU_SIZE MAX_PDU_SIZE
    
    #define SYNC_HANDLE_MASK 0x1000
    
    /*********************************************************************
     * TYPEDEFS
     */
    
    // App event passed from stack modules. This type is defined by the application
    // since it can queue events to itself however it wants.
    typedef struct
    {
      appEvtHdr_t hdr; // event header
      uint8_t *pData;  // event data
    } rcEvt_t;
    
    // Container to store paring state info when passing from gapbondmgr callback
    // to app event. See the pfnPairStateCB_t documentation from the gapbondmgr.h
    // header file for more information on each parameter.
    typedef struct
    {
      uint16_t connHandle;
      uint8_t  status;
    } rcPairStateData_t;
    
    // Container to store passcode data when passing from gapbondmgr callback
    // to app event. See the pfnPasscodeCB_t documentation from the gapbondmgr.h
    // header file for more information on each parameter.
    typedef struct
    {
      uint8_t deviceAddr[B_ADDR_LEN];
      uint16_t connHandle;
      uint8_t uiInputs;
      uint8_t uiOutputs;
      uint32_t numComparison;
    } rcPasscodeData_t;
    
    // Scanned device information record
    typedef struct
    {
      uint8_t addrType;         // Peer Device's Address Type
      uint8_t addr[B_ADDR_LEN]; // Peer Device Address
    } scanRec_t;
    
    typedef struct
    {
      uint16_t cocCID;
      uint8_t  isActive;
    } rcConnCB_t;
    
    // Container to store advertising event data when passing from advertising
    // callback to app event. See the respective event in GapAdvScan_Event_IDs
    // in gap_advertiser.h for the type that pBuf should be cast to.
    typedef struct
    {
      uint32_t event;
      void *pBuf;
    } rcGapAdvEventData_t;
    
    /*********************************************************************
     * GLOBAL VARIABLES
     */
    
    /*********************************************************************
     * EXTERNAL VARIABLES
     */
    #define APP_EVT_BLE_LOG_STRINGS_MAX  0xA
    char *appEvent_BleLogStrings[] = {
      "APP_EVT_ZERO              ",
      "APP_EVT_SCAN_ENABLED      ",
      "APP_EVT_SCAN_DISABLED     ",
      "APP_EVT_ADV_REPORT        ",
      "APP_EVT_ADV_EVT           ",
      "APP_EVT_PAIR_STATE        ",
      "APP_EVT_PASSCODE_NEEDED   ",
      "APP_EVT_INSUFFICIENT_MEM  ",
      "APP_EVT_RTLS_CTRL_MSG_EVT ",
      "APP_EVT_RTLS_SRV_MSG_EVT  ",
      "APP_EVT_CONN_EVT          ",
    };
    
    /*********************************************************************
     * LOCAL VARIABLES
     */
    
    // Entity ID globally used to check for source and/or destination of messages
    static ICall_EntityID selfEntity;
    
    // Event globally used to post local events and pend on system and
    // local events.
    static ICall_SyncHandle syncEvent;
    
    // Queue object used for app messages
    static Queue_Struct appMsg;
    static Queue_Handle appMsgQueue;
    
    // Task configuration
    Task_Struct rcTask;
    #if defined __TI_COMPILER_VERSION__
    #pragma DATA_ALIGN(rcTaskStack, 8)
    #else
    #pragma data_alignment=8
    #endif
    uint8_t rcTaskStack[RC_TASK_STACK_SIZE];
    
    // Array of connection handles and information for each handle
    static rcConnCB_t rcConnCB[MAX_NUM_BLE_CONNS];
    
    // Address mode
    static GAP_Addr_Modes_t addrMode = DEFAULT_ADDRESS_MODE;
    
    // Number of scan results and scan result index
    static uint8_t scanRes = 0;
    
    // Scan result list
    static scanRec_t scanList[DEFAULT_MAX_SCAN_RES];
    
    // Advertisement data
    static uint8_t advertData[] =
    {
      0x10,                         // Length of this data
      GAP_ADTYPE_LOCAL_NAME_SHORT,  // Type of this data
      'R',
      'T',
      'L',
      'S',
      'C',
      'o',
      'o',
      'r',
      'd',
      'i',
      'n',
      'a',
      't',
      'o',
      'r',
      0x02,   // length of this data
      GAP_ADTYPE_FLAGS,
      DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
    };
    
    // Scan Response Data
    static uint8_t scanRspData[] =
    {
      16,                             // length of this data
      GAP_ADTYPE_LOCAL_NAME_COMPLETE, // Type of this data
      'R',
      'T',
      'L',
      'S',
      'C',
      'o',
      'o',
      'r',
      'd',
      'i',
      'n',
      'a',
      't',
      'o',
      'r',
    
      // connection interval range
      5,   // length of this data
      GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE,
      LO_UINT16(DEFAULT_DESIRED_MIN_CONN_INTERVAL),   // 100ms
      HI_UINT16(DEFAULT_DESIRED_MIN_CONN_INTERVAL),
      LO_UINT16(DEFAULT_DESIRED_MAX_CONN_INTERVAL),   // 1s
      HI_UINT16(DEFAULT_DESIRED_MAX_CONN_INTERVAL),
    
      // Tx power level
      2,   // length of this data
      GAP_ADTYPE_POWER_LEVEL,
      0       // 0dBm
    };
    
    // Advertising handles
    static uint8 advHandleLegacy;
    
    // Handle the registration and un-registration for the connection event, since only one can be registered.
    uint32_t connEventRegCauseBitmap = NOT_REGISTERED;
    
    /*********************************************************************
     * LOCAL FUNCTIONS
     */
    static void RTLSCoordinator_init(void);
    static void RTLSCoordinator_taskFxn(uintptr_t a0, uintptr_t a1);
    
    static uint8_t RTLSCoordinator_processStackMsg(ICall_Hdr *pMsg);
    static void RTLSCoordinator_processAppMsg(rcEvt_t *pMsg);
    static void RTLSCoordinator_processGapMsg(gapEventHdr_t *pMsg);
    static void RTLSCoordinator_processPairState(uint8_t state, rcPairStateData_t* pPairStateData);
    static void RTLSCoordinator_processPasscode(rcPasscodeData_t *pData);
    static void RTLSCoordinator_processAdvEvent(rcGapAdvEventData_t *pEventData);
    static void RTLSCoordinator_advertInit(void);
    static void RTLSCoordinator_scanInit(void);
    static void RTLSCoordinator_addDeviceInfo(GapScan_Evt_AdvRpt_t *pEvent);
    static void RTLSCoordinator_advCb(uint32_t event, void *pBuf, uintptr_t arg);
    static void RTLSCoordinator_scanCb(uint32_t evt, void* msg, uintptr_t arg);
    static void RTLSCoordinator_passcodeCb(uint8_t *deviceAddr, uint16_t connHandle,
                                         uint8_t uiInputs, uint8_t uiOutputs,
                                         uint32_t numComparison);
    static void RTLSCoordinator_pairStateCb(uint16_t connHandle, uint8_t state, uint8_t status);
    static status_t RTLSCoordinator_enqueueMsg(uint8_t event, uint8_t status, uint8_t *pData);
    
    // RTLS specific functions
    static bStatus_t RTLSCoordinator_sendRTLSData(rtlsPacket_t *pMsg);
    static void RTLSCoordinator_processRTLSScanReq(void);
    static void RTLSCoordinator_processRTLSScanRes(GapScan_Evt_AdvRpt_t *deviceInfo);
    static void RTLSCoordinator_processRTLSConnReq(bleConnReq_t *bleConnReq);
    static void RTLSCoordinator_processRTLSConnInfo(uint16_t connHandle);
    static void RTLSCoordinator_setCreateSyncParams(rtlsCreateSyncParams_t *pParams);
    static void RTLSCoordinator_syncCancelCmd(void);
    static void RTLSCoordinator_terminateSync(rtlsTerminateSync_t *handle);
    static void RTLSCoordinator_periodicReceiveEnable(rtlsReceiveEnableParams_t *pParams);
    static void RTLSCoordinator_addDeviceToPeriodicAdvList(rtlsAdvListDeviceParams_t *pParams);
    static void RTLSCoordinator_removeDeviceFromPeriodicAdvList(rtlsAdvListDeviceParams_t *pParams);
    static void RTLSCoordinator_readPeriodicAdvListSize( void );
    static void RTLSCoordinator_clearPeriodicAdvList( void );
    static void RTLSCoordinator_enableRtlsSync(rtlsEnableSync_t *enable);
    static void RTLSCoordinator_connEvtCB(Gap_ConnEventRpt_t *pReport);
    static void RTLSCoordinator_processConnEvt(Gap_ConnEventRpt_t *pReport);
    static void RTLSCoordinator_processRtlsCtrlMsg(uint8_t *pMsg);
    static void RTLSCoordinator_terminateLinkReq(rtlsTerminateLinkReq_t *termInfo);
    static void RTLSCoordinator_rtlsSrvlMsgCb(rtlsSrv_evt_t *pRtlsSrvEvt);
    static void RTLSCoordinator_processRtlsSrvMsg(rtlsSrv_evt_t *pEvt);
    static void RTLSCoordinator_processRTLSUpdateConnInterval(rtlsUpdateConnIntReq_t *updateReq);
    #ifdef RTLS_CTE
    static void RTLSCoordinator_setAoaParamsReq(rtlsAoaConfigReq_t *config);
    static void RTLSCoordinator_enableAoaReq(rtlsAoaEnableReq_t *pReq);
    static void RTLSCoordinator_CLAoaSamplingEnableReq(rtlsCLAoaEnableReq_t *pReq);
    #endif /* RTLS_CTE*/
    
    // L2CAP COC Handling
    static bStatus_t RTLSCoordinator_openL2CAPChanCoc(uint16_t connHandle);
    static void RTLSCoordinator_processL2CAPSignalEvent(l2capSignalEvent_t *pMsg);
    static void RTLSCoordinator_processL2CAPDataEvent(l2capDataEvent_t *pMsg);
    
    /*********************************************************************
     * EXTERN FUNCTIONS
     */
    extern void AssertHandler(uint8 assertCause, uint8 assertSubcause);
    
    /*********************************************************************
     * PROFILE CALLBACKS
     */
    
    // Bond Manager Callbacks
    static gapBondCBs_t RTLSCoordinator_bondMgrCBs =
    {
     (pfnPasscodeCB_t)RTLSCoordinator_passcodeCb, // Passcode callback
      RTLSCoordinator_pairStateCb // Pairing/Bonding state Callback
    };
    
    /*********************************************************************
     * PUBLIC FUNCTIONS
     */
    
    /*********************************************************************
     * @fn      rtls_coordinator_spin
     *
     * @brief   Spin forever
     *
     * @param   none
     */
    static void rtls_coordinator_spin(void)
    {
      volatile uint8_t x = 0;
    
      while(1)
      {
        x++;
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_createTask
     *
     * @brief   Task creation function for the RTLS Coordinator.
     *
     * @param   none
     *
     * @return  none
     */
    void RTLSCoordinator_createTask(void)
    {
      Task_Params taskParams;
    
      // Configure task
      Task_Params_init(&taskParams);
      taskParams.stack = rcTaskStack;
      taskParams.stackSize = RC_TASK_STACK_SIZE;
      taskParams.priority = RC_TASK_PRIORITY;
    
      Task_construct(&rcTask, RTLSCoordinator_taskFxn, &taskParams, NULL);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_Init
     *
     * @brief   Initialization function for the RTLS Coordinator App Task.
     *          This is called during initialization and should contain
     *          any application specific initialization (ie. hardware
     *          initialization/setup, table initialization, power up
     *          notification).
     *
     * @param   none
     *
     * @return  none
     */
    static void RTLSCoordinator_init(void)
    {
      BLE_LOG_INT_TIME(0, BLE_LOG_MODULE_APP, "APP : ---- init ", RC_TASK_PRIORITY);
      // ******************************************************************
      // N0 STACK API CALLS CAN OCCUR BEFORE THIS CALL TO ICall_registerApp
      // ******************************************************************
      // Register the current thread as an ICall dispatcher application
      // so that the application can send and receive messages.
      ICall_registerApp(&selfEntity, &syncEvent);
    
      // Create an RTOS queue for message from profile to be sent to app.
      appMsgQueue = Util_constructQueue(&appMsg);
    
      // Set default values for Data Length Extension
      // Extended Data Length Feature is already enabled by default
      // in build_config.opt in stack project.
      {
        //Change initial values of RX/TX PDU and Time, RX is set to max. by default(251 octets, 2120us)
        #define APP_SUGGESTED_RX_PDU_SIZE 251     //default is 251 octets(RX)
        #define APP_SUGGESTED_RX_TIME     17000   //default is 17000us(RX)
        #define APP_SUGGESTED_TX_PDU_SIZE 27      //default is 27 octets(TX)
        #define APP_SUGGESTED_TX_TIME     328     //default is 328us(TX)
    
        //This API is documented in hci.h
        //See the LE Data Length Extension section in the BLE5-Stack User's Guide for information on using this command:
        //http://software-dl.ti.com/lprf/ble5stack-latest/
        HCI_EXT_SetMaxDataLenCmd(APP_SUGGESTED_TX_PDU_SIZE, APP_SUGGESTED_TX_TIME, APP_SUGGESTED_RX_PDU_SIZE, APP_SUGGESTED_RX_TIME);
      }
    
      // Set Bond Manager parameters
      {
        // Don't wait, initiate a pairing request or slave security request
        uint8_t pairMode = GAPBOND_PAIRING_MODE_INITIATE;
        // Do not use authenticated pairing
        uint8_t mitm = FALSE;
        // This is a display only device
        uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
        // Create a bond during the pairing process
        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);
      }
    
      // Start Bond Manager and register callback
      // This must be done before initialing the GAP layer
      VOID GAPBondMgr_Register(&RTLSCoordinator_bondMgrCBs);
    
      // Accept all parameter update requests
      GAP_SetParamValue(GAP_PARAM_LINK_UPDATE_DECISION, GAP_UPDATE_REQ_ACCEPT_ALL);
    
      // Register with GAP for HCI/Host messages (for RSSI)
      GAP_RegisterForMsgs(selfEntity);
    
      BLE_LOG_INT_TIME(0, BLE_LOG_MODULE_APP, "APP : ---- call GAP_DeviceInit", GAP_PROFILE_CENTRAL);
      // Initialize GAP layer for Central role and register to receive GAP events
      GAP_DeviceInit(GAP_PROFILE_CENTRAL | GAP_PROFILE_PERIPHERAL, selfEntity, addrMode, NULL);
    
      //Read the LE locally supported features
      HCI_LE_ReadLocalSupportedFeaturesCmd();
    
      // Initialize RTLS Services
      RTLSSrv_init(MAX_NUM_BLE_CONNS);
      RTLSSrv_register(RTLSCoordinator_rtlsSrvlMsgCb);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_taskFxn
     *
     * @brief   Application task entry point for the RTLS Coordinator.
     *
     * @param   none
     *
     * @return  events not processed
     */
    static void RTLSCoordinator_taskFxn(uintptr_t a0, uintptr_t a1)
    {
      // Initialize application
      RTLSCoordinator_init();
    
      // Application main loop
      for (;;)
      {
        uint32_t events;
    
        // Waits for an event to be posted associated with the calling thread.
        // Note that an event associated with a thread is posted when a
        // message is queued to the message receive queue of the thread
        events = Event_pend(syncEvent, Event_Id_NONE, RC_ALL_EVENTS,
                            ICALL_TIMEOUT_FOREVER);
    
        if (events)
        {
          ICall_EntityID dest;
          ICall_ServiceEnum src;
          ICall_HciExtEvt *pMsg = NULL;
    
          // Fetch any available messages that might have been sent from the stack
          if (ICall_fetchServiceMsg(&src, &dest,
                                    (void **)&pMsg) == ICALL_ERRNO_SUCCESS)
          {
            uint8 safeToDealloc = TRUE;
    
            if ((src == ICALL_SERVICE_CLASS_BLE) && (dest == selfEntity))
            {
              ICall_Stack_Event *pEvt = (ICall_Stack_Event *)pMsg;
    
              // Check for BLE stack events first
              if (pEvt->signature != 0xffff)
              {
                // Process inter-task message
                safeToDealloc = RTLSCoordinator_processStackMsg((ICall_Hdr *)pMsg);
              }
            }
    
            if (pMsg && safeToDealloc)
            {
              ICall_freeMsg(pMsg);
            }
          }
    
          // If RTOS queue is not empty, process app message
          if (events & RC_QUEUE_EVT)
          {
            while (!Queue_empty(appMsgQueue))
            {
              rcEvt_t *pMsg = (rcEvt_t *)Util_dequeueMsg(appMsgQueue);
              if(pMsg)
              {
                // Process message
                RTLSCoordinator_processAppMsg(pMsg);
    
                // Free the space from the message
                ICall_free(pMsg);
              }
            }
          }
        }
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processStackMsg
     *
     * @brief   Process an incoming task message.
     *
     * @param   pMsg - message to process
     *
     * @return  TRUE if safe to deallocate incoming message, FALSE otherwise.
     */
    static uint8_t RTLSCoordinator_processStackMsg(ICall_Hdr *pMsg)
    {
      uint8_t safeToDealloc = TRUE;
    
      BLE_LOG_INT_INT(0, BLE_LOG_MODULE_APP, "APP : Stack msg status=%d, event=0x%x\n", pMsg->status, pMsg->event);
    
      switch (pMsg->event)
      {
        case GAP_MSG_EVENT:
          RTLSCoordinator_processGapMsg((gapEventHdr_t*) pMsg);
          break;
    
        case L2CAP_SIGNAL_EVENT:
          RTLSCoordinator_processL2CAPSignalEvent((l2capSignalEvent_t *)pMsg);
          break;
    
        case L2CAP_DATA_EVENT:
          RTLSCoordinator_processL2CAPDataEvent((l2capDataEvent_t *)pMsg);
          break;
    
        case HCI_GAP_EVENT_EVENT:
        {
          // Process HCI message
          switch (pMsg->status)
          {
            case HCI_COMMAND_COMPLETE_EVENT_CODE:
            {
              // Parse Command Complete Event for opcode and status
              hciEvt_CmdComplete_t* command_complete = (hciEvt_CmdComplete_t*) pMsg;
    
              //find which command this command complete is for
              switch (command_complete->cmdOpcode)
              {
                case HCI_LE_READ_LOCAL_SUPPORTED_FEATURES:
                {
                  uint8_t featSet[8];
    
                  // Get current feature set from received event (byte 1-8)
                  memcpy( featSet, &command_complete->pReturnParam[1], 8 );
    
                  // Clear the CSA#2 feature bit
                  CLR_FEATURE_FLAG( featSet[1], LL_FEATURE_CHAN_ALGO_2 );
    
                  // Enable CTE
                  SET_FEATURE_FLAG( featSet[2], LL_FEATURE_CONNECTION_CTE_REQUEST );
                  SET_FEATURE_FLAG( featSet[2], LL_FEATURE_CONNECTION_CTE_RESPONSE );
                  SET_FEATURE_FLAG( featSet[2], LL_FEATURE_ANTENNA_SWITCHING_DURING_CTE_RX );
                  SET_FEATURE_FLAG( featSet[2], LL_FEATURE_RECEIVING_CTE );
    
                  // Update controller with modified features
                  HCI_EXT_SetLocalSupportedFeaturesCmd( featSet );
                }
                break;
    
                default:
                  break;
              }
            }
            break;
    
            case HCI_BLE_HARDWARE_ERROR_EVENT_CODE:
            {
              AssertHandler(HAL_ASSERT_CAUSE_HARDWARE_ERROR,0);
            }
            break;
    
            // LE Events
            case HCI_LE_EVENT_CODE:
            {
              hciEvt_BLEChanMapUpdate_t *pCMU = (hciEvt_BLEChanMapUpdate_t*) pMsg;
    
              // Update the host on channel map changes
              if (pCMU->BLEEventCode == HCI_BLE_CHANNEL_MAP_UPDATE_EVENT)
              {
                if (pCMU->connHandle != LINKDB_CONNHANDLE_INVALID)
                {
                  BLE_LOG_INT_INT(0, BLE_LOG_MODULE_APP, "APP : Stack msg HCI_GAP_EVENT_EVENT HCI_LE_EVENT_CODE, HCI_BLE_CHANNEL_MAP_UPDATE_EVENT %d,0x%x\n", pMsg->status, pCMU->BLEEventCode);
                  // Upon param update, resend connection information
                  RTLSCoordinator_processRTLSConnInfo(pCMU->connHandle);
                }
              }
            }
            break;
    
            default:
              break;
          }
          break;
        }
        default:
          break;
      }
    
      return (safeToDealloc);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processAppMsg
     *
     * @brief   Scanner application event processing function.
     *
     * @param   pMsg - pointer to event structure
     *
     * @return  none
     */
    
    //AiRISTA 2023/01/24 - declare these variables here so we can debug
    GapScan_Evt_AdvRpt_t* pAdvRpt;
    uint32_t matches=0,mismatches=0;
    static void RTLSCoordinator_processAppMsg(rcEvt_t *pMsg)
    {
      bool safeToDealloc = TRUE;
    
      if (pMsg->hdr.event <= APP_EVT_BLE_LOG_STRINGS_MAX)
      {
        if (pMsg->hdr.event != RC_EVT_CONN_EVT)
        {
          BLE_LOG_INT_STR(0, BLE_LOG_MODULE_APP, "APP : App msg status=%d, event=%s\n", 0, appEvent_BleLogStrings[pMsg->hdr.event]);
        }
      }
      else
      {
        BLE_LOG_INT_INT(0, BLE_LOG_MODULE_APP, "APP : App msg status=%d, event=0x%x\n", 0, pMsg->hdr.event);
      }
    
      switch (pMsg->hdr.event)
      {
        case RC_EVT_ADV_REPORT:
        {
         //GapScan_Evt_AdvRpt_t* pAdvRpt = (GapScan_Evt_AdvRpt_t*) (pMsg->pData);
            pAdvRpt = (GapScan_Evt_AdvRpt_t*) (pMsg->pData);
    
            //===================================================================
            //AiRISTA 2023/01/24 - comment out original code
    //      char responderScanRsp[] = {'R','T','L','S','R','e','s','p','o','n','d','e','r'};
    //
    //      // Filter results by the responder's scanRsp array
    //      if (memcmp(&pAdvRpt->pData[2], responderScanRsp, sizeof(responderScanRsp)) == 0)
    //      {
    //        RTLSCoordinator_addDeviceInfo(pAdvRpt);
    //      }
          //add code to check for mismatches
    
            if (pAdvRpt->pData[2] == 'S' && pAdvRpt->pData[3] == 'P')
            {
                if (
                        pAdvRpt->addr[0] == pAdvRpt->pData[15] &&
                        pAdvRpt->addr[1] == pAdvRpt->pData[16] &&
                        pAdvRpt->addr[2] == pAdvRpt->pData[17] &&
                        pAdvRpt->addr[3] == pAdvRpt->pData[18] &&
                        pAdvRpt->addr[4] == pAdvRpt->pData[19] &&
                        pAdvRpt->addr[5] == pAdvRpt->pData[20]
                )
                {
                    ++matches;
                }
                else
                {
                    ++mismatches;
                }
            }
    
            if (mismatches > 5)
            {
                uint8_t x = 0;
    
                while(1)
                {
                    x++;
                }
            }
            //===================================================================
    
          // Free report payload data
          if (pAdvRpt->pData != NULL)
          {
            ICall_free(pAdvRpt->pData);
          }
        }
        break;
    
        case RC_EVT_SCAN_DISABLED:
        {
          if(((gapEstLinkReqEvent_t*) pMsg)->hdr.status == SUCCESS)
          {
            // Scan stopped (no more results)
            RTLSCtrl_scanResultEvt(RTLS_SUCCESS, 0, 0);
          }
          else
          {
            // Scan stopped (failed due to wrong parameters)
            RTLSCtrl_scanResultEvt(RTLS_FAIL, 0, 0);
          }
        }
        break;
    
        // Pairing event
        case RC_EVT_PAIR_STATE:
        {
          RTLSCoordinator_processPairState(pMsg->hdr.state, (rcPairStateData_t*)(pMsg->pData));
        }
        break;
    
        // Passcode event
        case RC_EVT_PASSCODE_NEEDED:
        {
          RTLSCoordinator_processPasscode((rcPasscodeData_t *)(pMsg->pData));
        }
        break;
    
        case RC_EVT_ADV_EVT:
        {
          RTLSCoordinator_processAdvEvent((rcGapAdvEventData_t*)(pMsg->pData));
        }
        break;
    
        case RC_EVT_RTLS_CTRL_MSG_EVT:
        {
          RTLSCoordinator_processRtlsCtrlMsg((uint8_t *)pMsg->pData);
        }
        break;
    
        case RC_EVT_RTLS_SRV_MSG_EVT:
        {
          RTLSCoordinator_processRtlsSrvMsg((rtlsSrv_evt_t *)pMsg->pData);
        }
        break;
    
        case RC_EVT_CONN_EVT:
        {
          RTLSCoordinator_processConnEvt((Gap_ConnEventRpt_t *)pMsg->pData);
        }
        break;
    
        default:
          // Do nothing.
        break;
      }
    
      if ((safeToDealloc == TRUE) && (pMsg->pData != NULL))
      {
        ICall_free(pMsg->pData);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processGapMsg
     *
     * @brief   GAP message processing function.
     *
     * @param   pMsg - pointer to event message structure
     *
     * @return  none
     */
    static void RTLSCoordinator_processGapMsg(gapEventHdr_t *pMsg)
    {
      uint16_t connHandle;
    
      switch (pMsg->opcode)
      {
        case GAP_DEVICE_INIT_DONE_EVENT:
        {
          gapDeviceInitDoneEvent_t *pPkt = (gapDeviceInitDoneEvent_t *)pMsg;
    
          if(pPkt->hdr.status == SUCCESS)
          {
            BLE_LOG_INT_TIME(0, BLE_LOG_MODULE_APP, "APP : ---- got GAP_DEVICE_INIT_DONE_EVENT", 0);
            //Setup and start advertising
            RTLSCoordinator_advertInit();
          }
    
          //Setup scanning
          RTLSCoordinator_scanInit();
        }
        break;
    
        case GAP_LINK_ESTABLISHED_EVENT:
        {
          BLE_LOG_INT_TIME(0, BLE_LOG_MODULE_APP, "APP : ---- got GAP_LINK_ESTABLISHED_EVENT", 0);
          // The amount of current connections
          uint8_t numActive = linkDB_NumActive();
    
          connHandle = ((gapEstLinkReqEvent_t *) pMsg)->connectionHandle;
    
          if (connHandle != LINKDB_CONNHANDLE_INVALID && connHandle < MAX_NUM_BLE_CONNS &&
              ((gapEstLinkReqEvent_t *) pMsg)->hdr.status == SUCCESS)
          {
            rcConnCB[connHandle].isActive = TRUE;
    
            HCI_LE_ReadRemoteUsedFeaturesCmd(connHandle);
    
            // We send out the connection information at this point
            // Note: we are not yet connected (will be after pairing)
            RTLSCoordinator_processRTLSConnInfo(connHandle);
    
          }
          else
          {
            // Link failed to establish
            RTLSCtrl_connResultEvt(LINKDB_CONNHANDLE_INVALID, RTLS_LINK_ESTAB_FAIL);
          }
    
          if ((numActive < MAX_NUM_BLE_CONNS))
          {
            // Start advertising since there is room for more connections
            GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
          }
          else
          {
            // Stop advertising since there is no room for more connections
            GapAdv_disable(advHandleLegacy);
          }
        }
        break;
    
        case GAP_LINK_TERMINATED_EVENT:
        {
          BLE_LOG_INT_STR(0, BLE_LOG_MODULE_APP, "APP : GAP msg status=%d, opcode=%s\n", 0, "GAP_LINK_TERMINATED_EVENT");
          connHandle = ((gapTerminateLinkEvent_t *) pMsg)->connectionHandle;
    
          if (connHandle != LINKDB_CONNHANDLE_INVALID && connHandle < MAX_NUM_BLE_CONNS)
          {
            // This connection is inactive
            rcConnCB[connHandle].isActive = FALSE;
    
            // Link terminated
            RTLSCtrl_connResultEvt(connHandle, RTLS_LINK_TERMINATED);
          }
    
          // Start advertising since there is room for more connections
          GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
        }
        break;
    
        case GAP_LINK_PARAM_UPDATE_EVENT:
        {
          BLE_LOG_INT_STR(0, BLE_LOG_MODULE_APP, "APP : GAP msg status=%d, opcode=%s\n", 0, "GAP_LINK_PARAM_UPDATE_EVENT");
          connHandle = ((gapLinkUpdateEvent_t *) pMsg)->connectionHandle;
    
          if (connHandle != LINKDB_CONNHANDLE_INVALID && connHandle < MAX_NUM_BLE_CONNS &&
              ((gapLinkUpdateEvent_t *) pMsg)->hdr.status == SUCCESS)
          {
            // Upon param update, resend connection information
            RTLSCoordinator_processRTLSConnInfo(connHandle);
          }
        }
        break;
    
        default:
          break;
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processPairState
     *
     * @brief   Process the new paring state.
     *
     * @return  none
     */
    static void RTLSCoordinator_processPairState(uint8_t state, rcPairStateData_t* pPairData)
    {
      uint8_t status = pPairData->status;
    
    #ifdef RTLS_DEBUG
      RTLSCtrl_sendDebugEvt("RTLSCoordinator_processPairState", state);
    #endif
    
      switch (state)
      {
        // Once Coordinator and Responder are paired, we can open a COC channel
        case GAPBOND_PAIRING_STATE_COMPLETE:
        case GAPBOND_PAIRING_STATE_ENCRYPTED:
        {
          if (status == SUCCESS)
          {
            // We are paired, open a L2CAP channel to pass data
            if (RTLSCoordinator_openL2CAPChanCoc(pPairData->connHandle) != SUCCESS)
            {
              // We could not establish an L2CAP link, drop the connection
              // We will notify host that this connection is terminated when the GAP_LINK_TERMINATED_EVENT returns
              GAP_TerminateLinkReq(pPairData->connHandle, HCI_DISCONNECT_REMOTE_USER_TERM);
            }
          }
          else
          {
            // We could not establish an L2CAP link, drop the connection
            // We will notify host that this connection is terminated when the GAP_LINK_TERMINATED_EVENT returns
            GAP_TerminateLinkReq(pPairData->connHandle, HCI_DISCONNECT_REMOTE_USER_TERM);
          }
        }
        break;
    
        default:
          break;
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processPasscode
     *
     * @brief   Process the Passcode request.
     *
     * @return  none
     */
    static void RTLSCoordinator_processPasscode(rcPasscodeData_t *pData)
    {
      // This app uses a default passcode. A real-life scenario would handle all
      // pairing scenarios and likely generate this randomly.
      uint32_t passcode = B_APP_DEFAULT_PASSCODE;
    
      // Send passcode response
      GAPBondMgr_PasscodeRsp(pData->connHandle, SUCCESS, passcode);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processAdvEvent
     *
     * @brief   Process advertising event in app context
     *
     * @param   pEventData
     */
    static void RTLSCoordinator_processAdvEvent(rcGapAdvEventData_t *pEventData)
    {
      switch (pEventData->event)
      {
        default:
          break;
      }
    
      // All events have associated memory to free except the insufficient memory
      // event
      if (pEventData->event != GAP_EVT_INSUFFICIENT_MEMORY)
      {
        ICall_free(pEventData->pBuf);
      }
    }
    
    /*********************************************************************
    * @fn      RTLSCoordinator_advertInit
    *
    * @brief   Setup initial advertisement and start advertising from device init.
    *
    * @return  None.
    */
    static void RTLSCoordinator_advertInit(void)
    {
      bStatus_t status = FAILURE;
    
      // Setup and start Advertising
      // For more information, see the GAP section in the User's Guide:
      // http://software-dl.ti.com/lprf/ble5stack-latest/
    
      // Temporary memory for advertising parameters for set #1. These will be copied
      // by the GapAdv module
      GapAdv_params_t advParamLegacy = GAPADV_PARAMS_LEGACY_SCANN_CONN;
    
      BLE_LOG_INT_INT(0, BLE_LOG_MODULE_APP, "APP : ---- call GapAdv_create set=%d,%d\n", 0, 0);
      // Create Advertisement set #1 and assign handle
      status = GapAdv_create(&RTLSCoordinator_advCb, &advParamLegacy, &advHandleLegacy);
      RTLSCOORDINATOR_ASSERT(status == SUCCESS);
    
      // Load advertising data for set #1 that is statically allocated by the app
      status = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_ADV,
                                   sizeof(advertData), advertData);
      RTLSCOORDINATOR_ASSERT(status == SUCCESS);
    
      // Load scan response data for set #1 that is statically allocated by the app
      status = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_SCAN_RSP,
                                   sizeof(scanRspData), scanRspData);
      RTLSCOORDINATOR_ASSERT(status == SUCCESS);
    
      // Set event mask for set #1
      status = GapAdv_setEventMask(advHandleLegacy,
                                   GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
                                   GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
                                   GAP_ADV_EVT_MASK_SET_TERMINATED);
    
      BLE_LOG_INT_TIME(0, BLE_LOG_MODULE_APP, "APP : ---- GapAdv_enable", 0);
      // Enable legacy advertising for set #1
      status = GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
      RTLSCOORDINATOR_ASSERT(status == SUCCESS);
    }
    
    /*********************************************************************
    * @fn      RTLSCoordinator_scanInit
    *
    * @brief   Setup initial device scan settings.
    *
    * @return  None.
    */
    static void RTLSCoordinator_scanInit(void)
    {
      uint8_t temp8;
      uint16_t temp16;
    
      // Setup scanning
      // For more information, see the GAP section in the User's Guide:
      // http://software-dl.ti.com/lprf/ble5stack-latest/
    
      // Register callback to process Scanner events
      GapScan_registerCb(RTLSCoordinator_scanCb, NULL);
    
      // Set Scanner Event Mask
      GapScan_setEventMask(GAP_EVT_SCAN_ENABLED | GAP_EVT_SCAN_DISABLED |
                           GAP_EVT_ADV_REPORT);
    
      // Set Scan PHY parameters
      GapScan_setPhyParams(DEFAULT_SCAN_PHY, SCAN_TYPE_PASSIVE,
                           200, 100);
    
      // Set Advertising report fields to keep
      temp16 = RC_ADV_RPT_FIELDS;
      GapScan_setParam(SCAN_PARAM_RPT_FIELDS, &temp16);
      // Set Scanning Primary PHY
      temp8 = DEFAULT_SCAN_PHY;
      GapScan_setParam(SCAN_PARAM_PRIM_PHYS, &temp8);
      // Set LL Duplicate Filter
      //AiRISTA 2023/01/24
      //Allow Dups
      //temp8 = SCAN_FLT_DUP_ENABLE;
      temp8 = SCAN_FLT_DUP_DISABLE;
      GapScan_setParam(SCAN_PARAM_FLT_DUP, &temp8);
    
      // Set PDU type filter -
      // Only 'Complete' packets are desired.
      // It doesn't matter if received packets are
      // whether Scannable or Non-Scannable, whether Directed or Undirected,
      // whether Connectable or Non-Connectable, whether Scan_Rsp's or Advertisements,
      // and whether Legacy or Extended.
    
      //AiRISTA 2023/01/24
      //Only Extended and Complete Advertisements
      //temp16 = SCAN_FLT_PDU_COMPLETE_ONLY;
      temp16 = SCAN_FLT_PDU_EXTENDED_ONLY | SCAN_FLT_PDU_COMPLETE_ONLY;
      BLE_LOG_INT_TIME(0, BLE_LOG_MODULE_APP, "APP : ---- GapScan_setParam", 0);
      GapScan_setParam(SCAN_PARAM_FLT_PDU_TYPE, &temp16);
    
    
      //AiRISTA 2023/01/24
      //added to Start discovery so we dont rely on host app to drive the actions. All we want to demo is to start one scan and see if we get MAC discrepancies
      //units are in 10 ms
      //scan for 60 secs, 200 results max
      GapScan_enable(0, 6000, 200);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_addDeviceInfo
     *
     * @brief   Add a device to the device discovery result list
     *
     * @return  none
     */
    static void RTLSCoordinator_addDeviceInfo(GapScan_Evt_AdvRpt_t *deviceInfo)
    {
      uint8_t i;
    
      // If result count not at max
      if (scanRes < DEFAULT_MAX_SCAN_RES)
      {
        // Check if device is already in scan results
        for (i = 0; i < scanRes; i++)
        {
          if (memcmp(deviceInfo->addr, scanList[i].addr , B_ADDR_LEN) == 0)
          {
            return;
          }
        }
    
        // Send the device info to RTLS Control
        RTLSCoordinator_processRTLSScanRes(deviceInfo);
    
        // Add addr to scan result list
        memcpy(scanList[scanRes].addr, deviceInfo->addr, B_ADDR_LEN);
        scanList[scanRes].addrType = deviceInfo->addrType;
    
        // Increment scan result count
        scanRes++;
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_advCb
     *
     * @brief   GapAdv module callback
     *
     * @param   pMsg - message to process
     */
    static void RTLSCoordinator_advCb(uint32_t event, void *pBuf, uintptr_t arg)
    {
      rcGapAdvEventData_t *pData = ICall_malloc(sizeof(rcGapAdvEventData_t));
    
      if (pData)
      {
        pData->event = event;
        pData->pBuf = pBuf;
    
        if(RTLSCoordinator_enqueueMsg(RC_EVT_ADV_EVT, SUCCESS, (uint8_t*)pData) != SUCCESS)
        {
          ICall_free(pData);
        }
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_scanCb
     *
     * @brief   Callback called by GapScan module
     *
     * @param   evt - event
     * @param   msg - message coming with the event
     * @param   arg - user argument
     *
     * @return  none
     */
    static void RTLSCoordinator_scanCb(uint32_t evt, void* pMsg, uintptr_t arg)
    {
      uint8_t event;
    
      if (evt & GAP_EVT_ADV_REPORT)
      {
        event = RC_EVT_ADV_REPORT;
      }
      else if (evt & GAP_EVT_SCAN_ENABLED)
      {
        event = RC_EVT_SCAN_ENABLED;
      }
      else if (evt & GAP_EVT_SCAN_DISABLED)
      {
        event = RC_EVT_SCAN_DISABLED;
      }
      else
      {
        return;
      }
    
      if (RTLSCoordinator_enqueueMsg(event, SUCCESS, pMsg) != SUCCESS)
      {
        ICall_free(pMsg);
      }
    }
    
    /*********************************************************************
    * @fn      RTLSCoordinator_passcodeCb
    *
    * @brief   Passcode callback.
    *
    * @param   deviceAddr - pointer to device address
    * @param   connHandle - the connection handle
    * @param   uiInputs - pairing User Interface Inputs
    * @param   uiOutputs - pairing User Interface Outputs
    * @param   numComparison - numeric Comparison 20 bits
    *
    * @return  none
    */
    static void RTLSCoordinator_passcodeCb(uint8_t *deviceAddr, uint16_t connHandle,
                                      uint8_t uiInputs, uint8_t uiOutputs,
                                      uint32_t numComparison)
    {
      rcPasscodeData_t *pData = ICall_malloc(sizeof(rcPasscodeData_t));
    
      // Allocate space for the passcode event.
      if (pData)
      {
        pData->connHandle = connHandle;
        memcpy(pData->deviceAddr, deviceAddr, B_ADDR_LEN);
        pData->uiInputs = uiInputs;
        pData->uiOutputs = uiOutputs;
        pData->numComparison = numComparison;
    
        // Enqueue the event.
        if (RTLSCoordinator_enqueueMsg(RC_EVT_PASSCODE_NEEDED, 0,(uint8_t *) pData) != SUCCESS)
        {
          ICall_free(pData);
        }
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_pairStateCb
     *
     * @brief   Pairing state callback.
     *
     * @param connectionHandle - connection handle of current pairing process
     * @param state - @ref GAPBondMgr_Events
     * @param status - pairing status
     *
     * @return  none
     */
    static void RTLSCoordinator_pairStateCb(uint16_t connHandle, uint8_t state, uint8_t status)
    {
      rcPairStateData_t *pData;
    
      // Allocate space for the event data.
      if ((pData = ICall_malloc(sizeof(rcPairStateData_t))))
      {
        pData->connHandle = connHandle;
        pData->status = status;
    
        // Queue the event.
        if (RTLSCoordinator_enqueueMsg(RC_EVT_PAIR_STATE, state, (uint8_t*) pData) != SUCCESS)
        {
          ICall_free(pData);
        }
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_enqueueMsg
     *
     * @brief   Creates a message and puts the message in RTOS queue.
     *
     * @param   event - message event.
     * @param   state - message state.
     * @param   pData - message data pointer.
     *
     * @return  TRUE or FALSE
     */
    static status_t RTLSCoordinator_enqueueMsg(uint8_t event, uint8_t state,
                                               uint8_t *pData)
    {
      uint8_t success;
      rcEvt_t *pMsg = ICall_malloc(sizeof(rcEvt_t));
    
      // Create dynamic pointer to message.
      if (pMsg)
      {
        pMsg->hdr.event = event;
        pMsg->hdr.state = state;
        pMsg->pData = pData;
    
        // Enqueue the message.
        success = Util_enqueueMsg(appMsgQueue, syncEvent, (uint8_t *)pMsg);
        return (success) ? SUCCESS : FAILURE;
      }
    
      return(bleMemAllocError);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_connEvtCB
     *
     * @brief   Connection event callback.
     *
     * @param   pReport pointer to connection event report
     */
    static void RTLSCoordinator_connEvtCB(Gap_ConnEventRpt_t *pReport)
    {
      // Enqueue the event for processing in the app context.
      if (RTLSCoordinator_enqueueMsg(RC_EVT_CONN_EVT, SUCCESS, (uint8_t *)pReport) != SUCCESS)
      {
        ICall_free(pReport);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processConnEvt
     *
     * @brief   Connection event callback.
     *
     * @param   pReport - pointer to connection event report
     *
     * @return  none
     */
    static void RTLSCoordinator_processConnEvt(Gap_ConnEventRpt_t *pReport)
    {
      // Sanity check
      if (!pReport)
      {
      return;
      }
    
      if (CONNECTION_EVENT_REGISTRATION_CAUSE(FOR_RTLS) && rcConnCB[pReport->handle].isActive)
      {
        rtlsStatus_e status;
    
        // Convert BLE specific status to RTLS Status
        if (pReport->status != GAP_CONN_EVT_STAT_MISSED)
        {
          status = RTLS_SUCCESS;
        }
        else
        {
          status = RTLS_FAIL;
        }
    
    #ifdef RTLS_TEST_CHAN_MAP_DYNAMIC_CHANGE
        // For testing - do dynamic change of the channel map after 10 connection events
        {
            static int connectionEventCount = 0;
    
            if (++connectionEventCount == 10)
            {
              uint8_t chanMap[5] = {0xFF, 0xFF, 0xFF, 0x00, 0x1F};      // unmap channels 24..31
              HCI_LE_SetHostChanClassificationCmd(chanMap);
            }
        }
    #endif //RTLS_TEST_CHAN_MAP_DYNAMIC_CHANGE
    
        RTLSCtrl_syncNotifyEvt(pReport->handle, status, pReport->nextTaskTime, pReport->lastRssi, pReport->channel);
      }
    
      if (pReport != NULL)
      {
        // Free the report once we are done using it
        ICall_free(pReport);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_sendRTLSData
     *
     * @brief   Send RTLS data to the peer
     *
     * @param   pMsg - pointer to the message to send
     *
     * @return  none
     */
    static bStatus_t RTLSCoordinator_sendRTLSData(rtlsPacket_t *pMsg)
    {
      l2capPacket_t pkt;
      bStatus_t status = SUCCESS;
    
      // Sanity check
      if (!pMsg)
      {
        return FAILURE;
      }
    
      // Tell L2CAP the desired Channel ID
      pkt.CID = rcConnCB[pMsg->connHandle].cocCID;
    
      // Allocate space for payload
      pkt.pPayload = L2CAP_bm_alloc(pMsg->payloadLen);
    
      if (pkt.pPayload != NULL)
      {
        // The request is the payload for the L2CAP SDU
        memcpy(pkt.pPayload, pMsg, pMsg->payloadLen);
        pkt.len = pMsg->payloadLen;
        status = L2CAP_SendSDU(&pkt);
    
        // Check that the packet was sent
        if (SUCCESS != status)
        {
          // If SDU wasn't sent, free
          BM_free(pkt.pPayload);
        }
      }
      else
      {
        status = bleMemAllocError;
      }
    
      return (status);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processRTLSScanRes
     *
     * @brief   Process a scan response and forward to RTLS Control
     *
     * @param   deviceInfo - a single scan response
     *
     * @return  none
     */
    static void RTLSCoordinator_processRTLSScanRes(GapScan_Evt_AdvRpt_t *deviceInfo)
    {
      GapScan_Evt_AdvRpt_t *devInfo;
      size_t resSize;
      bleScanInfo_t *scanResult;
    
      // Sanity check
      if (!deviceInfo)
      {
        return;
      }
    
      devInfo = deviceInfo;
    
      // Assign and allocate space
      resSize = sizeof(bleScanInfo_t) + devInfo->dataLen;
      scanResult = (bleScanInfo_t *)ICall_malloc(resSize);
    
      // We could not allocate memory, report to host and exit
      if (!scanResult)
      {
        RTLSCtrl_scanResultEvt(RTLS_OUT_OF_MEMORY, NULL, 0);
        return;
      }
    
      memcpy(scanResult->addr, devInfo->addr, B_ADDR_LEN);
      scanResult->addrType = devInfo->addrType;
      scanResult->eventType = devInfo->evtType;
      scanResult->dataLen = devInfo->dataLen;
      scanResult->rssi = devInfo->rssi;
      scanResult->advSID = devInfo->advSid;
      scanResult->periodicAdvInt = devInfo->periodicAdvInt;
      memcpy(scanResult->pEvtData, devInfo->pData, devInfo->dataLen);
    
      RTLSCtrl_scanResultEvt(RTLS_SUCCESS, (uint8_t*)scanResult, resSize);
    
      ICall_free(scanResult);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processRTLSScanReq
     *
     * @brief   Process a scan request
     *
     * @param   none
     *
     * @return  none
     */
    static void RTLSCoordinator_processRTLSScanReq(void)
    {
      scanRes = 0;
    
      // Start discovery
      GapScan_enable(0, DEFAULT_SCAN_DURATION, DEFAULT_MAX_SCAN_RES);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processRTLSConnReq
     *
     * @brief   Start the connection process with another device
     *
     * @param   bleConnReq - pointer from RTLS control containing connection params
     *
     * @return  none
     */
    static void RTLSCoordinator_processRTLSConnReq(bleConnReq_t *bleConnReq)
    {
      bStatus_t status;
    
      // Sanity check
      if (!bleConnReq)
      {
       return;
      }
    
      //Set connection interval and supervision timeout
      GapInit_setPhyParam(INIT_PHY_1M | INIT_PHY_2M | INIT_PHY_CODED, INIT_PHYPARAM_CONN_INT_MAX, bleConnReq->connInterval);
      GapInit_setPhyParam(INIT_PHY_1M | INIT_PHY_2M | INIT_PHY_CODED, INIT_PHYPARAM_CONN_INT_MIN, bleConnReq->connInterval);
      GapInit_setPhyParam(INIT_PHY_1M | INIT_PHY_2M | INIT_PHY_CODED, INIT_PHYPARAM_SUP_TIMEOUT, DEFAULT_UPDATE_CONN_TIMEOUT);
    
      status = GapInit_connect(bleConnReq->addrType & MASK_ADDRTYPE_ID, bleConnReq->addr, DEFAULT_INIT_PHY, 0);
      if (status != SUCCESS)
      {
        // Notify RTLS Control that we are not connected
        RTLSCtrl_connResultEvt(0, RTLS_FAIL);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processRTLSConnRes
     *
     * @brief   Process a connection established event - send conn info to RTLS Control
     *
     * @param   connHandle - connection handle
     *
     * @return  none
     */
    static void RTLSCoordinator_processRTLSConnInfo(uint16_t connHandle)
    {
      hciActiveConnInfo_t connInfo;
      linkDBInfo_t addrInfo;
      bleConnInfo_t rtlsConnInfo = {0};
    
      // Get BD Address of the requested Responder
      linkDB_GetInfo(connHandle, &addrInfo);
      memcpy(rtlsConnInfo.addr, addrInfo.addr, B_ADDR_LEN);
    
      // Get current active connection information
      HCI_EXT_GetActiveConnInfoCmd(connHandle, &connInfo);
    
      BLE_LOG_INT_INT(0, BLE_LOG_MODULE_APP, "APP : RTLSConnInfo hopValue=%d, currChan=%d\n", connInfo.hopValue, connInfo.nextChan);
      rtlsConnInfo.connHandle = connHandle;
      rtlsConnInfo.accessAddr = connInfo.accessAddr;
      rtlsConnInfo.connRole = addrInfo.connRole;
      rtlsConnInfo.connInterval = connInfo.connInterval;
      rtlsConnInfo.currChan = connInfo.nextChan;
      rtlsConnInfo.hopValue = connInfo.hopValue;
      rtlsConnInfo.cSCA = connInfo.mSCA;
      rtlsConnInfo.crcInit = BUILD_UINT32(connInfo.crcInit[0], connInfo.crcInit[1], connInfo.crcInit[2], 0);
      memcpy(rtlsConnInfo.chanMap, connInfo.chanMap, LL_NUM_BYTES_FOR_CHAN_MAP);
    
      RTLSCtrl_connInfoEvt((uint8_t*)&rtlsConnInfo, sizeof(bleConnInfo_t));
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_openL2CAPChanCoc
     *
     * @brief   Opens a communication channel between RTLS Coordinator/Responder
     *
     * @param   connHandle - connection handle
     *
     * @return  status - 0 = success, 1 = failed
     */
    static bStatus_t RTLSCoordinator_openL2CAPChanCoc(uint16_t connHandle)
    {
      uint8_t ret;
      l2capPsm_t psm;
      l2capPsmInfo_t psmInfo;
    
      if (L2CAP_PsmInfo(RTLS_PSM, &psmInfo) == INVALIDPARAMETER)
      {
        // Prepare the PSM parameters
        psm.initPeerCredits = 0xFFFF;
        psm.maxNumChannels = MAX_NUM_BLE_CONNS;
        psm.mtu = RTLS_PDU_SIZE;
        psm.peerCreditThreshold = 0;
        psm.pfnVerifySecCB = NULL;
        psm.psm = RTLS_PSM;
        psm.taskId = ICall_getLocalMsgEntityId(ICALL_SERVICE_CLASS_BLE_MSG, selfEntity);
    
        // Register PSM with L2CAP task
        ret = L2CAP_RegisterPsm(&psm);
    
        if (ret == SUCCESS)
        {
          // Send the connection request to RTLS responder
          ret = L2CAP_ConnectReq(connHandle, RTLS_PSM, RTLS_PSM);
        }
      }
      else
      {
        // Send the connection request to RTLS responder
        ret = L2CAP_ConnectReq(connHandle, RTLS_PSM, RTLS_PSM);
      }
    
      return ret;
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processL2CAPSignalEvent
     *
     * @brief   Handle L2CAP signal events
     *
     * @param   pMsg - pointer to the signal that was received
     *
     * @return  none
     */
    static void RTLSCoordinator_processL2CAPSignalEvent(l2capSignalEvent_t *pMsg)
    {
      // Sanity check
      if (!pMsg)
      {
        return;
      }
    
      switch (pMsg->opcode)
      {
        case L2CAP_CHANNEL_ESTABLISHED_EVT:
        {
          l2capChannelEstEvt_t *pEstEvt = &(pMsg->cmd.channelEstEvt);
    
          // Connection established, save the CID
          if (pMsg->connHandle != LINKDB_CONNHANDLE_INVALID && pMsg->connHandle < MAX_NUM_BLE_CONNS)
          {
            rcConnCB[pMsg->connHandle].cocCID = pEstEvt->CID;
    
            // Give max credits to the other side
            L2CAP_FlowCtrlCredit(pEstEvt->CID, 0xFFFF);
    
            // L2CAP establishing a COC channel means that both Coordinator and Responder are ready
            // Tell RTLS Control that we are ready for more commands
            RTLSCtrl_connResultEvt(pMsg->connHandle, RTLS_SUCCESS);
          }
          else
          {
            // We could not establish an L2CAP link, drop the connection
            RTLSCtrl_sendDebugEvt((uint8_t *)"L2CAP COC: could not establish", pMsg->connHandle);
            GAP_TerminateLinkReq(pMsg->connHandle, HCI_DISCONNECT_REMOTE_USER_TERM);
          }
        }
        break;
    
        case L2CAP_SEND_SDU_DONE_EVT:
        {
          if (pMsg->hdr.status == SUCCESS)
          {
            RTLSCtrl_dataSentEvt(pMsg->connHandle, RTLS_SUCCESS);
          }
          else
          {
            RTLSCtrl_dataSentEvt(pMsg->connHandle, RTLS_FAIL);
          }
        }
        break;
    
        case L2CAP_CHANNEL_TERMINATED_EVT:
        {
          // Terminate the connection
          GAP_TerminateLinkReq(pMsg->connHandle, HCI_DISCONNECT_REMOTE_USER_TERM);
          RTLSCtrl_sendDebugEvt((uint8_t *)"L2CAP COC: terminated connHandle: ", pMsg->connHandle);
        }
        break;
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processL2CAPDataEvent
     *
     * @brief   Handles incoming L2CAP data
     *          RTLS Coordinator does not expect any incoming data
     *
     * @param   pMsg - pointer to the signal that was received
     *
     * @return  none
     */
    static void RTLSCoordinator_processL2CAPDataEvent(l2capDataEvent_t *pMsg)
    {
      // Sanity check
      if (!pMsg)
      {
        return;
      }
    
      // Free the payload (must use BM_free here according to L2CAP documentation)
      BM_free(pMsg->pkt.pPayload);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_enableRtlsSync
     *
     * @brief   This function is used by RTLS Control to notify the RTLS application
     *          to start sending synchronization events (for BLE this is a connection event)
     *
     * @param   enable - start/stop synchronization
     *
     * @return  none
     */
    static void RTLSCoordinator_enableRtlsSync(rtlsEnableSync_t *enable)
    {
      bStatus_t status = RTLS_FALSE;
    
      if (enable->enable == RTLS_TRUE)
      {
        if (!CONNECTION_EVENT_IS_REGISTERED)
        {
          status = Gap_RegisterConnEventCb(RTLSCoordinator_connEvtCB, GAP_CB_REGISTER, GAP_CB_CONN_EVENT_ALL, LINKDB_CONNHANDLE_ALL);
        }
    
        if (status == SUCCESS)
        {
          CONNECTION_EVENT_REGISTER_BIT_SET(FOR_RTLS);
        }
      }
      else if (enable->enable == RTLS_FALSE)
      {
        CONNECTION_EVENT_REGISTER_BIT_REMOVE(FOR_RTLS);
    
        // If there is nothing registered to the connection event, request to unregister
        if (!CONNECTION_EVENT_IS_REGISTERED)
        {
          Gap_RegisterConnEventCb(RTLSCoordinator_connEvtCB, GAP_CB_UNREGISTER, GAP_CB_CONN_EVENT_ALL, LINKDB_CONNHANDLE_ALL);
        }
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_terminateLinkReq
     *
     * @brief   Terminate active link
     *
     * @param   termInfo - information about the connection to terminate
     *
     * @return  none
     */
    static void RTLSCoordinator_terminateLinkReq(rtlsTerminateLinkReq_t *termInfo)
    {
      if (termInfo->connHandle != LINKDB_CONNHANDLE_INVALID && termInfo->connHandle < MAX_NUM_BLE_CONNS)
      {
        L2CAP_DisconnectReq(rcConnCB[termInfo->connHandle].cocCID);
      }
      else
      {
        RTLSCtrl_sendDebugEvt((uint8_t *)"Connection Handle invalid", LINKDB_CONNHANDLE_INVALID);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_setCreateSyncParams
     *
     * @brief   Configure sync parameters
     *
     * @param   pParams - Pointer to create sync parameters
     *
     * @return  none
     */
    static void RTLSCoordinator_setCreateSyncParams(rtlsCreateSyncParams_t *pParams)
    {
      uint32_t status;
      GapScan_PeriodicAdvCreateSyncParams_t pSyncParams;
    
      pSyncParams.options = pParams->options;
      pSyncParams.advAddrType = pParams->advAddrType;
      MAP_osal_memcpy(pSyncParams.advAddress, pParams->advAddress, B_ADDR_LEN);
      pSyncParams.skip = pParams->skip;
      pSyncParams.syncTimeout = pParams->syncTimeout;
      pSyncParams.syncCteType = pParams->syncCteType;
    
      status = GapScan_PeriodicAdvCreateSync(pParams->advSID, &pSyncParams);
    
      if( status != SUCCESS)
      {
        RTLSCtrl_sendDebugEvt((uint8_t *)"Set create sync params failed", status);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_syncCancelCmd
     *
     * @brief   Cancels the create sync command
     *
     * @param   none
     *
     * @return  none
     */
    static void RTLSCoordinator_syncCancelCmd( void )
    {
      GapScan_PeriodicAdvCreateSyncCancel();
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_terminateSync
     *
     * @brief   Terminate synchronization with the periodic advertising
     *          identified by the syncHandle given
     *
     * @param   handle - The syncHandle of the periodic advertising
     *
     * @return  none
     */
    static void RTLSCoordinator_terminateSync(rtlsTerminateSync_t *handle)
    {
      uint32_t status;
    
      status = GapScan_PeriodicAdvTerminateSync(handle->syncHandle);
    
      if( status != SUCCESS)
      {
        RTLSCtrl_sendDebugEvt((uint8_t *)"Terminate sync failed", status);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_periodicReceiveEnable
     *
     * @brief   Disable/Enable periodic advertising report from the periodic
     *          advetising identified by the syncHandle given
     *
     * @param   pParams - The parameter given to enable/disable the periodic
     *                    reports
     *
     * @return  none
     */
    static void RTLSCoordinator_periodicReceiveEnable(rtlsReceiveEnableParams_t *pParams)
    {
      uint32_t status;
    
      status = GapScan_SetPeriodicAdvReceiveEnable(pParams->syncHandle, pParams->enable);
    
      if( status != SUCCESS)
      {
        RTLSCtrl_sendDebugEvt((uint8_t *)"Receive enable failed", status);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_addDeviceToPeriodicAdvList
     *
     * @brief   Adding a device to the advertisers list
     *
     * @param   pParams - Device information
     *
     * @return  none
     */
    static void RTLSCoordinator_addDeviceToPeriodicAdvList(rtlsAdvListDeviceParams_t *pParams)
    {
      uint32_t status;
      rtlsAdvListDeviceParams_t *pAddParams = (rtlsAdvListDeviceParams_t *)pParams;
    
      status = GapScan_AddDeviceToPeriodicAdvList(pAddParams->advAddrType, pAddParams->advAddress, pAddParams->advSID);
    
      if( status != SUCCESS)
      {
        RTLSCtrl_sendDebugEvt((uint8_t *)"Add to adv list failed", status);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_removeDeviceFromPeriodicAdvList
     *
     * @brief   Removing a device from the advertisers list
     *
     * @param   pParams - Device information
     *
     * @return  none
     */
    static void RTLSCoordinator_removeDeviceFromPeriodicAdvList(rtlsAdvListDeviceParams_t *pParams)
    {
      uint32_t status;
      rtlsAdvListDeviceParams_t *pAddParams = (rtlsAdvListDeviceParams_t *)pParams;
    
      status = GapScan_RemoveDeviceFromPeriodicAdvList(pAddParams->advAddrType, pAddParams->advAddress, pAddParams->advSID);
    
      if( status != SUCCESS)
      {
        RTLSCtrl_sendDebugEvt((uint8_t *)"Remove from adv list failed", status);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_readPeriodicAdvListSize
     *
     * @brief   Read the advertisers list size
     *
     * @param   none
     *
     * @return  none
     */
    static void RTLSCoordinator_readPeriodicAdvListSize( void )
    {
      GapScan_ReadPeriodicAdvListSize();
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_clearPeriodicAdvList
     *
     * @brief   Clear the advertisers list
     *
     * @param   none
     *
     * @return  none
     */
    static void RTLSCoordinator_clearPeriodicAdvList( void )
    {
      GapScan_ClearPeriodicAdvList();
    }
    
    #ifdef RTLS_CTE
    /*********************************************************************
     * @fn      RTLSCoordinator_setAoaParamsReq
     *
     * @brief   Configure AoA parameters to the BLE Stack
     *
     * @param   config - Parameters to configure
     *
     * @return  none
     */
    static void RTLSCoordinator_setAoaParamsReq(rtlsAoaConfigReq_t *pConfig)
    {
      bStatus_t status;
      // Initialize GPIO's specified in sysConfig or in ble_user_config.c (antennaTbl)
      // Initialize one of the antenna ID's as the main antenna (in this case the first antenna in the pattern)
      status = RTLSSrv_initAntArray(pConfig->pAntPattern[0]);
    
      if (status == FAILURE)
      {
        RTLSCtrl_sendDebugEvt((uint8_t *)"Antenna array configuration invalid", 0);
        AssertHandler(HAL_ASSERT_CAUSE_HARDWARE_ERROR,0);
      }
    
      // Configure AoA receiver parameters
      RTLSSrv_setConnCteReceiveParams(pConfig->connHandle,
                                      pConfig->samplingEnable,
                                      pConfig->slotDurations,
                                      pConfig->numAnt,
                                      pConfig->pAntPattern);
    
      // Configure sample accuracy
      RTLSSrv_setCteSampleAccuracy(pConfig->connHandle,
                                   pConfig->sampleRate,
                                   pConfig->sampleSize,
                                   pConfig->sampleRate,
                                   pConfig->sampleSize,
                                   pConfig->sampleCtrl);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_enableAoaReq
     *
     * @brief   Enable sampling AoA
     *
     * @param   config - Parameters to configure
     *
     * @return  none
     */
    static void RTLSCoordinator_enableAoaReq(rtlsAoaEnableReq_t *pReq)
    {
      // Sanity check
      if (pReq == NULL)
      {
        return;
      }
    
      // Request CTE from our peer
      RTLSSrv_setConnCteRequestEnableCmd(pReq->connHandle,
                                         pReq->enableAoa,
                                         pReq->cteInterval,
                                         pReq->cteLength,
                                         RTLSSRV_CTE_TYPE_AOA);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_CLAoaSamplingEnableReq
     *
     * @brief   Enable sampling AoA
     *
     * @param   config - Parameters to configure
     *
     * @return  none
     */
    static void RTLSCoordinator_CLAoaSamplingEnableReq(rtlsCLAoaEnableReq_t *pReq)
    {
      bStatus_t status;
      uint8_t cmdStatus;
      uint16_t syncHandle;
    
      // Sanity check
      if (pReq == NULL)
      {
        return;
      }
    
      // Initialize GPIO's specified in ble_user_config.c (antennaTbl)
      // Initialize one of the antenna ID's as the main antenna (in this case the first antenna in the pattern)
      status = RTLSSrv_initAntArray(pReq->pAntPattern[0]);
    
      if (status == FAILURE)
      {
        RTLSCtrl_sendDebugEvt((uint8_t *)"Antenna array configuration invalid", 0);
        AssertHandler(HAL_ASSERT_CAUSE_HARDWARE_ERROR,0);
      }
    
      // Mask the syncHandle to notify the controller it is CL CTE req
      syncHandle = pReq->syncHandle | SYNC_HANDLE_MASK;
    
      // Configure sample accuracy
      RTLSSrv_setCteSampleAccuracy( syncHandle,
                                    pReq->sampleRate,
                                    pReq->sampleSize,
                                    pReq->sampleRate,
                                    pReq->sampleSize,
                                    pReq->sampleCtrl );
    
      // Request connectionless CTE from our peer
      cmdStatus = RTLSSrv_setCLCteSamplingEnableCmd( pReq->syncHandle,
                                                     pReq->enable,
                                                     pReq->slotDuration,
                                                     pReq->maxSampleCte,
                                                     pReq->numAnt,
                                                     pReq->pAntPattern );
    
      if( cmdStatus != SUCCESS)
      {
        RTLSCtrl_sendDebugEvt((uint8_t *)"CL AoA enable request failed", cmdStatus);
        // We need to remove the CL AoA node
        RTLSCtrl_processClAoaEnableEvt(RTLSSRV_SET_CL_IQ_SAMPLING_ENABLE,
                                       cmdStatus,
                                       pReq->syncHandle);
      }
    }
    #endif /* RTLS_CTE */
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processRTLSUpdateConnInterval
     *
     * @brief   Update connection interval
     *
     * @param   updateReq - pointer from RTLS control containing connection params
     *
     * @return  none
     */
    static void RTLSCoordinator_processRTLSUpdateConnInterval(rtlsUpdateConnIntReq_t *updateReq)
    {
      gapUpdateLinkParamReq_t params;
      linkDBInfo_t linkInfo;
    
      // Sanity check
      if (!updateReq)
      {
        return;
      }
    
      if (linkDB_GetInfo(updateReq->connHandle, &linkInfo) == SUCCESS)
      {
        params.connLatency = linkInfo.connLatency;
        params.connTimeout = linkInfo.connTimeout;
        params.connectionHandle = updateReq->connHandle;
    
        // Min/Max set to the same value
        params.intervalMax = updateReq->connInterval;
        params.intervalMin = updateReq->connInterval;
    
        GAP_UpdateLinkParamReq(&params);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processRtlsCtrlMsg
     *
     * @brief   Handle processing messages from RTLS Control
     *
     * @param   msg - a pointer to the message
     *
     * @return  none
     */
    static void RTLSCoordinator_processRtlsCtrlMsg(uint8_t *pMsg)
    {
      rtlsCtrlReq_t *pReq;
    
      // Sanity check
      if (!pMsg)
      {
        return;
      }
    
      // Cast to appropriate struct
      pReq = (rtlsCtrlReq_t *)pMsg;
    
      if (pReq->reqOp <= RTLS_REQ_BLE_LOG_STRINGS_MAX)
      {
        BLE_LOG_INT_STR(0, BLE_LOG_MODULE_APP, "APP : RTLS msg status=%d, event=%s\n", 0, rtlsReq_BleLogStrings[pReq->reqOp]);
      }
      else
      {
        BLE_LOG_INT_INT(0, BLE_LOG_MODULE_APP, "APP : RTLS msg status=%d, event=0x%x\n", 0, pReq->reqOp);
      }
    
      switch(pReq->reqOp)
      {
        case RTLS_REQ_CONN:
        {
          RTLSCoordinator_processRTLSConnReq((bleConnReq_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_SCAN:
        {
          RTLSCoordinator_processRTLSScanReq();
        }
        break;
    
        case RTLS_REQ_ENABLE_SYNC:
        {
          RTLSCoordinator_enableRtlsSync((rtlsEnableSync_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_SEND_DATA:
        {
          RTLSCoordinator_sendRTLSData((rtlsPacket_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_TERMINATE_LINK:
        {
          RTLSCoordinator_terminateLinkReq((rtlsTerminateLinkReq_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_SET_CREATE_SYNC_PARAMS:
        {
          RTLSCoordinator_setCreateSyncParams((rtlsCreateSyncParams_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_CREATE_SYNC_CANCEL:
        {
          RTLSCoordinator_syncCancelCmd();
        }
        break;
    
        case RTLS_REQ_TERMINATE_SYNC:
        {
          RTLSCoordinator_terminateSync((rtlsTerminateSync_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_PERIODIC_RECEIVE_ENABLE:
        {
          RTLSCoordinator_periodicReceiveEnable((rtlsReceiveEnableParams_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_ADD_DEVICE_ADV_LIST:
        {
          RTLSCoordinator_addDeviceToPeriodicAdvList((rtlsAdvListDeviceParams_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_REMOVE_DEVICE_ADV_LIST:
        {
          RTLSCoordinator_removeDeviceFromPeriodicAdvList((rtlsAdvListDeviceParams_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_READ_ADV_LIST_SIZE:
        {
          RTLSCoordinator_readPeriodicAdvListSize();
        }
        break;
    
        case RTLS_REQ_CLEAR_ADV_LIST:
        {
          RTLSCoordinator_clearPeriodicAdvList();
        }
        break;
    
        case RTLS_REQ_UPDATE_CONN_INTERVAL:
        {
          RTLSCoordinator_processRTLSUpdateConnInterval((rtlsUpdateConnIntReq_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_GET_ACTIVE_CONN_INFO:
        {
          rtlsGetActiveConnInfo_t *pConnInfoReq = (rtlsGetActiveConnInfo_t *)pReq->pData;
    
          if (pConnInfoReq)
          {
            RTLSCoordinator_processRTLSConnInfo(pConnInfoReq->connHandle);
          }
        }
        break;
    
    #ifdef RTLS_CTE
        case RTLS_REQ_SET_AOA_PARAMS:
        {
          RTLSCoordinator_setAoaParamsReq((rtlsAoaConfigReq_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_AOA_ENABLE:
        {
          RTLSCoordinator_enableAoaReq((rtlsAoaEnableReq_t *)pReq->pData);
        }
        break;
    
        case RTLS_REQ_CL_AOA_ENABLE:
        {
          RTLSCoordinator_CLAoaSamplingEnableReq((rtlsCLAoaEnableReq_t *)pReq->pData);
        }
        break;
    #endif /* RTLS_CTE */
    
        default:
          break;
      }
    
      // Free the payload
      if (pReq->pData)
      {
        ICall_free(pReq->pData);
      }
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_processRtlsSrvMsg
     *
     * @brief   Handle processing messages from RTLS Services host module
     *
     * @param   pEvt - a pointer to the event
     *
     * @return  none
     */
    static void RTLSCoordinator_processRtlsSrvMsg(rtlsSrv_evt_t *pEvt)
    {
      if (!pEvt)
      {
        return;
      }
    
      BLE_LOG_INT_INT(0, BLE_LOG_MODULE_APP, "APP : RTLSsrv msg status=%d, event=0x%x\n", 0, pEvt->evtType);
      switch (pEvt->evtType)
      {
        case RTLSSRV_ANTENNA_INFORMATION_EVT:
        {
          // This is for demonstration purposes - we could either use RTLSCtrl_sendDebugEvent
          // Or read the information by using a debugger
          // rtlsSrv_antennaInfo_t *pAntInfo = (rtlsSrv_antennaInfo_t)pEvt->evtData;
        }
        break;
    
        case RTLSSRV_ERROR_EVT:
        {
          rtlsSrv_errorEvt_t *pError = (rtlsSrv_errorEvt_t *)pEvt->evtData;
          RTLSCtrl_sendDebugEvt((uint8_t *)"RTLS Services Error", (uint32_t)pError->errCause);
        }
        break;
    
        case RTLSSRV_READ_PERIODIC_LIST_SIZE_EVT:
        {
          RTLSCtrl_sendPeriodicListSize(pEvt->evtData);
        }
        break;
    
        case RTLSSRV_SYNC_EST_EVT:
        {
          rtlsSrv_SyncEstEvt_t *pEvent = (rtlsSrv_SyncEstEvt_t *)pEvt->evtData;
    
          RTLSCtrl_processSyncEstEvt(pEvent->opcode,
                                     pEvent->status,
                                     pEvent->syncHandle,
                                     pEvent->advSid,
                                     pEvent->advAddrType,
                                     pEvent->advAddress,
                                     pEvent->advPhy,
                                     pEvent->periodicAdvInt,
                                     pEvent->advClockAccuracy);
        }
        break;
    
        case RTLSSRV_SYNC_LOST_EVT:
        {
          rtlsSrv_SyncLostEvt_t *pEvent = (rtlsSrv_SyncLostEvt_t *)pEvt->evtData;
    
          RTLSCtrl_processSyncLostEvt(pEvent->opcode,
                                      pEvent->syncHandle);
        }
        break;
    
        case RTLSSRV_PERIODIC_ADV_TERMINATE_SYNC:
        {
          RTLSCtrl_processTerminateSyncEvt();
        }
        break;
    
        case RTLSSRV_PERIODIC_ADV_RPT:
        {
          rtlsSrv_PeriodicAdvRpt_t *pReport = (rtlsSrv_PeriodicAdvRpt_t *)pEvt->evtData;
    
          RTLSCTRL_processPeriodicAdvReport(pReport->opcode,
                                            pReport->syncHandle,
                                            pReport->txPower,
                                            pReport->rssi,
                                            pReport->cteType,
                                            pReport->dataStatus,
                                            pReport->dataLen,
                                            pReport->pData);
    
          if(pReport->pData != NULL)
          {
            ICall_free(pReport->pData);
          }
        }
        break;
    
    #ifdef RTLS_CTE
        case RTLSSRV_CONNECTION_CTE_IQ_REPORT_EVT:
        {
          rtlsSrv_connectionIQReport_t *pReport = (rtlsSrv_connectionIQReport_t *)pEvt->evtData;
    
          RTLSAoa_processAoaResults(pReport->connHandle,
                                    pReport->rssi,
                                    pReport->dataChIndex,
                                    pReport->sampleCount,
                                    pReport->sampleRate,
                                    pReport->sampleSize,
                                    pReport->sampleCtrl,
                                    pReport->slotDuration,
                                    pReport->numAnt,
                                    pReport->iqSamples);
        }
        break;
    
        case RTLSSRV_CTE_REQUEST_FAILED_EVT:
        {
          rtlsSrv_cteReqFailed_t *pReqFail = (rtlsSrv_cteReqFailed_t *)pEvt->evtData;
          RTLSCtrl_sendDebugEvt((uint8_t *)"RTLS Services CTE Req Fail", (uint32_t)pReqFail->status);
    
        }
        break;
    
        case RTLSSRV_CL_AOA_ENABLE_EVT:
        {
          rtlsSrv_ClAoAEnableEvt_t *pEvent = (rtlsSrv_ClAoAEnableEvt_t *)pEvt->evtData;
          RTLSCtrl_processClAoaEnableEvt(pEvent->opcode,
                                         pEvent->status,
                                         pEvent->syncHandle);
        }
        break;
    
        case RTLSSRV_CL_CTE_IQ_REPORT_EVT:
        {
          rtlsSrv_clIQReport_t *pReport = (rtlsSrv_clIQReport_t *)pEvt->evtData;
    
          RTLSAoa_processAoaResults( pReport->syncHandle,
                                     pReport->rssi,
                                     pReport->channelIndex,
                                     pReport->sampleCount,
                                     pReport->sampleRate,
                                     pReport->sampleSize,
                                     pReport->sampleCtrl,
                                     pReport->slotDuration,
                                     pReport->numAnt,
                                     pReport->iqSamples );
        }
        break;
    #endif /* RTLS_CTE */
    
        default:
          break;
      }
    
      // Free the payload
      if (pEvt->evtData)
      {
        ICall_free(pEvt->evtData);
      }
    }
    
    
    /*********************************************************************
     * @fn      RTLSCoordinator_rtlsCtrlMsgCb
     *
     * @brief   Callback given to RTLS Control
     *
     * @param  cmd - the command to be enqueued
     *
     * @return  none
     */
    void RTLSCoordinator_rtlsCtrlMsgCb(uint8_t *cmd)
    {
      // Enqueue the message to switch context
      RTLSCoordinator_enqueueMsg(RC_EVT_RTLS_CTRL_MSG_EVT, SUCCESS, (uint8_t *)cmd);
    }
    
    /*********************************************************************
     * @fn      RTLSCoordinator_rtlsSrvlMsgCb
     *
     * @brief   Callback given to RTLS Services
     *
     * @param   pRtlsSrvEvt - the command to be enqueued
     *
     * @return  none
     */
    void RTLSCoordinator_rtlsSrvlMsgCb(rtlsSrv_evt_t *pRtlsSrvEvt)
    {
      // Enqueue the message to switch context
      RTLSCoordinator_enqueueMsg(RC_EVT_RTLS_SRV_MSG_EVT, SUCCESS, (uint8_t *)pRtlsSrvEvt);
    }
    
    /*********************************************************************
    *********************************************************************/
    

    Keep in mind, this is intended to be pairs with "simple_peripheral_CC26X2R1_LAUNCHXL_tirtos7_ticlang", and i will attach that here. The changes in this project are to add the MAC address inside the adv data bytes, then code to make the advertisement extended  (not legacy). Notice, you had some indexes mismatched in your example, and I have fixed that in the below project:

    simple_peripheral_CC26X2R1_LAUNCHXL_tirtos7_ticlang.zip

    this is what i mean about the indexes, you counted the comment line as a byte index, I have adjusted this in the attached simple periph project - you need this project as this is the one I modified to adv extended vs legacy

    1. start with stock rtls_coordinator, and overwrite the c file i am sending you. Run that one onLaunchPad. I did not add any printing to work, I just debugged that interactively and when tracing through, I could see mismatches variable being set (i added a spin lock breakpoint that is getting hit)

    2. run the simple periph on 2 x Launch Pads, make sure you give them different MACs

    3. debug the rtls_coordinator, and notice this breakpoint is being hit after about 30-40 secs of the app running:

    Please keep us posted when you are able to replicate and more importantly what do you think is causing this.

    We believe discrepancies like this affect AoA accuracy down the line (but this is after the syncs happen and IQ samples are being detected). Right now, there is no syncing taking place, no AoA IQ samples because this is stock rtls coordinator, and we are not running any host to drive things.

    Looking forward to your response

    Thanks,

    Ivan

  • Hi Ivan,

    Thank you for the project and providing files that can easily be dropped into the SDK project. I will attempt to build the project and test today and get back to you tomorrow.

    Best Regards,

    Jan

  • Hi Ivan,

    I was able to reproduce the behavior using your example and provided code. I was also able to verify that it only happens when the two simple_peripheral launchpads are turned on. My first thought is to try to modify the scanning parameters and make them match the simple_central example we had. To confirm, you were not able to see the issue using simple_central and simple_peripheral (with extended advertisements)? If so, then as a test could you try changing the scanning parameters of the coordinator example to match the simple_central and retest?

    Best Regards,

    Jan

  • Jan,

    I am glad you could see the mismatches. If possible, can we escalate this for TI to troubleshoot further?

    To summarize, we have 2 (or more) extended advertising clients (based off simple_peripheral), and 1 scanner (based of rtls_coordinator), no syncing, no connections, just scanning, and it seems the actual results are mixed up where there are multiple advertisers.

    yes, I did not see the issue with simple_central and simple_peripheral with extended advertisements. I will try with same scan params as i used simple_central (it was whatever the default are i believe), but I believe the scan param are not the cause of this.

    The cause has to be inside RTLS coordinator project where AoA files are included and the multiple antennas even though with the version of RTLS coordinator I shared, we are not doing anything beyond simple scanning. This is where I cannot explain why it is happening, and I am seeking your help.

    We were able to catch this when we were testing with actual AoA data, IQ samples, and eventually angles - it was rather accurate with 1-2 tags, up to maybe 3-4, but when we started more tags they all lingered around sporadically. This when we tried taking steps back and noticed these discrepancies during scanning (before any syncs, AoA IQ data to come into play), and we believe these carry through later in the process and mixup the IQ samples and then all angles are getting mixed up - this is just a theory.

    Please let us know if you can involve more TI resources on this and try to explain it

    Thanks,

    Ivan S.

  • Hi Ivan,

    Thank you for the detailed summary. I will file a ticket with the provided information and continue to debut his on my side. I do not think this is expected behavior and in our testing we have shown that it is localized to the coordinator project. I truly apologize for any inconvenience this may be causing. I will update you early next week (Monday or Tuesday) with any findings I have made.

    Best Regards,

    Jan

  • Hi Jan,

    Do you have any updates?

    We are standing by, this is important and time sensitive.

    Thank you,

    Ivan S.

  • Hi Ivan,

    I did some more testing today. I saw that changing the scanning parameters to the simple_central scanning parameters has no impact on the behavior. This further signals that the issue must be in the AOA logic. I will continue to work with the team on this to see if we are able to find the root cause and fix or provide a workaround. I will continue to update you frequently as we continue our investigation. I truly apologize for any inconvenience this may be causing.

    Best Regards,

    Jan

  • Hi Ivan,

    I have further discussed the behavior with the team and we believe we have found a workaround that may be helpful. We have two possible workarounds for this. I have listed  them below:

    1. Provide each advertiser with its own SetID (SID) ensuring no advertiser has the same SID. I tested this for several minutes and did not encounter any mismatch

    2. Change the channel map such that each advertiser is advertising on a different channel. I did not get a chance to test this in-depth, but we believe this should work as well.

    Let me know if any of these workaround work on your end. The team and I have confirmed that this issue is located in the AOA/RTLS backend. I truly apologize for any inconvenience this behavior may be causing and i hope the provided workarounds are sufficient.

    Best Regards,

    Jan

  • Hi Jan,


    Thanks for the suggestions.

    We will try #1, will try to randomize the SID on the tag/responder firmware. I see SID is defined as one byte, so there are some limitations here as even with sid = random (255), there will be possibility for collisions, theoretically speaking.

    /**
     * Per-advertising set parameters
     *
     * These can be set with @ref GapAdv_setParam
     * See the specific parameter linked to each element for more information.
     */
    typedef struct
    {
      uint16_t eventProps;                   //!< @ref GAP_ADV_PARAM_PROPS
      uint32_t primIntMin;                   //!< @ref GAP_ADV_PARAM_PRIMARY_INTERVAL_MIN
      uint32_t primIntMax;                   //!< @ref GAP_ADV_PARAM_PRIMARY_INTERVAL_MAX
      GapAdv_advChannels_t primChanMap;      //!< @ref GAP_ADV_PARAM_PRIMARY_CHANNEL_MAP
      GAP_Peer_Addr_Types_t peerAddrType;    //!< @ref GAP_ADV_PARAM_PEER_ADDRESS_TYPE
      uint8_t peerAddr[B_ADDR_LEN];          //!< @ref GAP_ADV_PARAM_PEER_ADDRESS
      GapAdv_filterPolicy_t filterPolicy;    //!< @ref GAP_ADV_PARAM_FILTER_POLICY
      int8_t txPower;                        //!< NOT CURRENTLY IMPLEMENTED
      GapAdv_primaryPHY_t primPhy;           //!< @ref GAP_ADV_PARAM_PRIMARY_PHY
      GapAdv_secondaryPHY_t secPhy;          //!< @ref GAP_ADV_PARAM_SECONDARY_PHY
      uint8_t sid;                           //!< @ref GAP_ADV_PARAM_SID
    } GapAdv_params_t;
    

    Do you have any idea of when a permanent fix will be released?

    PS: My team is just bringing to my attention, the SID per BLE specs is only 4 bits. Can you elaborate on that? I mean, I can see it is defined as uint8 (above snippet from gap_advertiser.h), but the BLE core specs show it as a composite field along with Advertising Data ID (DID) which i don't see being exposed to the application

    Below is a screen from the BLE core specs:

    When we set the uint8 SID at the SDK level, do you know if TI stack will use the lower 4 bits off of it to feel the SID field of do you use all the 8 bits?

    I am looking to clarify what is the random range we should use for SID to test this? 0 to 0b1111 (DEC15) OR 0 to 0b11111111 (DEC255)?

    Thanks,

    Ivan S.


  • Hi Jan,

    Confirming, we are not getting the collisions with different SID.

    I think we answered the question for the SID range - I tried the higher bits of the SID, and seems all 8 bits are used. I am trying two tags with SID=255 and and SID=254 and I am not getting the collisions

    Same SID:

    Different SIDs:

    We will implement SID = RANDOM(255) logic to get us going for time being, but please let us know when this will be permanently fixed - I will watch this thread or please message me too when you have an update.

    Thank YOU,

    Ivan S.

  • Hi Ivan,

    I am very glad to hear the workaround is working well! I would like to clarify that the Set ID field has a range between 0 and 15, so these are the values that should be used in that case. A ticket has been filed and will be address by R&D at some point for a future SDK release. Unfortunately, I do not know which SDK will contain the fix for this at this time. I truly apologize for any inconvenience this may cause. In the meantime, if you run into any issues with the workaround, then please let me know and I would be more than happy to help.

    Best Regards,

    Jan

  • Jan,

    I got excited earlier when i tested SID=255 and SID=254, with the idea that we have 0-255 for SID to randomize. But those two values were not testing the 4 bit SID theory (those numbers had lower bits different so it worked).

    Now, reading your comment about the 0-15 range, i tested with SID=15 (0b1111) and 31(0b11111), and I do get the duplicates.

    This confirms the range for SID to fix this is ONLY 0-15, which means we can randomize only 16 numbers and with only 16 there is much higher percentage of a tag generating the same SID....

    Without going into statistics, 0-255 seems more acceptable to hope tags will have same SID. Now, with only 16 possible SIDs to randomize, I think chance is pretty high of duplicates about 6% (100/16 = about 6%)

    Please can you escalate this and maybe provide us with a library of version of SDK where this is fixed.

    From testing prospective, we can hardcore different SID on 16 tags and test the load and angle accuracy, but I don't think with the now smaller range 0-15, we can consider any kind of final solution/firmware.

    Please keep us updated If you can do anything to speed things up.

    Thanks,

    Ivan

  • Hi Jan,

    I just wanted to follow up on some ETA of fixing this in a more permanent fashion - Please keep us posted.

    Is it possible to get a temporary library that we can manually replace and compile which fixes this so we can do more higher scale testing rather soon. Right now we can only test with 16 tags only and this is very limiting.

    Thanks,
    Ivan S.

  • Hi Ivan,

    Unfortunately, I do not yet have an exact timeline for when the issue will be fixed. I will ping the R&D team again to let them know this is an urgent issue. In the meantime, are you still able to continue development with 16 tags until we find a more permanent solution?

    Best Regards,

    Jan

  • Jan,

    Please keep this thread updated, we are monitoring the responses.

    We were satisfied with how 16 tags worked, next on our list is scalability testing, and we would like to scale up to 50,100 tags to observe how the system performance and data flow - from the tag sending IQ samples to actual UI updating tags position. Considering the amount of actual data (IQ samples) and the frequency, we have to make sure our system can handle higher number of tags - this is an important checkbox that we need your help to be able to complete.

    please keep us posted when you hear back from R&D

    Thanks,

    Ivan S.

  • Hi Ivan,

    I completely understand. I will keep talking to R&D to see when they can address this. I will keep you updated on this. I truly apologize for any inconvenience this may be causing.

    Best Regards,

    Jan

  • Jan,

    I am sorry for keep asking, did you hear back anything OR does this seem to not be a quick fix?

    We are actively working to implement AoA in our platforms, but we cant really plan on releasing because of this limitation.

    What is a realistic time frame to expect a fix so I can pass it to my business development team to be able to adjust project timelines and plan product releases?

    Thanks,
    Ivan S.

  • Hi Ivan,

    No need to apologize! At this time, I cannot provide an exact timeline for when this behavior will be fully fixed. This likely will take one or two SDK releases to be addressed. I will continue looking into if there is anything that can be done to further mitigate this behavior. I truly apologize for any inconvenience this may be causing.

    Best Regards,

    Jan

  • Hi Ivan,

    I have another suggestion that may increase the amount of advertisers we can have without running into duplicates. We are working with R&D to get this addressed as soon as possible, but in the meantime this additional workaround should bring us from 16 max advertisers up to 64 devices. In short, we still use the SID workaround, but each set of 16 devices will advertise using a subset of channels that does not overlap. For example:

    • Devices 0 - 15: Will have SID from 0 to 15n and will use channels 0, 4, 8, 12, 16, 20, 24, 28, 32
    • Devices 16 - 31: Will have SID from 0 to 15n and will use channels 1, 5, 9, 13, 17, 21, 25, 29, 33
    • Devices 32 - 47: Will have SID from 0 to 15n and will use channels  2, 6, 10, 14, 18, 22, 26, 30, 34
    • Devices 48 - 63: Will have SID from 0 to 15n and will use channels 3, 7, 11, 15, 19, 23, 27, 31, 35

    The following SLA provides some valuable information in how to modify the channel map: https://dev.ti.com/tirex/content/simplelink_academy_cc13xx_cc26xxsdk_6_40_00_00/modules/rtls_toolbox_ble5/ble_aoa/ble_aoa_target.html#change-the-channel-map-connectionless-aoa-

    I understand that this is not ideal and that the overall number of tags if this workaround works as expected will be 64 (4 times increase from the 16 tags we were limited to before, but still 1/4 of the desired 256 devices you had mentioned), but this may help unblock development until we are able to get this addressed by R&D. My sincerest apologies for any delay or inconvenience this may be causing.

    Best Regards,

    Jan