Silabs的协议栈对蓝牙广播信号输出>10dBm有下面3个限制:
- 要使能AFH;
- 环境中要有15个以上的可用信道(没有其他无线信号占用这些频道),否则会自动把输出功率降到10dBm。
- 要用BLE 5.0定义的Extended advertisements,但是BLE 4.x的设备(目前的大部分手机)无法接收这种广播信息。
但是可以通过下面的方法绕开这些限制,实现输出20dBm的iBeacon:
在iBeacon例程上,修改了两个地方,如下:
/* Gecko configuration parameters (see gecko_configuration.h) */
static const gecko_configuration_t config = {
.config_flags = 0,
.sleep.flags = SLEEP_FLAGS_DEEP_SLEEP_ENABLE,
.bluetooth.max_connections = MAX_CONNECTIONS,
.bluetooth.heap = bluetooth_stack_heap,
.bluetooth.sleep_clock_accuracy = 100, // ppm
.bluetooth.heap_size = sizeof(bluetooth_stack_heap),
.gattdb = &bg_gattdb_data,
#if (HAL_PA_ENABLE) && defined(FEATURE_PA_HIGH_POWER)
.pa.config_enable = 1, // Enable high power PA
.pa.input = GECKO_RADIO_PA_INPUT_VBAT, // Configure PA input to VBAT
#endif // (HAL_PA_ENABLE) && defined(FEATURE_PA_HIGH_POWER)
.rf.tx_gain = -100, //add by Frank
};
和
/* Set 10 dBm Transmit Power */
gecko_cmd_system_set_tx_power(100); //0 modified by Frank