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

how to get and send the RSSI value over ble

Hi, 

I am working nRF52832 and sdk 16 version. I want to get the RSSI  value of my peripheral device nRF52832 and send it to central (phone) over ble ? how to do that ? 

Best Regards 

pspavi

Parents
  • Hi,

    Just to make sure, did you consider the option of just reading the RSSI on the phone instead? I don't think it's common to have a peripheral send measured RSSI to the central, and it does complicate things a bit. In any case, you can use the following SD APIs to control RSSI sampling:

    sd_ble_gap_rssi_get

    sd_ble_gap_rssi_start

  • yes I did , but i am not getting the RSSI stable value , it is varying  ..please let me know how to rectify 

      switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                NRF_LOG_INFO("Connected");
                err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
                APP_ERROR_CHECK(err_code);
                m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
                err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
                APP_ERROR_CHECK(err_code);
    
                uint32_t err_code;  
    m_conn_handle  = p_ble_evt->evt.gap_evt.conn_handle;  
    err_code = sd_ble_gap_rssi_start(m_conn_handle, 10, 0);  
    APP_ERROR_CHECK(err_code);  
    
    
                break;
     case BLE_GAP_EVT_RSSI_CHANGED:
             
           rssi = p_ble_evt->evt.gap_evt.params.rssi_changed.rssi;
        
    NRF_LOG_INFO("rssi:%d",rssi);
    

Reply
  • yes I did , but i am not getting the RSSI stable value , it is varying  ..please let me know how to rectify 

      switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                NRF_LOG_INFO("Connected");
                err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
                APP_ERROR_CHECK(err_code);
                m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
                err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
                APP_ERROR_CHECK(err_code);
    
                uint32_t err_code;  
    m_conn_handle  = p_ble_evt->evt.gap_evt.conn_handle;  
    err_code = sd_ble_gap_rssi_start(m_conn_handle, 10, 0);  
    APP_ERROR_CHECK(err_code);  
    
    
                break;
     case BLE_GAP_EVT_RSSI_CHANGED:
             
           rssi = p_ble_evt->evt.gap_evt.params.rssi_changed.rssi;
        
    NRF_LOG_INFO("rssi:%d",rssi);
    

Children
Related