Merge branch 'feat/support_disable_pll_track_v5.2' into 'release/v5.2'

Support disable pll track (v5.2)

See merge request espressif/esp-idf!40367
This commit is contained in:
Jiang Jiang Jian
2025-07-11 13:58:51 +08:00
5 changed files with 41 additions and 4 deletions

View File

@@ -166,10 +166,31 @@ menu "PHY"
high interference, enable this option will sacrifice Wi-Fi OFDM receive performance.
But to guarantee 11b receive performance serves as a bottom line in this case.
config ESP_PHY_PLL_TRACK_PERIOD_MS
int "Set the period of the pll track"
default 1000
help
Set the period of the pll track.
config ESP_PHY_PLL_TRACK_DEBUG
bool "Enable pll track logging"
default n
help
If enabled, there will be some logs while pll tracking
menuconfig ESP_PHY_DEBUG
bool "Enable PHY Debug"
default n
help
Enabling this option allows different kinds of phy debugging features.
config ESP_PHY_DISABLE_PLL_TRACK
bool "Disable phy pll track(only for experimental)"
depends on ESP_PHY_DEBUG
default n
help
Disable pll track. This configuration option is used for experimental.
PLL track helps the PHY module adapt to temperature changes, ensuring stable performance.
When pll enabled, the ESP PHY module will periodically track and adjust PLL parameters.
endmenu # PHY

View File

@@ -17,6 +17,7 @@
static volatile uint16_t s_phy_modem_flag = 0;
#if !CONFIG_ESP_PHY_DISABLE_PLL_TRACK
extern void phy_param_track_tot(bool en_wifi, bool en_ble_154);
static esp_timer_handle_t phy_track_pll_timer;
#if CONFIG_ESP_WIFI_ENABLED
@@ -25,8 +26,9 @@ static volatile int64_t s_wifi_prev_timestamp;
#if CONFIG_IEEE802154_ENABLED || CONFIG_BT_ENABLED
static volatile int64_t s_bt_154_prev_timestamp;
#endif
#define PHY_TRACK_PLL_PERIOD_IN_US 1000000
#define PHY_TRACK_PLL_PERIOD_IN_US (CONFIG_ESP_PHY_PLL_TRACK_PERIOD_MS * 1000)
static void phy_track_pll_internal(void);
#endif
#if CONFIG_IEEE802154_ENABLED || CONFIG_BT_ENABLED || CONFIG_ESP_WIFI_ENABLED
bool phy_enabled_modem_contains(esp_phy_modem_t modem)
@@ -35,6 +37,7 @@ bool phy_enabled_modem_contains(esp_phy_modem_t modem)
}
#endif
#if !CONFIG_ESP_PHY_DISABLE_PLL_TRACK
void phy_track_pll(void)
{
// Light sleep scenario: enabling and disabling PHY frequently, the timer will not get triggered.
@@ -109,6 +112,7 @@ void phy_track_pll_deinit(void)
ESP_ERROR_CHECK(esp_timer_stop(phy_track_pll_timer));
ESP_ERROR_CHECK(esp_timer_delete(phy_track_pll_timer));
}
#endif
void phy_set_modem_flag(esp_phy_modem_t modem)
{

View File

@@ -330,12 +330,12 @@ void esp_phy_enable(esp_phy_modem_t modem)
#endif
// ESP32 will track pll in the wifi/BT modem interrupt handler.
#if !CONFIG_IDF_TARGET_ESP32
#if !CONFIG_IDF_TARGET_ESP32 && !CONFIG_ESP_PHY_DISABLE_PLL_TRACK
phy_track_pll_init();
#endif
}
phy_set_modem_flag(modem);
#if !CONFIG_IDF_TARGET_ESP32
#if !CONFIG_IDF_TARGET_ESP32 && !CONFIG_ESP_PHY_DISABLE_PLL_TRACK
// Immediately track pll when phy enabled.
phy_track_pll();
#endif
@@ -355,7 +355,7 @@ void esp_phy_disable(esp_phy_modem_t modem)
phy_clr_modem_flag(modem);
if (phy_get_modem_flag() == 0) {
// ESP32 will track pll in the wifi/BT modem interrupt handler.
#if !CONFIG_IDF_TARGET_ESP32
#if !CONFIG_IDF_TARGET_ESP32 && !CONFIG_ESP_PHY_DISABLE_PLL_TRACK
phy_track_pll_deinit();
#endif
#if SOC_PM_MODEM_RETENTION_BY_BACKUPDMA

View File

@@ -113,11 +113,15 @@ void esp_phy_enable(esp_phy_modem_t modem)
} else {
phy_wakeup_init();
}
#if !CONFIG_ESP_PHY_DISABLE_PLL_TRACK
phy_track_pll_init();
#endif
}
phy_set_modem_flag(modem);
// Immediately track pll when phy enabled.
#if !CONFIG_ESP_PHY_DISABLE_PLL_TRACK
phy_track_pll();
#endif
#if CONFIG_ESP_PHY_RECORD_USED_TIME
phy_record_time(true, modem);
#endif
@@ -133,7 +137,9 @@ void esp_phy_disable(esp_phy_modem_t modem)
phy_clr_modem_flag(modem);
if (phy_get_modem_flag() == 0) {
#if !CONFIG_ESP_PHY_DISABLE_PLL_TRACK
phy_track_pll_deinit();
#endif
phy_close_rf();
phy_xpd_tsens();
#if SOC_MODEM_CLOCK_IS_INDEPENDENT

View File

@@ -13,3 +13,9 @@ CONFIG_LWIP_TCPIP_TASK_PRIO=23
CONFIG_IPERF_TRAFFIC_TASK_PRIORITY=23
CONFIG_IPERF_REPORT_TASK_PRIORITY=24
CONFIG_COMPILER_OPTIMIZATION_PERF=y
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
# These two configurations disable the phy pll track feature, only used for experimental
CONFIG_ESP_PHY_DEBUG=y
CONFIG_ESP_PHY_DISABLE_PLL_TRACK=y