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

How can i see the RSSI value in nRF51 dk?

Im based in the example of SDK12.0 - MULTILINK_CENTRAL and i have to know the RRSI value in dbm if it is possible from the peripheral device that is connected to me but i couldn't do that.

Somebody can help me?

Here i put my code:

static void on_ble_evt(const ble_evt_t * const p_ble_evt) { ret_code_t err_code;

// For readability.
const ble_gap_evt_t * const p_gap_evt = &p_ble_evt->evt.gap_evt;
	
	
switch (p_ble_evt->header.evt_id)
{
    // Upon connection, check which peripheral has connected, initiate DB
    // discovery, update LEDs status and resume scanning if necessary.
    case BLE_GAP_EVT_CONNECTED:
    {
        NRF_LOG_INFO("link 0x%x established, start discovery on it\r\n",
                       p_gap_evt->conn_handle);
				
					
					

					//logw("RSSI LEVEL: %d",p_gap_evt->params.);
				
        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);

        err_code = ble_db_discovery_start(&m_ble_db_discovery[p_gap_evt->conn_handle],
                                          p_gap_evt->conn_handle);
					
					sd_ble_gap_rssi_start(p_gap_evt->conn_handle,0x00FE,0x00);
				
					
					int8_t* pruebita;
					sd_ble_gap_rssi_get(p_gap_evt->conn_handle, pruebita);
				
					sd_ble_gap_rssi_stop(p_gap_evt->conn_handle);
				
					//SEGGER_RTT_printf(0,"RSSI: %d\n",p_ble_evt->evt.gap_evt.params.rssi_changed.rssi);
					
					//loge("EXPERIMENTANDO: %d",p_ble_evt->evt.gap_evt.params.connected.peer_addr);
					
					 
					if (BLE_GAP_EVT_RSSI_CHANGED){
					//loge("RSSI: %d\n",p_ble_evt->evt.gap_evt.params.adv_report.rssi);	
					loge("INTENTO DE OBTENER RSSI: %d\n",pruebita);
					}
Related