WICED device as a BLE peripheral, how to get RSSI of a connected remote device

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JeGu_2199941
Level 5
Level 5
25 likes received 10 likes received 10 likes given

Working with SDK 3.5.2, BCM94343 platform.

I've tried "wiced_bt_dev_read_rssi" with custom callback.

But it always returns WICED_BT_BUSY and the callback is never entered.

Is it possible for a WICED BLE peripheral to retrieve RSSI of a connected remote device?

0 Likes
21 Replies
Anonymous
Not applicable

Hello.

It's probably better to post this question on the wifi forum, since BCM94343 platform isn't supported on the Bluetooth side.

But I'll take a look at it later.

James

0 Likes

Thank you for putting this post on wifi forum and your prompt reply.

0 Likes

Perhaps this may help: Can bt_smartbridge retrieve rssi value of connected ble devices?

I also saw a few other RSSI based Smartbridge discussions in the Wi-Fi forums in addition to this one.

vik86

0 Likes

The link given above is for scanning as a BLE central device.
Our device is a BLE peripheral which is being connected by someone else.

I tried to search for related topics on community, but no luck.

Can anyone kindly provide more related information?

0 Likes

A full BLE/BT simultaneous dual mode stack is not supported within the WICED Wi-Fi SDK.

Based on my understanding, the ble_proximity_reporter app is the only one we provide which enables the peripheral mode.

0 Likes

AFAIK ble_hello_sensor is also a BLE peripheral.

0 Likes

"A full BLE/BT simultaneous dual mode stack is not supported within the WICED Wi-Fi SDK."

Does this mean it is impossible for a WICED BLE peripheral to retrieve RSSI of its connected peer?

0 Likes

We have sample applications in the SDK that can have the BLE on 4343W to be BLE Peripheral and BLE central. We do not have few ble api's to perform few requests you have asked for.

0 Likes

Thank you.

Is there any clue for us, so we can try to implement such functions ourselves?

0 Likes
Anonymous
Not applicable

Are you a peripheral that is connected or a peripheral that is only an advertiser? Remember that for RSSI you need to have actual RX packets. 

0 Likes

jamesle1nsankarvik86

Our device is a BLE peripheral and is connected with a peer.

We want to know the signal strength of current connection.

0 Likes
Anonymous
Not applicable

Can you confirm that you are using the correct peer BDA in the wiced_bt_dev_read_rssi API?

Also can you try to issue an inquiry and see if you get the RSSI from the device you are interested in?

This will be in the wiced_bt_dev_inquiry_scan_result_t

0 Likes

My first testing code goes like this :

void ble_slave_rssi_callback( void *p_data )

{

  wiced_bt_tx_power_result_t *p_tx_power = (wiced_bt_tx_power_result_t *)p_data;

  DUMP_INT(p_tx_power->hci_status);

  DUMP_INT(p_tx_power->status);

  DUMP_INT(p_tx_power->tx_power);

  DUMP_MAC(p_tx_power->rem_bda);

}

case GATT_ATTRIBUTE_REQUEST_EVT:

        {

            PRINT_MAC(connection->address.bda);

            RUN_AND_PRINT(wiced_bt_dev_read_rssi (connection->address.bda, BT_TRANSPORT_LE, ble_slave_rssi_callback));

            gatt_result = gw_ble_slave_gatt_req_cb( &p_data->attribute_request );

            break;

        }

By triggering the event (on WICED peripheral) with operations on my smartphone, the UART output is :

BC F5 AC 7D 11 CB

wiced_bt_dev_read_rssi (connection->address.bda, BT_TRANSPORT_LE, (wiced_bt_dev_cmpl_cback_t *)ble_slave_rssi_callback) = 1

Note that MAC is the same as my cellphone, but outputs from ble_slave_rssi_callback are never seen.

0 Likes

My 2nd testing code goes like this :

void inquiry_result_cback(wiced_bt_dev_inquiry_scan_result_t *p_inquiry_result, uint8_t *p_eir_data)

{

  PRINT_MAC(p_inquiry_result->remote_bd_addr);

  DUMP_INT(p_inquiry_result->clock_offset);

  DUMP_INT(p_inquiry_result->rssi);

}

