Reset GPIO16/17 on ESP32 only for non-pico

This commit is contained in:
Stephan Hadinger 2021-10-12 10:58:06 +02:00
parent d527b9042e
commit 72083d34a7
1 changed files with 11 additions and 2 deletions

View File

@ -78,6 +78,10 @@
// Structs
#include "settings.h"
#ifdef CONFIG_IDF_TARGET_ESP32
#include "soc/efuse_reg.h"
#endif
/*********************************************************************************************\
* Global variables
\*********************************************************************************************/
@ -225,9 +229,14 @@ void setup(void) {
#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();