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.

RSSI polling

Other Parts Discussed in Thread: CC2540

Hi,

I'm using a custom device with an MCU and cc2540 chip. With this device I'm trying to get an RSSI value of another device (the keyfob). 

I use the simpleBLEcentral application on the custom device where I can register an rssi callback. During a simple connection the RSSI is not changing at all. But when I read a characteristic attribute, the RSSI is 'updated'.

My question: do I need to send data in order to update my rssi or is there another way? When I need to 'send data', what is the most simple and stable way to do it?

best regards

 

  • Hi,

    Yes, this is unfortunately a bug in v.1.4.0. RSSI is not updated when receiving empty packets.

    The most stable way would be starting an osal timer with timeout equal to how often you want RSSI updates. No sense in having this lower than connection interval.

    In the OSAL event set by this timer, you send a GATT_Notification, or perform a Write command (if Central) to the device interested in RSSI. This can contain useful or dummy information. In this event you can then set up the timer again. In the disconnect callback you can call osal_stop_timerEx(..) to stop the timer since it then becomes senseless.

    If you want the RSSI to update both ways you can use a Read Req or Write Req. If you use a Write Req you can put in _this_ device's received signal strength so the other side then has both RSSI values - since you need some dummy data anyway.

    The reason Read/Write req updates both sides is that a Rsp is automatically transmitted, which will update the RSSI for the side that sent the request when it receives the Rsp.

    See SimpleBLECentral for how to do Read/Write (GATT Client operations). SimpleBLEPeripheral sends a notification in the periodic event, and the keyfob does this on button press.

    Best regards,
    Aslak
  • Hi Aslak,

    Thanks a lot for your detailed answer!

    Am I correct that this is the only way to get the RSSI with the CC2540? I was wondering whether it would be possible to get an RSSI value for received advertising data, i.e. I would have an idea of the signal strength without the need of an actual connection. I assume there is no way to implement this, as long as the BLE stack does not provide this functionality? (since I can't use the proprietary radio mode of the CC2540, only the stack)

    Best regards,

    Manuel

  • Hi Manuel,

    For advertisement reports the RSSI is included in the device info event. pEvent->deviceInfo.rssi. See case GAP_DEVICE_INFO_EVENT in simpleBLECentral.c for example.

    BR,
    Aslak