case GATT_ATTRIBUTE_REQUEST_EVT:

        {

        wiced_bt_dev_inq_parms_t inq_parms = {BTM_BR_INQUIRY_MASK, 3, BTM_FILTER_COND_BD_ADDR, {{0}}};

            memcpy(&inq_parms.filter_cond.bdaddr_cond[0], &connection->address.bda[0], 6);

            PRINT_MAC(connection->address.bda);

            RUN_AND_PRINT(wiced_bt_start_inquiry (&inq_parms, inquiry_result_cback));

            gatt_result = gw_ble_slave_gatt_req_cb( &p_data->attribute_request );

            break;

        }

By triggering the event (on WICED peripheral) with operations on my smartphone, the UART output is :

BC F5 AC 7D 11 CB

wiced_bt_start_inquiry (&inq_parms, inquiry_result_cback) = 8036

Note that the MAC is correct as 1st test, and output from the callback is not seen either.

0 Likes

nsankar

Is there any comment from Broadcom?

0 Likes

the ble_proximity_reporter application under snip->bluetooth is similar to what you requested. Have you looked at it?

0 Likes

Thanks for your reply vik86

The closest thing I found in ble_proximity_reporter application is "tx_power". Literally I guess this is the transmission power from our WICED device. But how do I deduce / interpret "receiving signal strength which comes from a particular peer address" from tx_power ? Or I missed something important in ble_proximity_reporter application ?

My purpose is to guess / judge physical distance between our WICED BLE slave device and a peer mobile phone. I want to enable some functions on our device only when they are sufficiently close (signal is strong).

0 Likes

xavier@candyhouse​ yes the ble_proximity_reporter reports the distance between our WICED BLE and a peer mobile phone. Give it a try and let us know if this is what your are looking for.

Several things about ble_proximity_reporter :

I tried this snip but

   1) cannot connect with either Android (LG G2) or iPhone (6s+), only connected successfully by MacbookPro with LightBlue app.

   2) By operating with all characteristics, I cannot really interpret how "the ble_proximity_reporter reports the distance between our WICED BLE and a peer mobile phone". What does "Local TX power" here mean ? Is it determined by HCI automatically according to something ? I put my Macbook at different distances from the WICED device but it always prints "12".

============ Part of UART output of bel_proximity_reporter ==========

Bluetooth enabled (success)

Local Bluetooth Address: [43:43:A1:12:1F:AC]

---->>> New ADV state: 3

Waiting for proximity monitor to connect...

Unhandled Bluetooth Management Event: 0x14

Unhandled Bluetooth Management Event: 0x14

GATT connection to [AC:BC:32:98:EC:A0] established.

---->>> New ADV state: 0

Local TX power: 12

Link loss alert level changed to: 17

Proximity alert (level: 18)

Proximity alert (level: 19)

GATT connection to [AC:BC:32:98:EC:A0] released.

---->>> New ADV state: 3

Waiting for proximity monitor to connect...

---->>> New ADV state: 4

GATT connection to [AC:BC:32:98:EC:A0] established.

---->>> New ADV state: 0

Local TX power: 12

Link loss alert level changed to: 22

GATT connection to [AC:BC:32:98:EC:A0] released.

---->>> New ADV state: 3

Waiting for proximity monitor to connect...

GATT connection to [AC:BC:32:98:EC:A0] established.

---->>> New ADV state: 0

Local TX power: 12

GATT connection to [AC:BC:32:98:EC:A0] released.

---->>> New ADV state: 3

Waiting for proximity monitor to connect...

---->>> New ADV state: 4

---->>> New ADV state: 0

============= End of UART output =============

0 Likes

xavier@candyhouse​ we will look at the issue with iPhone6+ and LG G2. Meanwhile the ble_proximity_reporter being a peripheral does not say how far the central is, not the RSSI. You will need to use andorid/iOS libraries to determine the RSSI of the peripheral(WICED device).

The tx power is basically telling at what rate the tx_power is set  on peripheral, hence you see that to be constant value of 12.

0 Likes

For the "cannot connect" problem, it was with Android / iOS APP : Nordic NRF Master Control Panel.

I also tested iOS APP : LightBlue and it works fine on 6S+, so it may be APP's problem.

So is there any way to let WICED peripheral know / infer the distance between it and a connected peer ?

Just like what you said, RSSI should be closely related to this purpose.

Is it possible for a WICED peripheral to acquire RSSI information of a connected peer ?

0 Likes