ESP32: Setting Bluetooth TX power when initalizing BLE
I had trouble connecting to a Bluetooth master running on an ESP32. After about 4m I couldn't get a reliable connection anymore.
After trying out different ESP32's and external antennas, I run across the following forum post:
https://forum.micropython.org/viewtopic.php?t=7733#p62651
He is increasing the Bluetooth power directly in the init function with the following two commands:
esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_DEFAULT, ESP_PWR_LVL_P9);
esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, ESP_PWR_LVL_P9);
And that actually solved the problem. Not sure what the default Bluetooth TX power is, but would there be a chance that you can set the TX power from the bluetooth init-function inside of MicroPython?
BLE on ESP32 inconsistent init time (sometimes > 10s)
Initiating and activating bluetooth with
import bluetooth
ble = bluetooth.BLE()
ble.active(True)
normally take around 200ms to execute. But sometimes it takes over 10 seconds.
occurs with esp32-idf4-20191220-v1.12.bin
Further Details at this forum post.