From 72083d34a71358ce57cc617acf458a57df6f5f50 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 12 Oct 2021 10:58:06 +0200 Subject: [PATCH] Reset GPIO16/17 on ESP32 only for non-pico --- tasmota/tasmota.ino | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 95c707405..351fbed7c 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -78,6 +78,10 @@ // Structs #include "settings.h" +#ifdef CONFIG_IDF_TARGET_ESP32 +#include "soc/efuse_reg.h" +#endif + /*********************************************************************************************\ * Global variables \*********************************************************************************************/ @@ -225,8 +229,13 @@ void setup(void) { #ifdef CONFIG_IDF_TARGET_ESP32 // restore GPIO16/17 if no PSRAM is found if (!FoundPSRAM()) { - gpio_reset_pin(GPIO_NUM_16); - gpio_reset_pin(GPIO_NUM_17); + // 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();