How to adjust BLE Tx power
Applications can control BLE Advertisement Tx power and BLE Connection Transmit power by making Atmosic API calls as described below.
1. BLE Advertisement power setting
For ATM34xx platform
The default Adv TX Power is 0 dBm. This can be altered by an application by making an API call to atm_vendor_set_adv_tx_power().
For example, to set advertisement power to 4 dBm:
atm_vendor_set_adv_tx_power(TX_POWER_4_DBM);
For ATM33xx platform
The Adv Tx power uses CONFIG_MAX_TX_PWR setting for Advertisements. An application can alter the Advertisement power by setting CONFIG_MAX_TX_PWR to a different value in its prj.conf file.
For example, to set Advertisement power to 8 dBm, set it as follows in the prj.conf file:
CONFIG_MAX_TX_PWR=8
2. BLE Connection Tx Power setting (ATM33xx, ATM34xx)
The default Connection Tx Power is 0 dBm. Applications can modify the Connection Tx Power by making an Atmosic provided API call.
For example, to set Connection Tx Power to 8 dBm, here is a code snippet that is typically inserted in the connected callback handler:
#include "atm_vendor_api.h"
int err = atm_vendor_set_con_tx_power(conn_hdl, TX_POWER_8_DBM);
if (err) {
LOG_ERR("Failed to set connection TX power level %d", TX_POWER_8_DBM);
} else {
LOG_INF("Successfully set connection TX power level %d", TX_POWER_8_DBM);
}
In Application’s prj.conf file, include these settings:
CONFIG_ATM_VENDOR_API=y
CONFIG_VND_API_SET_ADV_TX_POWER=y
CONFIG_VND_API_SET_CON_TX_POWER=y
Look at lib/atm_vendor/api_include/atm_vendor_api.h for various supported Power Levels in the system.