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.

How to recieve every advertisement packet in Observer mode in CC2541

Other Parts Discussed in Thread: CC2541, CC2540, CC2650

Hi

How can i recieve every advertisement packet in Observer mode in CC2541 during discovery ?

Here I am using BLE v 1.4 stack and SimpleBLEObserver code as a reference.  currently i am getting only one advertisement packet of broadcaster device in my Observer device during device discovery.

My broadcaster device sends advertise packet at interval of 500ms and My observer device do discovery for 5sec and I am getting only one device in my observer device.

I want to recieve every advertisement packet sends from broadcaster device.

-

Thanks,

Dhvanil

  • Hello. The following parameter enables / disables filtering of duplicate reports:

    #define TGAP_FILTER_ADV_REPORTS       35  //!< Filter duplicate advertising reports. Default TRUE.

    This can be set via the GAP_SetParamValue() function

    Note that you will likely receive a large amount of advertisement reports in this case. You will likely want to increase the max number of reports (GAPOBSERVERROLE_MAX_SCAN_RES) with the GAPObserverRole_SetParameter() command. You will need to do this before GAP_DeviceInit() is called since this is where the array storing the reports is allocated.

    Increasing this number will come at the expense of using up the heap so you should ensure you don't overflow the heap.

  • Thanks Tim.

    Its working fine for me.

    -

    Dhvanil Patel

  • Hi;

    I'm using a sensorTag as a peripheral device and I would like to use it in a broadcast or observer mode. What do I have to modify in the source code? Thank you for your help!

    Best Regards,


    Boris NOMERTIN

  • Hi Tim,

    I'm using the CC2540 USB as my broadcaster, generating advertising packets every 100ms.  I'm trying to catch as many as possible with the CC2541 keyfob running in peripheral+observer dual mode.  I'm using BLE-CC254x-1.4.0.  I have configured my discovery to listen for 1000ms, so should expect to get up to 9 or 10 packets and have set GAPOBSERVERROLE_MAX_SCAN_RES to 16 to make sure I have plenty of space.  I have tried placing GAP_SetParamValue( TGAP_FILTER_ADV_REPORTS, FALSE ); in my application_init code, just before calling device discovery, and just after calling device discovery, but still only get one GAP_DEVICE_INFO_EVENT per discovery.

    Are there any other settings I need to include for dual-mode?

    Thanks,

    Ben

  • Hello everybody,

    I have a question about who has to free the dynamic memory allocated from the stack, in particular for the Observer Event Callback Function.

    I am working with a SensorTag (CC2650 based) and BLE-STACK-2-1-1, using the code from:

    processors.wiki.ti.com/.../CC2640_Peripheral_Observer_V2_1

    In this example the stack message is free in these lines:

    static void SimpleBLEPeripheral_processAppMsg(sbpEvt_t *pMsg)
    {
    ...

    case SBP_OBSERVER_STATE_CHANGE_EVT:
    SimpleBLEPeripheral_processStackMsg((ICall_Hdr *)pMsg->pData);

    // Free the stack message
    ICall_freeMsg(pMsg->pData);
    break;
    }

    but if you see the content of the message there are other dynamic variables, in particular:

    static void SimpleBLEPeripheralObserver_processRoleEvent(gapPeripheralObserverRoleEvent_t *pEvent)
    {
    switch (pEvent->gap.opcode)
    {
    case GAP_DEVICE_INFO_EVENT:
    {
    pEvent->deviceInfo.pEvtData; //uint8 *pEvtData; //!< Data field of advertisement or SCAN_RSP
    break;
    }
    case GAP_DEVICE_DISCOVERY_EVENT:
    {
    pEvent->discCmpl.pDevList; //gapDevRec_t *pDevList; //!< array of device records
    break;
    }
    ...
    }

    Do the application have to take care about that dynamic variables separatly?
    Thank you,

    Kind Regards,
    SF