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

RSSI measurement for each peripheral s130 or 132

Hi, I want to get the RSSI for each peripheral that is connected to an nRF52 when it is operating as a multi-link central to multiple peripherals. Helpful hints? Sample code?

Thanks!

Parents Reply Children
  • Example: When a peripheral connects, let’s start the RSSI sampling. In the function on_ble_evt(),when we get the event BLE_GAP_EVT_CONNECTED, let’s call the start function:

    case BLE_GAP_EVT_CONNECTED:
            {
                NRF_LOG_INFO("Connection 0x%x established, starting DB discovery.\r\n",
                             p_gap_evt->conn_handle);
                APP_ERROR_CHECK_BOOL(p_gap_evt->conn_handle < TOTAL_LINK_COUNT);
    
                err_code = ble_lbs_c_handles_assign(&m_ble_lbs_c[p_gap_evt->conn_handle],
                                                    p_gap_evt->conn_handle,
                                                    NULL);
                APP_ERROR_CHECK(err_code);
                sd_ble_gap_rssi_start(p_gap_evt->conn_handle,3,0); // ADD THIS
    

    then add a new case in the function on_ble_evt() for the rssi event:

    case BLE_GAP_EVT_RSSI_CHANGED:
                NRF_LOG_INFO("Rssi is %d with conn_handle: %d\n",p_gap_evt->params.rssi_changed.rssi,p_gap_evt->conn_handle); 
                break;
    
Related