From f256aabf84796f67caba1c493716a84ed43428ad Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 15 Mar 2022 19:24:28 +0100 Subject: [PATCH 1/2] Fix boot freeze when trying to init PSRAM on Pico D4 --- cores/esp32/esp32-hal-psram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/esp32/esp32-hal-psram.c b/cores/esp32/esp32-hal-psram.c index 44612562977..1c2da1a1333 100644 --- a/cores/esp32/esp32-hal-psram.c +++ b/cores/esp32/esp32-hal-psram.c @@ -53,7 +53,7 @@ bool psramInit(){ #if CONFIG_IDF_TARGET_ESP32 uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG); uint32_t pkg_ver = chip_ver & 0x7; - if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) { + if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) { spiramFailed = true; log_w("PSRAM not supported!"); return false; From 2a6103a5a7e148a5341da20a4d661b837e92f688 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Thu, 17 Mar 2022 14:26:04 +0100 Subject: [PATCH 2/2] Don't deconfigure GPIO16/17 in Pico D4 --- cores/esp32/esp32-hal-psram.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cores/esp32/esp32-hal-psram.c b/cores/esp32/esp32-hal-psram.c index 1c2da1a1333..de5b7c0071f 100644 --- a/cores/esp32/esp32-hal-psram.c +++ b/cores/esp32/esp32-hal-psram.c @@ -53,7 +53,7 @@ bool psramInit(){ #if CONFIG_IDF_TARGET_ESP32 uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG); uint32_t pkg_ver = chip_ver & 0x7; - if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) { + if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) { spiramFailed = true; log_w("PSRAM not supported!"); return false; @@ -67,8 +67,10 @@ bool psramInit(){ spiramFailed = true; log_w("PSRAM init failed!"); #if CONFIG_IDF_TARGET_ESP32 - pinMatrixOutDetach(16, false, false); - pinMatrixOutDetach(17, false, false); + if (pkg_ver != EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) { + pinMatrixOutDetach(16, false, false); + pinMatrixOutDetach(17, false, false); + } #endif return false; }