]> granicus.if.org Git - esp-idf/commitdiff
bugfix(psram): made some modifcations to support the psram driver backport
authorchenjianqiang <chenjianqiang@espressif.com>
Wed, 13 Feb 2019 08:06:10 +0000 (16:06 +0800)
committerchenjianqiang <chenjianqiang@espressif.com>
Wed, 13 Feb 2019 08:06:38 +0000 (16:06 +0800)
components/esp32/Kconfig
components/esp32/spiram_psram.c

index fe35029006f6d95566164e81b23672cf31f11391..23fcf3f30ecad1c2980c2bda55651e7d5d9173f8 100644 (file)
@@ -213,6 +213,20 @@ config SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
         in PSRAM instead of internal memory, and placed most of variables of lwip,net802.11,pp,bluedroid library
         to external memory defaultly. 
 
+choice SPIRAM_OCCUPY_SPI_HOST
+    prompt "SPI host to use for 32MBit PSRAM"
+    default SPIRAM_OCCUPY_VSPI_HOST
+    depends on SPIRAM_SPEED_80M
+    help
+        When both flash and PSRAM is working under 80MHz, and the PSRAM is of type 32MBit, one of the HSPI/VSPI
+        host will be used to output the clock. Select which one to use here.
+
+config SPIRAM_OCCUPY_HSPI_HOST
+    bool "HSPI host (SPI2)"
+config SPIRAM_OCCUPY_VSPI_HOST
+    bool "VSPI host (SPI3)"
+endchoice
+
 config PICO_PSRAM_CS_IO
     int "PSRAM CS IO for ESP32-PICO chip"
     depends on SPIRAM_SUPPORT
index 87a327451e99a11e9785d0592615409a81c321cb..2fc14b496d4ba97acea4308f9ffba990776214bb 100644 (file)
@@ -149,6 +149,27 @@ typedef struct {
 #define _SPI_80M_CLK_DIV            1
 #define _SPI_40M_CLK_DIV            2
 
+//For 4MB PSRAM, we need one more SPI host, select which one to use by kconfig
+#ifdef CONFIG_SPIRAM_OCCUPY_HSPI_HOST
+#define PSRAM_SPI_MODULE    PERIPH_HSPI_MODULE
+#define PSRAM_SPI_HOST      HSPI_HOST
+#define PSRAM_CLK_SIGNAL    HSPICLK_OUT_IDX
+#define PSRAM_SPI_NUM       PSRAM_SPI_2
+#define PSRAM_SPICLKEN      DPORT_SPI2_CLK_EN
+#elif defined CONFIG_SPIRAM_OCCUPY_VSPI_HOST
+#define PSRAM_SPI_MODULE    PERIPH_VSPI_MODULE
+#define PSRAM_SPI_HOST      VSPI_HOST
+#define PSRAM_CLK_SIGNAL    VSPICLK_OUT_IDX
+#define PSRAM_SPI_NUM       PSRAM_SPI_3
+#define PSRAM_SPICLKEN      DPORT_SPI3_CLK_EN
+#else   //set to SPI avoid HSPI and VSPI being used
+#define PSRAM_SPI_MODULE    PERIPH_SPI_MODULE
+#define PSRAM_SPI_HOST      SPI_HOST
+#define PSRAM_CLK_SIGNAL    SPICLK_OUT_IDX
+#define PSRAM_SPI_NUM       PSRAM_SPI_1
+#define PSRAM_SPICLKEN      DPORT_SPI01_CLK_EN
+#endif
+
 static const char* TAG = "psram";
 typedef enum {
     PSRAM_SPI_1  = 0x1,