diff --git a/components/esp_hw_support/mspi_timing_tuning/port/esp32p4/mspi_timing_tuning_configs.h b/components/esp_hw_support/mspi_timing_tuning/port/esp32p4/mspi_timing_tuning_configs.h index ba41d8f782..2d1595017d 100644 --- a/components/esp_hw_support/mspi_timing_tuning/port/esp32p4/mspi_timing_tuning_configs.h +++ b/components/esp_hw_support/mspi_timing_tuning/port/esp32p4/mspi_timing_tuning_configs.h @@ -21,6 +21,9 @@ #elif CONFIG_SPIRAM_SPEED_200M #define MSPI_TIMING_PSRAM_NEEDS_TUNING 1 #define MSPI_TIMING_MPLL_FREQ_MHZ 400 +#elif CONFIG_SPIRAM_SPEED_80M +#define MSPI_TIMING_PSRAM_NEEDS_TUNING 1 +#define MSPI_TIMING_MPLL_FREQ_MHZ 320 #else #define MSPI_TIMING_MPLL_FREQ_MHZ 400 #endif diff --git a/components/esp_psram/device/esp_psram_impl_ap_hex.c b/components/esp_psram/device/esp_psram_impl_ap_hex.c index 2659a2775e..cc43e72026 100644 --- a/components/esp_psram/device/esp_psram_impl_ap_hex.c +++ b/components/esp_psram/device/esp_psram_impl_ap_hex.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -54,7 +54,13 @@ #define AP_HEX_PSRAM_CS_ECC_HOLD_TIME 4 #define AP_HEX_PSRAM_CS_HOLD_DELAY 3 +#if CONFIG_SPIRAM_SPEED_200M +#define AP_HEX_PSRAM_MPLL_DEFAULT_FREQ_MHZ 500 +#elif CONFIG_SPIRAM_SPEED_80M +#define AP_HEX_PSRAM_MPLL_DEFAULT_FREQ_MHZ 320 +#else #define AP_HEX_PSRAM_MPLL_DEFAULT_FREQ_MHZ 400 +#endif typedef struct { union { @@ -369,7 +375,9 @@ esp_err_t esp_psram_impl_enable(void) { #if SOC_CLK_MPLL_SUPPORTED periph_rtc_mpll_acquire(); - periph_rtc_mpll_freq_set(AP_HEX_PSRAM_MPLL_DEFAULT_FREQ_MHZ * 1000000, NULL); + uint32_t real_mpll_freq = 0; + periph_rtc_mpll_freq_set(AP_HEX_PSRAM_MPLL_DEFAULT_FREQ_MHZ * 1000000, &real_mpll_freq); + ESP_EARLY_LOGD(TAG, "real_mpll_freq: %d", real_mpll_freq); #endif PSRAM_RCC_ATOMIC() { diff --git a/components/esp_psram/esp32p4/Kconfig.spiram b/components/esp_psram/esp32p4/Kconfig.spiram index 821188d2f3..85335b3050 100644 --- a/components/esp_psram/esp32p4/Kconfig.spiram +++ b/components/esp_psram/esp32p4/Kconfig.spiram @@ -34,6 +34,9 @@ menu "PSRAM config" depends on IDF_EXPERIMENTAL_FEATURES bool "200MHz clock speed" + config SPIRAM_SPEED_80M + bool "80MHz clock speed" + config SPIRAM_SPEED_20M bool "20MHz clock speed" endchoice @@ -41,6 +44,7 @@ menu "PSRAM config" config SPIRAM_SPEED int default 20 if SPIRAM_SPEED_20M + default 80 if SPIRAM_SPEED_80M default 100 if SPIRAM_SPEED_100M default 200 if SPIRAM_SPEED_200M