File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed
libraries/ESP32/examples/ChipID/GetChipID Expand file tree Collapse file tree 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)
218218 return chip_info.revision ;
219219}
220220
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+
221248const char * EspClass::getSdkVersion (void )
222249{
223250 return esp_get_idf_version ();
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ class EspClass
7575 uint32_t getMaxAllocPsram ();
7676
7777 uint8_t getChipRevision ();
78+ const char * getChipModel ();
79+ uint8_t getChipCores ();
7880 uint32_t getCpuFreqMHz (){ return getCpuFrequencyMhz (); }
7981 inline uint32_t getCycleCount () __attribute__((always_inline));
8082 const char * getSdkVersion ();
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ void loop() {
99 Serial.printf (" ESP32 Chip ID = %04X" ,(uint16_t )(chipid>>32 ));// print High 2 bytes
1010 Serial.printf (" %08X\n " ,(uint32_t )chipid);// print Low 4bytes.
1111
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+
1215 delay (3000 );
1316
1417}
You can’t perform that action at this time.
0 commit comments