The way now current tx power value check

I am the user who is using nrf52832.

A 1:Nble connection was successful using the multi-central example.
I set the tx power of the device using sd_ble_gap_tx_power_set().
But I wonder if tx power is set correctly.

Many searches have shown that p_gap_evt->params.adv_report.tx_power and p_gap_evt->params.adv_report.rsi can determine the tx_power and rsi of the peripheral.

But tx power is 127.
(Mac address and rssi are output normally.)

Is there any other way to check the tx power of the connected peripheral and the tx power of the central?

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

    // For readability.
    ble_gap_evt_t const * p_gap_evt = &p_ble_evt->evt.gap_evt;
    switch (p_ble_evt->header.evt_id)
    {
        ...
        
        case BLE_GAP_EVT_ADV_REPORT:
            printf("ble_evt_handler ID = %d MAC = ", p_gap_evt->conn_handle);
            printf("%02X",p_gap_evt->params.connected.peer_addr.addr[5]);
            printf(":%02X",p_gap_evt->params.connected.peer_addr.addr[4]),
            printf(":%02X",p_gap_evt->params.connected.peer_addr.addr[3]),
            printf(":%02X",p_gap_evt->params.connected.peer_addr.addr[2]),
            printf(":%02X",p_gap_evt->params.connected.peer_addr.addr[1]),
            printf(":%02X",p_gap_evt->params.connected.peer_addr.addr[0]),   
            printf(",tx_power %d",p_gap_evt->params.adv_report.tx_power); 
            printf(",rssi %d\n\r",p_gap_evt->params.adv_report.rssi);            
        break;
        
        ...
    }

}

  • Hi JSY, 

    p_gap_evt->params.adv_report.tx_power and .rssi only give you the tx_power included in the advertising packet and the rssi level when you receive the advertising packet not when in connection. You can see that if you advertise with higher output power, you will have larger rssi (but in negative value).

    On the local device you can call  sd_ble_gap_tx_power_get() to get the current TX_power. 

    If you want to verify the txpower to see that if you in fact have higher output power when in connection, you can use a sniffer to scan and follow the connection. The sniffer would be able to show the different in RSSI when in connection with different txpower that you set in the application.

      

  • Thank you for your answer, but the function sd_ble_gap_tx_power_get() does not exist.
    I don't think there's a way to get TX POWER directly yet.

    As you said, I installed a sniffer and tracked the advertiser.
    After CONNECT_IND, I was able to check the information of master source and slave source. I think there will be a difference in RSSI if we set the TX POWER of Master and Slave differently and test it! I'll try it out. Thank you for giving me a good solution.

    And this is an additional question. Can you tell me the version of your sniffer?
    It is inconvenient to check at once because the RSSI and channel do not appear on the console of the sniffer I installed. I would appreciate it if you could answer this question.

  • Hi JSY, 
    I'm sorry about the suggestion on sd_ble_gap_tx_power_get(). I was doing a quick search on google and found some hits on the function and thought that there's actually such function. I should have double checked. 
    But you are right, the application need to keep track of the txpower as there isn't an API to get the current tx_power from the stack. 

    Regarding your question about RSSI column, you just need to right click on the RSSI and click Apply as Column. 

  • Thank you so much. Your reply was very helpful to me!Smile

Related