Merge pull request #13345 from s-hadinger/esp32_nopsram

Reset GPIO16/17 on ESP32 only for non-pico
This commit is contained in:
Theo Arends 2021-10-12 11:22:51 +02:00 committed by GitHub
commit 58bb709202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -78,6 +78,10 @@
// Structs
#include "settings.h"
#ifdef CONFIG_IDF_TARGET_ESP32
#include "soc/efuse_reg.h"
#endif
/*********************************************************************************************\
* Global variables
\*********************************************************************************************/
@ -222,6 +226,18 @@ void setup(void) {
#endif
#endif
#ifdef CONFIG_IDF_TARGET_ESP32
// restore GPIO16/17 if no PSRAM is found
if (!FoundPSRAM()) {
// test if the CPU is not pico
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
uint32_t pkg_version = chip_ver & 0x7;
if (pkg_version <= 3) { // D0WD, S0WD, D2WD
gpio_reset_pin(GPIO_NUM_16);
gpio_reset_pin(GPIO_NUM_17);
}
}
#endif
RtcPreInit();
SettingsInit();