how to set BLE transmit power above 3dB?
Posted: Thu Mar 12, 2020 8:48 pm
I have my basic solution working (Adafruit ESP32 Feather to custom iOS application), but am not quite getting the range I want.
esp_bt.h enums the available esp_ble_power_type_t and esp_power_level_t to use when calling: These suggest that using ESP_PWR_LVL_P9 should result in a +9 dB transmit power rather than the +3 dB default.
BLEDevice.cpp shows that the BLEDevice::setPower method calls the above function and sets the default power (ESP_BLE_PWR_TYPE_DEFAULT) to whatever power level is passed in with the call.
I've tried calling BLEDevice::setPower in many places (immediately after my call to BLEDevice::init, in my server callbacks after a successful connection, etc.). But, I always end up with +3dB of transmit power according the the nRF connect app (range and RSSI values also remain unchanged).
Digging through the IDF documentation, I found the following function:There is a note saying that it must be called after esp_bt_controller_enable and before anything that would cause the RF section to transmit.
Since esp_bt_controller_enable is called in BLEDevice::init, I tried the following:
I still only see +3 dB transmit power.
I cannot find a call to esp_bredr_tx_power_set anywhere within the arduino IDE BLE source files (1.0.4/libraries/BLE/src), so I do not know where the default esp_power_level_tmax_power_level is being set.
Does anyone have any suggestions of what I am doing wrong?
If not, can anyone tell me where the +3 dB default value is set so I could at least hack something ugly together to test with +9 dB?
esp_bt.h enums the available esp_ble_power_type_t and esp_power_level_t to use when calling:
Code: Select all
esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_t power_level)
BLEDevice.cpp shows that the BLEDevice::setPower method calls the above function and sets the default power (ESP_BLE_PWR_TYPE_DEFAULT) to whatever power level is passed in with the call.
I've tried calling BLEDevice::setPower in many places (immediately after my call to BLEDevice::init, in my server callbacks after a successful connection, etc.). But, I always end up with +3dB of transmit power according the the nRF connect app (range and RSSI values also remain unchanged).
Digging through the IDF documentation, I found the following function:
Code: Select all
esp_bredr_tx_power_set(esp_power_level_tmin_power_level, esp_power_level_tmax_power_level)
Since esp_bt_controller_enable is called in BLEDevice::init, I tried the following:
Code: Select all
BLEDevice::init()
esp_bredr_tx_power_set(ESP_PWR_LVL_N12, ESP_PWR_LVL_P9)
BLEDevice::setPower(ESP_PWR_LVL_P9).
I cannot find a call to esp_bredr_tx_power_set anywhere within the arduino IDE BLE source files (1.0.4/libraries/BLE/src), so I do not know where the default esp_power_level_tmax_power_level is being set.
Does anyone have any suggestions of what I am doing wrong?
If not, can anyone tell me where the +3 dB default value is set so I could at least hack something ugly together to test with +9 dB?