mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-22 09:37:00 +08:00
feat(phy): add phy partial calibration in phy init
This commit is contained in:
@ -560,6 +560,31 @@ endmenu
|
|||||||
|
|
||||||
menu PHY
|
menu PHY
|
||||||
|
|
||||||
|
choice ESP8266_PHY_CALIBRATION
|
||||||
|
prompt "RF calibration"
|
||||||
|
default ESP8266_PHY_FULL_CALIBRATION
|
||||||
|
help
|
||||||
|
If calibration data is not found, full calibration will be performed. To ensure better RF performance,
|
||||||
|
it is recommend to set RF_calibration to ESP8266_PHY_FULL_CALIBRATION, otherwise the RF performance may become poor.
|
||||||
|
|
||||||
|
Full calibration needs 170 - 180ms.
|
||||||
|
Partial calibration needs 35 - 40ms.
|
||||||
|
No calibration needs 3.260 - 3.264ms.
|
||||||
|
|
||||||
|
config ESP8266_PHY_FULL_CALIBRATION
|
||||||
|
bool "RF full calibration"
|
||||||
|
config ESP8266_PHY_NO_CALIBRATION
|
||||||
|
bool "RF no calibration"
|
||||||
|
config ESP8266_PHY_PARTIAL_CALIBRATION
|
||||||
|
bool "RF partial calibration"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config ESP8266_PHY_CALIBRATION
|
||||||
|
int
|
||||||
|
default 3 if ESP8266_PHY_FULL_CALIBRATION
|
||||||
|
default 2 if ESP8266_PHY_PARTIAL_CALIBRATION
|
||||||
|
default 1 if ESP8266_PHY_NO_CALIBRATION
|
||||||
|
|
||||||
config ESP_PHY_CALIBRATION_AND_DATA_STORAGE
|
config ESP_PHY_CALIBRATION_AND_DATA_STORAGE
|
||||||
bool "Store phy calibration data in NVS"
|
bool "Store phy calibration data in NVS"
|
||||||
default y
|
default y
|
||||||
|
@ -26,6 +26,8 @@ uint8_t phy_check_data_table(uint32_t *table, uint8_t, uint8_t);
|
|||||||
|
|
||||||
void phy_afterwake_set_rfoption(uint8_t);
|
void phy_afterwake_set_rfoption(uint8_t);
|
||||||
|
|
||||||
|
void phy_set_powerup_option(uint8_t);
|
||||||
|
|
||||||
void write_data_to_rtc(uint8_t *);
|
void write_data_to_rtc(uint8_t *);
|
||||||
|
|
||||||
void get_data_from_rtc(uint8_t *);
|
void get_data_from_rtc(uint8_t *);
|
||||||
|
@ -71,6 +71,7 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat
|
|||||||
uint8_t *local_init_data = calloc(1, 256);
|
uint8_t *local_init_data = calloc(1, 256);
|
||||||
|
|
||||||
memcpy(local_init_data, init_data->params, 128);
|
memcpy(local_init_data, init_data->params, 128);
|
||||||
|
memcpy(local_init_data + 128, calibration_data->rf_cal_data, 128);
|
||||||
|
|
||||||
extern uint32_t* phy_rx_gain_dc_table;
|
extern uint32_t* phy_rx_gain_dc_table;
|
||||||
phy_rx_gain_dc_table = calibration_data->rx_gain_dc_table;
|
phy_rx_gain_dc_table = calibration_data->rx_gain_dc_table;
|
||||||
@ -78,6 +79,7 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat
|
|||||||
phy_check_data_table(phy_rx_gain_dc_table, 125, 1);
|
phy_check_data_table(phy_rx_gain_dc_table, 125, 1);
|
||||||
|
|
||||||
phy_afterwake_set_rfoption(1);
|
phy_afterwake_set_rfoption(1);
|
||||||
|
phy_set_powerup_option(CONFIG_ESP8266_PHY_CALIBRATION);
|
||||||
|
|
||||||
if (!cal_data_check) {
|
if (!cal_data_check) {
|
||||||
write_data_to_rtc(calibration_data->rf_cal_data);
|
write_data_to_rtc(calibration_data->rf_cal_data);
|
||||||
|
Reference in New Issue
Block a user