Skip to content

Commit 91d8c26

Browse files
committed
Merge branch 'bugfix/fix_16mbit_psram_id_read_error' into 'master'
psram: fix 16mbit psram id read error See merge request espressif/esp-idf!9083
2 parents 0578214 + 3ecbb59 commit 91d8c26

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

components/esp32/spiram_psram.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,14 @@ esp_err_t IRAM_ATTR psram_enable(psram_cache_mode_t mode, psram_vaddr_mode_t vad
900900
bootloader_common_vddsdio_configure();
901901
// GPIO related settings
902902
psram_gpio_config(&psram_io, mode);
903+
904+
/* 16Mbit psram ID read error
905+
* workaround: Issue a pre-condition of dummy read id, then Read ID command
906+
*/
907+
psram_read_id(&s_psram_id);
903908
psram_read_id(&s_psram_id);
904909
if (!PSRAM_IS_VALID(s_psram_id)) {
910+
ESP_EARLY_LOGE(TAG, "PSRAM ID read error: 0x%08x", (uint32_t)s_psram_id);
905911
return ESP_FAIL;
906912
}
907913

components/esp32s2/spiram_psram.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
#if CONFIG_SPIRAM
4848
#include "soc/rtc.h"
4949

50+
static const char* TAG = "psram";
51+
5052
//Commands for PSRAM chip
5153
#define PSRAM_READ 0x03
5254
#define PSRAM_FAST_READ 0x0B
@@ -150,7 +152,6 @@ typedef struct {
150152
.psram_spihd_sd2_io = PSRAM_SPIHD_SD2_IO, \
151153
}
152154

153-
//static const char* TAG = "psram";
154155
typedef enum {
155156
PSRAM_SPI_1 = 0x1,
156157
/* PSRAM_SPI_2, */
@@ -431,8 +432,14 @@ esp_err_t IRAM_ATTR psram_enable(psram_cache_mode_t mode, psram_vaddr_mode_t vad
431432
/* SPI1: set cs timing(hold time) in order to send commands on SPI1 */
432433
psram_set_clk_mode(_SPI_FLASH_PORT, PSRAM_CLK_MODE_A1C);
433434
psram_set_spi1_cmd_cs_timing(PSRAM_CLK_MODE_A1C);
434-
psram_read_id(&s_psram_id);
435+
436+
/* 16Mbit psram ID read error
437+
* workaround: Issue a pre-condition of dummy read id, then Read ID command
438+
*/
439+
psram_read_id(&s_psram_id);
440+
psram_read_id(&s_psram_id);
435441
if (!PSRAM_IS_VALID(s_psram_id)) {
442+
ESP_EARLY_LOGE(TAG, "PSRAM ID read error: 0x%08x", s_psram_id);
436443
return ESP_FAIL;
437444
}
438445

0 commit comments

Comments
 (0)