This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

sd_ble_gap_rssi_get does not work

HI,

We connect our own board with nrf51 via UART. From the host board, I call sd_ble_gap_rssi_start() first. I can see BLE_GAP_EVT_RSSI_CHANGED happens. Then I call sd_ble_gap_rssi_get(), but nothing happens. It seems the program blocks.

The following is my code:

static void on_connect(ble_evt_t *p_ble_evt)
{
    uint32_t ret;

    .......
    g_ble_context.conn_handle = p_ble_evt->evt.gap_evt.conn_handle;

    ret = sd_ble_gap_rssi_start(p_ble_evt->evt.gap_evt.conn_handle, 10, 0);
    if (ret) {
        ......
    }

    ret = sd_ble_gattc_primary_services_discover(p_ble_evt->evt.gap_evt.conn_handle, SRV_DISC_START_HANDLE, NULL);
    if (ret) {
        ......
    }
}

Then I call sd_ble_gap_rssi_get() after receiving BLE_GAP_EVT_RSSI_CHANGED event(I can see log of BLE_GAP_EVT_RSSI_CHANGED event).

int8_t rssi = 0;
sd_ble_gap_rssi_get(g_ble_context.conn_handle, &rssi);

This is the normal case. I also tried to call sd_ble_gap_rssi_get() without calling sd_ble_gap_rssi_start(). I think it should return error. Is it right? But it also blocked.

Related