diff --git a/components/esp_phy/Kconfig b/components/esp_phy/Kconfig index ab8155eb98..fd4b0ef23c 100644 --- a/components/esp_phy/Kconfig +++ b/components/esp_phy/Kconfig @@ -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 diff --git a/components/esp_phy/src/phy_common.c b/components/esp_phy/src/phy_common.c index fd27be3a30..ac5070e0de 100644 --- a/components/esp_phy/src/phy_common.c +++ b/components/esp_phy/src/phy_common.c @@ -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) { diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index 1e77afc0cc..34b69e2e93 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -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 diff --git a/components/esp_phy/src/phy_init_esp32hxx.c b/components/esp_phy/src/phy_init_esp32hxx.c index 9ff88d452f..af45ae733a 100644 --- a/components/esp_phy/src/phy_init_esp32hxx.c +++ b/components/esp_phy/src/phy_init_esp32hxx.c @@ -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 diff --git a/examples/wifi/iperf/sdkconfig.defaults b/examples/wifi/iperf/sdkconfig.defaults index f096b6f061..7e44f9266f 100644 --- a/examples/wifi/iperf/sdkconfig.defaults +++ b/examples/wifi/iperf/sdkconfig.defaults @@ -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