Skip to content

Commit 79d53bd

Browse files
authored
Update ESP.getChipModel() to support ESP32-S2 (#5598)
1 parent f3f6dad commit 79d53bd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Diff for: cores/esp32/Esp.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ extern "C" {
3838
#define ESP_FLASH_IMAGE_BASE 0x1000 // Flash offset containing flash size and spi mode
3939
#elif CONFIG_IDF_TARGET_ESP32S2
4040
#include "esp32s2/rom/spi_flash.h"
41+
#include "soc/efuse_reg.h"
4142
#define ESP_FLASH_IMAGE_BASE 0x1000
4243
#elif CONFIG_IDF_TARGET_ESP32C3
4344
#include "esp32c3/rom/spi_flash.h"
@@ -270,7 +271,17 @@ const char * EspClass::getChipModel(void)
270271
return "Unknown";
271272
}
272273
#elif CONFIG_IDF_TARGET_ESP32S2
273-
return "ESP32-S2";
274+
uint32_t pkg_ver = REG_GET_FIELD(EFUSE_RD_MAC_SPI_SYS_3_REG, EFUSE_PKG_VERSION);
275+
switch (pkg_ver) {
276+
case 0:
277+
return "ESP32-S2";
278+
case 1:
279+
return "ESP32-S2FH16";
280+
case 2:
281+
return "ESP32-S2FH32";
282+
default:
283+
return "ESP32-S2 (Unknown)";
284+
}
274285
#elif CONFIG_IDF_TARGET_ESP32S3
275286
return "ESP32-S3";
276287
#elif CONFIG_IDF_TARGET_ESP32C3

0 commit comments

Comments
 (0)