File tree 3 files changed +32
-0
lines changed
libraries/ESP32/examples/ChipID/GetChipID
3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,33 @@ uint8_t EspClass::getChipRevision(void)
218
218
return chip_info.revision ;
219
219
}
220
220
221
+ const char * EspClass::getChipModel (void )
222
+ {
223
+ uint32_t chip_ver = REG_GET_FIELD (EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
224
+ uint32_t pkg_ver = chip_ver & 0x7 ;
225
+ switch (pkg_ver) {
226
+ case EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ6 :
227
+ return " ESP32-D0WDQ6" ;
228
+ case EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ5 :
229
+ return " ESP32-D0WDQ5" ;
230
+ case EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 :
231
+ return " ESP32-D2WDQ5" ;
232
+ case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 :
233
+ return " ESP32-PICO-D2" ;
234
+ case EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 :
235
+ return " ESP32-PICO-D4" ;
236
+ default :
237
+ return " Unknown" ;
238
+ }
239
+ }
240
+
241
+ uint8_t EspClass::getChipCores (void )
242
+ {
243
+ esp_chip_info_t chip_info;
244
+ esp_chip_info (&chip_info);
245
+ return chip_info.cores ;
246
+ }
247
+
221
248
const char * EspClass::getSdkVersion (void )
222
249
{
223
250
return esp_get_idf_version ();
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ class EspClass
75
75
uint32_t getMaxAllocPsram ();
76
76
77
77
uint8_t getChipRevision ();
78
+ const char * getChipModel ();
79
+ uint8_t getChipCores ();
78
80
uint32_t getCpuFreqMHz (){ return getCpuFrequencyMhz (); }
79
81
inline uint32_t getCycleCount () __attribute__((always_inline));
80
82
const char * getSdkVersion ();
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ void loop() {
9
9
Serial.printf (" ESP32 Chip ID = %04X" ,(uint16_t )(chipid>>32 ));// print High 2 bytes
10
10
Serial.printf (" %08X\n " ,(uint32_t )chipid);// print Low 4bytes.
11
11
12
+ Serial.printf (" ESP32 Chip model = %s Rev %d\n " , ESP.getChipModel (), ESP.getChipRevision ());
13
+ Serial.printf (" This chip has %d cores\n " , ESP.getChipCores ());
14
+
12
15
delay (3000 );
13
16
14
17
}
You can’t perform that action at this time.
0 commit comments