mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
psram: fix 16mbit psram id read error
This commit is contained in:
@ -900,8 +900,14 @@ esp_err_t IRAM_ATTR psram_enable(psram_cache_mode_t mode, psram_vaddr_mode_t vad
|
|||||||
bootloader_common_vddsdio_configure();
|
bootloader_common_vddsdio_configure();
|
||||||
// GPIO related settings
|
// GPIO related settings
|
||||||
psram_gpio_config(&psram_io, mode);
|
psram_gpio_config(&psram_io, mode);
|
||||||
|
|
||||||
|
/* 16Mbit psram ID read error
|
||||||
|
* workaround: Issue a pre-condition of dummy read id, then Read ID command
|
||||||
|
*/
|
||||||
|
psram_read_id(&s_psram_id);
|
||||||
psram_read_id(&s_psram_id);
|
psram_read_id(&s_psram_id);
|
||||||
if (!PSRAM_IS_VALID(s_psram_id)) {
|
if (!PSRAM_IS_VALID(s_psram_id)) {
|
||||||
|
ESP_EARLY_LOGE(TAG, "PSRAM ID read error: 0x%08x", (uint32_t)s_psram_id);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#if CONFIG_SPIRAM
|
#if CONFIG_SPIRAM
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
|
|
||||||
|
static const char* TAG = "psram";
|
||||||
|
|
||||||
//Commands for PSRAM chip
|
//Commands for PSRAM chip
|
||||||
#define PSRAM_READ 0x03
|
#define PSRAM_READ 0x03
|
||||||
#define PSRAM_FAST_READ 0x0B
|
#define PSRAM_FAST_READ 0x0B
|
||||||
@ -99,7 +101,6 @@ typedef enum {
|
|||||||
#define _SPI_40M_CLK_DIV 2
|
#define _SPI_40M_CLK_DIV 2
|
||||||
#define _SPI_20M_CLK_DIV 4
|
#define _SPI_20M_CLK_DIV 4
|
||||||
|
|
||||||
static const char* TAG = "psram";
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PSRAM_SPI_1 = 0x1,
|
PSRAM_SPI_1 = 0x1,
|
||||||
PSRAM_SPI_2,
|
PSRAM_SPI_2,
|
||||||
@ -752,8 +753,14 @@ esp_err_t IRAM_ATTR psram_enable(psram_cache_mode_t mode, psram_vaddr_mode_t vad
|
|||||||
CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(PSRAM_SPI_1), SPI_MEM_CS_SETUP_M);
|
CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(PSRAM_SPI_1), SPI_MEM_CS_SETUP_M);
|
||||||
psram_gpio_config(mode);
|
psram_gpio_config(mode);
|
||||||
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[PSRAM_CS_IO], PIN_FUNC_GPIO);
|
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[PSRAM_CS_IO], PIN_FUNC_GPIO);
|
||||||
|
|
||||||
|
/* 16Mbit psram ID read error
|
||||||
|
* workaround: Issue a pre-condition of dummy read id, then Read ID command
|
||||||
|
*/
|
||||||
|
psram_read_id(&s_psram_id);
|
||||||
psram_read_id(&s_psram_id);
|
psram_read_id(&s_psram_id);
|
||||||
if (!PSRAM_IS_VALID(s_psram_id)) {
|
if (!PSRAM_IS_VALID(s_psram_id)) {
|
||||||
|
ESP_EARLY_LOGE(TAG, "PSRAM ID read error: 0x%08x", s_psram_id);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
uint32_t flash_id = g_rom_flashchip.device_id;
|
uint32_t flash_id = g_rom_flashchip.device_id;
|
||||||
|
Reference in New Issue
Block a user