This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-CC2640R2: Scan responses using a modified simple central.

Part Number: LAUNCHXL-CC2640R2

Hello,

So, I'm a little confused about how to get scan responses...

I did the tutorial here: 

There looks to be an error in the code solution though..

if(pAdvRpt->evtType == ADV_RPT_EVT_TYPE_SCAN_RSP) // Shouldn't that be if(pAdvRpt->evtType & ADV_RPT_EVT_TYPE_SCAN_RSP)


I get no scan responses unless I make the change above. Once I make the change, and get scan responses, I can't seem to find simple broadcaster though.

I'm setting it up for active scanning via 

GapScan_setPhyParams(SCAN_PRIM_PHY_1M, SCAN_TYPE_ACTIVE, (uint16_t)355, (uint16_t)333);

And I get plenty of scan responses with 0 data length (surrounding devices?) but I can't find the simple broadcaster that is sitting right next to me.

Did I miss something? I'm under the impressin that I just needed to change SCAN_TYPE_PASSIVE to SCAN_TYPE_ACTIVE and I would be good to go.

Thanks,

Jason

  • Hi Jason,
    I have assigned an expert to review this. Stay tuned.
  • Hi Jason,

    1) Thank you, yes this is wrong. You can also use the solution proposed here: e2e.ti.com/.../2943137

    2) Can you check if you are filtering the scan results? E.g. only scanning for connectable advertisement packets.
  • Marie,

    Thanks for the prompt response.

    My code looks like the following:

    case SC_EVT_ADV_REPORT:
    {
       GapScan_Evt_AdvRpt_t* pAdvRpt = (GapScan_Evt_AdvRpt_t*) (pMsg->pData);

       // Is this a scan response?

       //if(pAdvRpt->evtType == ADV_RPT_EVT_TYPE_SCAN_RSP)
       if(pAdvRpt->evtType & ADV_RPT_EVT_TYPE_SCAN_RSP)
       {
          // Is this a Skydda Bee? Look for Bees with a RSSI greater than -40dBm
          if (Trygg_stringCompare(scanRspData, pAdvRpt->pData, sizeof(scanRspData)))
          {
          // If the scan response data is our unique 128 bit sequence then we found a Skydda Bee.
          // But we want to make sure it is the one that is close.
          if ((int)pAdvRpt->rssi > -40)
         {
          // Load up the found address.
          for (uint8_t j = 0; j < B_ADDR_LEN ; j++)
          nvSystemId[j] = pAdvRpt->addr[j];

          // Update the NV memory.
         Trygg_updateSystemId();

         // Turn off active scanning.
        GapScan_setPhyParams(SCAN_PRIM_PHY_1M, SCAN_TYPE_PASSIVE, (uint16_t)355, (uint16_t)333);
       }
    }

    }

    else // Not a scan response. See if this is our sync'ed value
    {
    // Regular advertising packet.
    if (Trygg_stringCompare(pAdvRpt->addr, nvSystemId, B_ADDR_LEN))
    {// Returns a 1 if they are the same. Zero if different.
       // Address is correct. We found one.
       TryggCarSeatScanFound(pAdvRpt);
    }
    }

    // Free report payload data
    if (pAdvRpt->pData != NULL)
    {
    ICall_free(pAdvRpt->pData);
    }
    break;
    }

    So the formatting isn't the greatest but the idea is that I'm trying to sync a FOB with a peripheral. This code is for the FOB.

    If the FOB doesn't have a specific address stored in NV ram then I will actively scan, looking for a particular scan response. My peripheral's scan response is a 128 bit UUID that I generated randomly. So if the FOB sees the UUID it's looking for (one of my devices) then it will grab the address and store it as the new pair address. After that, the FOB will go back to passively scanning as there is no need to look for any 128 bit UUIDs.

    I did this to cut down on the packet size of the peripheral when it is broadcasting and save power. This is a kind of rip-off of Apple's iBeacon standard with a much smaller advertising packet.

    Jason 

  • Hi Jason,

    What devices are you using for the scanner and broadcaster?

    Per default, simple central will ignore any advertisement packets that are not connectable. The following code snippet is from SimpleCentral_processGapMsg, GAP_DEVICE_INIT_DONE_EVENT.

          // Set PDU type filter -
          // Only 'Connectable' and 'Complete' packets are desired.
          // It doesn't matter if received packets are
          // whether Scannable or Non-Scannable, whether Directed or Undirected,
          // whether Scan_Rsp's or Advertisements, and whether Legacy or Extended.
          temp16 = SCAN_FLT_PDU_CONNECTABLE_ONLY | SCAN_FLT_PDU_COMPLETE_ONLY;
          GapScan_setParam(SCAN_PARAM_FLT_PDU_TYPE, &temp16);

  • Marie,

    I'm using the LAUNCHXL-CC2640R2F boards for both.

    I agree with what you are saying. However, I can see the advertisements of my peripheral but I can't see the scan responses that the same peripheral sends.

    Admittedly, it is a bit confusing to me how the SCAN_FLT_PDU_CONNECTABLE_ONLY translates to the peripheral side. I've played with various settings and I can't say that I fully understood what was going on.

    In my mind the eventProps sets what kind of advertisement the peripheral sends. For example,

    advParamLegacy.eventProps = GAP_ADV_PROP_SCANNABLE | GAP_ADV_PROP_LEGACY;

    Would be a non-connectable, but scannable, peripheral.

    The default setting:
    .eventProps = GAP_ADV_PROP_CONNECTABLE | GAP_ADV_PROP_SCANNABLE | \
    GAP_ADV_PROP_LEGACY,

    would be a peripheral that is connectable and scannable.

    Is this correct?

    Thanks again,
    Jason
  • Hi Jason,

    1) Regarding scan responses: You can see a suggested solution for this issue here: e2e.ti.com/.../2943137

    2) You mentioned you couldn't scan simple broadcaster. In this case you should take a look at whether or not the scanning device is filtering on connectable packets.
  • Marie,

    I got it. I was messing with too many parameters and lost track of what was going on.

    Thanks for the help,
    Jason