본문 바로가기
임베디드.일렉트로닉스/nRF52

nRF52 . BLE . RSSI

by i.got.it 2023. 1. 30.

 

 

 

BLE connection 상태의 RSSI 

 ble_evt_handler 내부에서 BLE_GAP_EVT_RSSI_CHANGED 추가해둔 상태에서, 함수 sd_ble_gap_rssi_start(,,) 호출하면 rssi 값 확보가능

 


static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{

	switch (p_ble_evt->header.evt_id)
    {
    .. 중략. 
        case BLE_GAP_EVT_RSSI_CHANGED:
          	//int8_t Received Signal Strength Indication in dBm.
            NRF_LOG_INFO("Changed RSSI : %d", p_ble_evt->evt.gap_evt.params.rssi_changed.rssi); 

            break;
	}// switch
}

 

함수  sd_ble_gap_rssi_start() 

sd_ble_gap_rssi_start(
	uint16_t conn_handle 
    , uint8_t threshold_dbm
    , uint8_t skip_count
    )
  
  /////// args
  /*
  uint16_t conn_handle
  	Connection handle.
  
  uint8_t threshold_dbm
    Minimum change in dBm before triggering the @ref BLE_GAP_EVT_RSSI_CHANGED event. 
    Events are disabled if threshold_dbm equals @ref BLE_GAP_RSSI_THRESHOLD_INVALID.
  
  uint8_t skip_count
  	Number of RSSI samples with a change of threshold_dbm or more before sending 
    a new @ref BLE_GAP_EVT_RSSI_CHANGED event.
 */

 

함수 sd_ble_gap_rssi_start() 호출예. 

 ble_evt_handler 내부 case BLE_GAP_EVT_CONNECTED:  에서 sd_ble_gap_rssi_start() 호출예. 

 

static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    uint32_t err_code;

    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);
            
            sd_ble_gap_rssi_start(m_conn_handle,5,10); // RSSI

            break;
            
      ... 중략.

 

실행 결과. 

- SES Debug Terminal 에서 확인. 

 

 

BLE Central 에서 peripheral  의 advertising 상태의 rssi

BLE central 측의 ble_evt_handler 내부에서 BLE_GAP_EVT_ADV_REPORT: 에서 확보가능. 

 


static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{

	switch (p_ble_evt->header.evt_id)
    {
    .. 중략. 
        // only for available central device are scanning and detects an advertising packet.  
        case BLE_GAP_EVT_ADV_REPORT:
            NRF_LOG_INFO("advertising RSSI: %d", p_ble_evt->evt.gap_evt.params.adv_report.rssi);
            break; 
	}// switch
}

 

 

 

연관

 

 

nRF52 . BLE . Tx Power 설정.

BLE Advertising 상태의 Tx Power 설정. - 함수 sd_ble_gap_tx_power_set ( , , ) 호출하면서 마지막 인자로 설정하려는 출력 파워 기록한다. - advertising init 과정에서 함수 ble_advertising_init 호출 이후 advertising 핸들

igotit.tistory.com

 

상위정리

 

STM32. nRF52. ESP32. EFM8. EFM32. PSoC 활용 정리.

STM32. nRF52. ESP32. EFM8. EFM32. PSoC 총정리 제조사 칩 주요특징 실리콘랩 8bit MCU EFM8 시리즈 32bit EFM32 시리즈 EFM8 싸다. STM STM32 . 최고 항상 만족. Cypress pSoC pSoC6 은 기대해볼만. NORDIC nRF52 블투 무선솔루

igotit.tistory.com

 

 

 


첫 등록 : 2020.03.06 

최종 수정 : 2023.01.30

단축 주소 : https://igotit.tistory.com/4206


 

댓글



 

비트코인




암호화폐       외환/나스닥/골드       암호화폐/외환/나스닥/골드 암호화폐/외환/나스닥/골드   암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)     롤오버 이자 없는 스왑프리계좌
( 스왑프리 암호화폐도 거래 가능 )    
MT4, MT5 , cTrader 모두 지원     FTMO 계좌 매매운용. MT4,MT5