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

Best place to put sd_ble_gap_tx_power_set() to reduce power during bonding?

Hi,

I am using peer manager to use static passkey with nrf51822, sdk11 and s130 v2.

Is the "case PM_EVT_CONN_SEC_START:" the best place to put sd_ble_gap_tx_power_set() to reduce power during bonding to avoid MITM attack and then increasing it again in the "case PM_EVT_CONN_SEC_SUCCEEDED:"?

I thought to increase the power back in "BLE_GAP_EVT_CONNECTED" event but it is also being called along with "PM_EVT_CONN_SEC_START" event.

Parents
  • FormerMember
    0 FormerMember

    I would say that the TX power could be reduced as early as when the device is advertising. Why?

    1. If advertising with lower output power, fewer devices will have a chance to know that the advertising device is nearby. In addition, the scanner will need to be able to pick up advertising packets at the low TX power to be able to maintain a connection with the low TX power level.
    2. If reducing the TX power after connected, there could be a chance that the TX power is too low for maintaining a connection.
  • FormerMember
    0 FormerMember in reply to FormerMember

    Okay, I see. Placing sd_ble_gap_tx_power_set(..) level in PM_EVT_CONN_SEC_START and PM_EVT_CONN_SEC_SUCCEEDED will easily ensure that the tx power level will only be adjusted when doing bonding. You can test that it works by for example initiating a connection at a far distance, and check that bonding fails at the same distance.

  • Hi, , I came up with a question after reading this thread.

    Inside advertising data, setting p_tx_power_level doesn't change the actual transmit power according to this tutorials.

    int8_t tx_power_level = 4;
    advdata.p_tx_power_level = &tx_power_level;

    What is the usage of this if it is only for broadcasting a virtual value ?

     

    But we can change tx_power with sd_ble_gap_tx_power_set(..), right ?

    What if we did not set the tx_power? The default value is 0 ?

  • FormerMember
    0 FormerMember in reply to Nijat

    The TX power level field in the advertising data is just informative, informing the scanning devices which TX  power the advertiser is using:

    The TX Power Level data type indicates the transmitted power level of the packet containing the data type. The TX Power Level should be the radiated power level. (Supplement to the Bluetooth Core Specification, CSS Version 7, chapter 1.5.1)

    When advertising, it is optional to add the TX power to the advertising data. If that is data you don't need to transmit, you simply don't add it to the advertising data.

    To set the actual TX power, sd_ble_gap_tx_power_set() has to be used.

Reply
  • FormerMember
    0 FormerMember in reply to Nijat

    The TX power level field in the advertising data is just informative, informing the scanning devices which TX  power the advertiser is using:

    The TX Power Level data type indicates the transmitted power level of the packet containing the data type. The TX Power Level should be the radiated power level. (Supplement to the Bluetooth Core Specification, CSS Version 7, chapter 1.5.1)

    When advertising, it is optional to add the TX power to the advertising data. If that is data you don't need to transmit, you simply don't add it to the advertising data.

    To set the actual TX power, sd_ble_gap_tx_power_set() has to be used.

Children
No Data
Related