psram: add 16Mbit psram support for esp32s2

This commit is contained in:
chenjianqiang 2020-03-17 21:59:11 +08:00
parent 2e7ae75011
commit 42154848cc
2 changed files with 11 additions and 1 deletions

View file

@ -118,7 +118,10 @@ menu "ESP32S2-specific"
choice SPIRAM_TYPE choice SPIRAM_TYPE
prompt "Type of SPI RAM chip in use" prompt "Type of SPI RAM chip in use"
default SPIRAM_TYPE_ESPPSRAM32 default SPIRAM_TYPE_ESPPSRAM16
config SPIRAM_TYPE_ESPPSRAM16
bool "ESP-PSRAM16 or APS1604"
config SPIRAM_TYPE_ESPPSRAM32 config SPIRAM_TYPE_ESPPSRAM32
bool "ESP-PSRAM32 or IS25WP032" bool "ESP-PSRAM32 or IS25WP032"
@ -129,6 +132,7 @@ menu "ESP32S2-specific"
config SPIRAM_SIZE config SPIRAM_SIZE
int int
default 2097152 if SPIRAM_TYPE_ESPPSRAM16
default 4194304 if SPIRAM_TYPE_ESPPSRAM32 default 4194304 if SPIRAM_TYPE_ESPPSRAM32
default 8388608 if SPIRAM_TYPE_ESPPSRAM64 default 8388608 if SPIRAM_TYPE_ESPPSRAM64
default 0 default 0

View file

@ -219,6 +219,8 @@ esp_err_t esp_spiram_init(void)
return r; return r;
} }
ESP_EARLY_LOGI(TAG, "Found %dMBit SPI RAM device",
(esp_spiram_get_size()*8)/(1024*1024));
ESP_EARLY_LOGI(TAG, "SPI RAM mode: %s", PSRAM_SPEED == PSRAM_CACHE_S40M ? "sram 40m" : \ ESP_EARLY_LOGI(TAG, "SPI RAM mode: %s", PSRAM_SPEED == PSRAM_CACHE_S40M ? "sram 40m" : \
PSRAM_SPEED == PSRAM_CACHE_S80M ? "sram 80m" : "sram 20m"); PSRAM_SPEED == PSRAM_CACHE_S80M ? "sram 80m" : "sram 20m");
ESP_EARLY_LOGI(TAG, "PSRAM initialized, cache is in %s mode.", \ ESP_EARLY_LOGI(TAG, "PSRAM initialized, cache is in %s mode.", \
@ -295,6 +297,10 @@ esp_err_t esp_spiram_reserve_dma_pool(size_t size) {
size_t esp_spiram_get_size(void) size_t esp_spiram_get_size(void)
{ {
psram_size_t size=psram_get_size();
if (size==PSRAM_SIZE_16MBITS) return 2*1024*1024;
if (size==PSRAM_SIZE_32MBITS) return 4*1024*1024;
if (size==PSRAM_SIZE_64MBITS) return 8*1024*1024;
return CONFIG_SPIRAM_SIZE; return CONFIG_SPIRAM_SIZE;
} }