diff --git a/components/esp_phy/Kconfig b/components/esp_phy/Kconfig index 21101b5dc8c..e51102d1da3 100644 --- a/components/esp_phy/Kconfig +++ b/components/esp_phy/Kconfig @@ -219,6 +219,33 @@ menu "PHY" 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. + config ESP_PHY_PLL_TRACK_TEMP_DEBUG + bool "PHY temperature tracking debug mode" + depends on ESP_PHY_DEBUG + default n + help + If enabled, allows customization of temperature delta for PHY track pll. + + config ESP_PHY_PLL_TRACK_TEMP_DEBUG_FLAG + int "Debug flag for PHY temperature tracking" + depends on ESP_PHY_PLL_TRACK_TEMP_DEBUG + range 1 3 + default 1 + help + Bitmask debug flag passed to the PHY temperature tracking routine. + Each bit enables a specific tracking mode. + + - bit0: PLL tracking + - bit1: Calibration parameter tracking + + config ESP_PHY_PLL_TRACK_TEMP_DELTA + int "Temperature delta for PHY track pll" + depends on ESP_PHY_PLL_TRACK_TEMP_DEBUG + range 0 255 + default 10 + help + Set the temperature delta for PHY track pll. + config ESP_PHY_INIT_IRAM bool "Place PHY (de)init in IRAM" depends on SOC_IEEE802154_BLE_ONLY diff --git a/components/esp_phy/include/esp_private/phy.h b/components/esp_phy/include/esp_private/phy.h index b36202193e7..de9a9820227 100644 --- a/components/esp_phy/include/esp_private/phy.h +++ b/components/esp_phy/include/esp_private/phy.h @@ -273,6 +273,16 @@ void esp_phy_sleep_data_deinit(void); */ void phy_wait_freq_hw_hop_done(void); +#if CONFIG_ESP_PHY_PLL_TRACK_TEMP_DEBUG +/** + * @brief Set the temperature delta for PHY track pll + * + * @param debug_flag Debug flag for PHY temperature tracking + * @param track_temp Temperature delta for PHY temperature tracking + */ +void phy_track_temp_debug(uint8_t debug_flag, uint8_t track_temp); +#endif + #ifdef __cplusplus } #endif diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index 4bab302fb30..dc2dbf0dccf 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -336,6 +336,9 @@ void esp_phy_enable(esp_phy_modem_t modem) assert(phy_module_has_clock_bits(PHY_INIT_MODEM_CLOCK_REQUIRED_BITS)); if (s_is_phy_calibrated == false) { esp_phy_load_cal_and_init(); +#if CONFIG_ESP_PHY_PLL_TRACK_TEMP_DEBUG + phy_track_temp_debug(CONFIG_ESP_PHY_PLL_TRACK_TEMP_DEBUG_FLAG, CONFIG_ESP_PHY_PLL_TRACK_TEMP_DELTA); +#endif s_is_phy_calibrated = true; } else { #if SOC_PM_SUPPORT_PMU_MODEM_STATE && CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP diff --git a/components/esp_phy/src/phy_init_esp32hxx.c b/components/esp_phy/src/phy_init_esp32hxx.c index dcbca4f325d..daaa51a01b8 100644 --- a/components/esp_phy/src/phy_init_esp32hxx.c +++ b/components/esp_phy/src/phy_init_esp32hxx.c @@ -117,6 +117,9 @@ void esp_phy_enable(esp_phy_modem_t modem) register_chipv7_phy(NULL, NULL, PHY_RF_CAL_FULL); #if CONFIG_ESP_PHY_ENABLE_VERSION_PRINT phy_version_print(); +#endif +#if CONFIG_ESP_PHY_PLL_TRACK_TEMP_DEBUG + phy_track_temp_debug(CONFIG_ESP_PHY_PLL_TRACK_TEMP_DEBUG_FLAG, CONFIG_ESP_PHY_PLL_TRACK_TEMP_DELTA); #endif s_phy_is_enabled = true; } else {