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.

Observer missing advertisements?

My test Observer application running on a CC2541-based custom board seems to be missing some advertisements while advertising, although the same hardware doesn't seem to miss any packets when downloading a 148K binary image using OAD.  I'm wondering if my approach to this (or my understanding of how Observers and discovery works) is just wrong.  I had previously posted this as a reply to a related question I had last week, but have received no additional responses, so I thought maybe a separate thread would be better.

My application is trying to determine when a CC2541-based Observer passes through a doorway, where the tag is affixed to the top of the door opening and directionally attenuated with ferrite shields.  Obviously, we want to minimize the false positives generated by Observers passing by the doorway rather than through it.  For our application, predictable performance is more important than maximum battery life (within reason).  We need our Observer devices to last 12-18 hours on a 150mAh battery, and the Broadcasters to last as long as we can get on 2 AA batteries.  Ideally, our Broadcasters would last years on a coin cell, but we realize that isn't realistic, and we have the flexibility to use larger capacity batteries.  Cost is probably a bigger issue.

I made a simple test program where the Broadcaster sends a minimal advertisement every 250 ms.  I also made a test Observer program that enters discovery for 250 ms.  When a device event is received, I set a flag, and when the discovery complete event is received I set an LED based on the flag and restart discovery for another 250 ms.  

static void simpleBLEObserverEventCB( gapObserverRoleEvent_t *pEvent )
{
  switch ( pEvent->gap.opcode )
  {
    case GAP_DEVICE_INIT_DONE_EVENT: 
      break;
 
    case GAP_DEVICE_INFO_EVENT:
      {
        bDetected = TRUE;
      }
      break;
       
    case GAP_DEVICE_DISCOVERY_EVENT:
      {
        if (bDetected)
          HalLedSet( HAL_LED_GREEN, HAL_LED_MODE_ON );
        else
          HalLedSet( HAL_LED_GREEN, HAL_LED_MODE_OFF );
         
        bDetected = FALSE;
 
        // Start the Observer discovering devices
        GAPObserverRole_StartDiscovery( DEVDISC_MODE_ALL, false, false);      
      }
      break;
       
    default:
      break;
  }
}

I would have expected that if the Broadcaster was near the reader (within a few feet) that I would have the LED constantly on.  What I actually see is that the Observer definitely misses many advertisements, in fact I would say it may miss 10-20%, sometimes more.  I tried staggering the intervals by setting the Broadcaster to 200 ms and the Observer to 250 ms discovery periods, and the results are nearly the same.  If I double the broadcasting rate compared to the discovery period, it is much better, but still not perfect.

Should the Observer be able to detect a Broadcaster closer to 100% of the time over a 250 ms discovery period?  Or is this pretty normal?  Why would I be missing advertisements so frequently during my discovery period?

Thanks,
-rich 

  • Hi Rich,

    I seem to be running into a different problem while I use . GAPObserverRole_StartDiscovery(DEFAULT_DISCOVERY_MODE,
                                          FALSE,
                                          FALSE );      


    The purpose of my application is to constantly scan for a 'known device' and detect its presence and measure the RSSI. The structure of the code is exactly what you have outlined in your post, the only difference being that I process the DEVICE INFORMATION EVENT differently.

    When I insert a breakpoint at GAPObserverRole_StartDiscovery and run the code, system seems to be working.

    The moment I remove the breakpoint and let the program run, I am seeing a stack overflow problem and the device has crashed, with all the pointers pointing to 0xFFFF.

    Do you have any idea of why it could be?

    On the other hand, for the program that you have written, are you sure that the code keeps running and hasn't crashed and then recovered back? If it were to have crashed and then got reset, it might have missed some packets due to this.

    It would be great to hear from any one in TI about this problem.

    Thanks and Regards

    Sudhi