Skip to content

Instantly share code, notes, and snippets.

@Scavanger
Last active March 7, 2022 17:18
Show Gist options
  • Save Scavanger/2286fe52ea437efcf78f9dc4798931e2 to your computer and use it in GitHub Desktop.
Save Scavanger/2286fe52ea437efcf78f9dc4798931e2 to your computer and use it in GitHub Desktop.
Read ESP32 revision from fuse
/*
This sketch reads the version number of hte ESP32 chip
Original by
2017-07-17 Andreas Spiess
Update for arduino-esp32 V2.X by
2022-03-07 Andreas K.
*/
#include "soc/efuse_reg.h"
int getChipRevision()
{
return (REG_READ(EFUSE_BLK0_RDATA3_REG) >> EFUSE_RD_CHIP_VER_REV1_S & EFUSE_RD_CHIP_VER_REV1_V);
}
void setup() {
Serial.begin(115200);
delay(200);
Serial.print("REG_READ(EFUSE_BLK0_RDATA3_REG) ");
Serial.println(REG_READ(EFUSE_BLK0_RDATA3_REG), BIN);
Serial.print("EFUSE_RD_CHIP_VER_REV1_S ");
Serial.println(EFUSE_RD_CHIP_VER_REV1_S , BIN);
Serial.print("EFUSE_RD_CHIP_VER_REV1_V ");
Serial.println(EFUSE_RD_CHIP_VER_REV1_V , BIN);
Serial.println();
Serial.print("Chip Revision (official version): ");
Serial.println(getChipRevision());
Serial.print("Chip Revision from shift Opration: ");
Serial.println(REG_READ(EFUSE_BLK0_RDATA3_REG) >> EFUSE_RD_CHIP_VER_REV1_S, BIN);
}
// the loop function runs over and over again forever
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment