diff --git a/components/esp_phy/Kconfig b/components/esp_phy/Kconfig index 75b5be45cd..93661e0973 100644 --- a/components/esp_phy/Kconfig +++ b/components/esp_phy/Kconfig @@ -166,6 +166,12 @@ 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 @@ -177,5 +183,29 @@ menu "PHY" default n help Select to support record and query phy used time. + + config ESP_PHY_IRAM_OPT + bool "PHY IRAM speed optimization" + default y + help + Select this option to place frequently called PHY library functions in IRAM. + When this option is disabled, more than 1.1Kbytes of IRAM memory will be saved, + but PHY performance will be reduced. This config only affect esp32c2 now. + + 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. + endif endmenu # PHY diff --git a/components/esp_phy/src/phy_common.c b/components/esp_phy/src/phy_common.c index 2003cd02ad..16c387f7e2 100644 --- a/components/esp_phy/src/phy_common.c +++ b/components/esp_phy/src/phy_common.c @@ -26,6 +26,7 @@ static const char* TAG = "phy_comm"; 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 @@ -34,8 +35,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 static esp_phy_ant_gpio_config_t s_phy_ant_gpio_config = { 0 }; static esp_phy_ant_config_t s_phy_ant_config = { 0 }; @@ -47,6 +49,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. @@ -121,6 +124,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 1e902a318b..c33b6cb5d9 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -329,7 +329,7 @@ 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 @@ -340,7 +340,7 @@ void esp_phy_enable(esp_phy_modem_t modem) } 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 @@ -360,7 +360,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