Skip to content

Commit

Permalink
Merge branch 'feature/bringup_psram_c5' into 'master'
Browse files Browse the repository at this point in the history
feat(spiram): psram support on esp32c5

Closes IDF-8690

See merge request espressif/esp-idf!31393
  • Loading branch information
mythbuster5 committed Jul 5, 2024
2 parents 44f2915 + 9de3e73 commit fabf688
Show file tree
Hide file tree
Showing 15 changed files with 656 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "hal/mmu_ll.h"
#include "hal/cache_hal.h"
#include "hal/cache_ll.h"
#include "hal/mspi_timing_tuning_ll.h"

void bootloader_flash_update_id()
{
Expand Down Expand Up @@ -203,6 +204,12 @@ static void bootloader_spi_flash_resume(void)

esp_err_t bootloader_init_spi_flash(void)
{
// Set source mspi pll clock as 80M in bootloader stage.
// SPLL clock on C5 is 480MHz , and mspi_pll needs 80MHz
// in this stage, set divider as 6
mspi_ll_clock_src_sel(MSPI_CLK_SRC_SPLL);
mspi_ll_fast_set_hs_divider(6);

bootloader_init_flash_configure();
bootloader_spi_flash_resume();
bootloader_flash_unlock();
Expand Down
4 changes: 2 additions & 2 deletions components/esp_common/test_apps/.build-test-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
components/esp_common/test_apps/esp_common:
disable:
- if: CONFIG_NAME == "psram" and SOC_SPIRAM_SUPPORTED != 1
- if: CONFIG_NAME == "psram" and IDF_TARGET in ["esp32p4"]
- if: CONFIG_NAME == "psram" and IDF_TARGET in ["esp32p4", "esp32c5"]
temporary: true
reason: esp32p4 is not supported yet # TODO: IDF-7557
reason: esp32p4/c5 is not supported yet # TODO: IDF-7557
48 changes: 48 additions & 0 deletions components/esp_psram/esp32c5/Kconfig.spiram
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
config SPIRAM
bool "Support for external, SPI-connected RAM"
default "n"
help
This enables support for an external SPI RAM chip, connected in parallel with the
main SPI flash chip.

menu "SPI RAM config"
depends on SPIRAM

choice SPIRAM_MODE
prompt "Mode of SPI RAM chip in use"
default SPIRAM_MODE_QUAD

config SPIRAM_MODE_QUAD
bool "Quad Mode PSRAM"

endchoice

config SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
bool "Allow external memory as an argument to xTaskCreateStatic"
default y
help
Accessing memory in SPIRAM has certain restrictions, so task stacks allocated by xTaskCreate
are by default allocated from internal RAM.

This option allows for passing memory allocated from SPIRAM to be passed to xTaskCreateStatic.
This should only be used for tasks where the stack is never accessed while the cache is disabled.

choice SPIRAM_SPEED
prompt "Set RAM clock speed"
default SPIRAM_SPEED_40M
help
Select the speed for the SPI RAM chip.

config SPIRAM_SPEED_80M
bool "80MHz clock speed"
config SPIRAM_SPEED_40M
bool "40Mhz clock speed"
endchoice

config SPIRAM_SPEED
int
default 80 if SPIRAM_SPEED_80M
default 40 if SPIRAM_SPEED_40M

source "$IDF_PATH/components/esp_psram/Kconfig.spiram.common" # insert non-chip-specific items here
endmenu
Loading

0 comments on commit fabf688

Please sign in to comment.