@@ -247,16 +247,22 @@ static void psram_gpio_config(void)
247247}
248248
249249#if !SOC_SPI_MEM_SUPPORT_TIMING_TUNING
250- static void s_config_psram_clock (void )
250+ static void s_config_psram_clock (bool init_state )
251251{
252- // This function can be extended if we have other psram frequency
253252 uint32_t clock_conf = 0 ;
253+ if (init_state ) {
254+ clock_conf = psram_ctrlr_ll_calculate_clock_reg (4 );
255+ psram_ctrlr_ll_set_spi1_bus_clock (PSRAM_CTRLR_LL_MSPI_ID_1 , clock_conf );
256+ } else {
257+ // This function can be extended if we have other psram frequency
258+
254259#if (CONFIG_SPIRAM_SPEED == 80 )
255- clock_conf = psram_ctrlr_ll_calculate_clock_reg (1 );
260+ clock_conf = psram_ctrlr_ll_calculate_clock_reg (1 );
256261#elif (CONFIG_SPIRAM_SPEED == 40 )
257- clock_conf = psram_ctrlr_ll_calculate_clock_reg (2 );
262+ clock_conf = psram_ctrlr_ll_calculate_clock_reg (2 );
258263#endif
259- psram_ctrlr_ll_set_bus_clock (PSRAM_CTRLR_LL_MSPI_ID_0 , clock_conf );
264+ psram_ctrlr_ll_set_bus_clock (PSRAM_CTRLR_LL_MSPI_ID_0 , clock_conf );
265+ }
260266}
261267#endif //#if !SOC_SPI_MEM_SUPPORT_TIMING_TUNING
262268
@@ -289,6 +295,8 @@ esp_err_t esp_psram_impl_enable(void)
289295#if SOC_SPI_MEM_SUPPORT_TIMING_TUNING
290296 //enter MSPI slow mode to init PSRAM device registers
291297 mspi_timing_enter_low_speed_mode (true);
298+ #else
299+ s_config_psram_clock (true);
292300#endif // SOC_SPI_MEM_SUPPORT_TIMING_TUNING
293301
294302 uint32_t psram_id = 0 ;
@@ -339,7 +347,7 @@ esp_err_t esp_psram_impl_enable(void)
339347 //Back to the high speed mode. Flash/PSRAM clocks are set to the clock that user selected. SPI0/1 registers are all set correctly
340348 mspi_timing_enter_high_speed_mode (true);
341349#else
342- s_config_psram_clock ();
350+ s_config_psram_clock (false );
343351 //Configure SPI0 PSRAM related SPI Phases
344352 config_psram_spi_phases ();
345353#endif
0 commit comments