Skip to content

Commit

Permalink
esptool: Read 64-bit MAC address on C6 and H2
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantinKondrashov committed May 22, 2023
1 parent 80dc210 commit 54bbf62
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions esptool/targets/esp32c6.py
Expand Up @@ -136,8 +136,12 @@ def override_vddsdio(self, new_voltage):

def read_mac(self):
mac0 = self.read_reg(self.MAC_EFUSE_REG)
mac1 = self.read_reg(self.MAC_EFUSE_REG + 4) # only bottom 16 bits are MAC
bitstring = struct.pack(">II", mac1, mac0)[2:]
mac_reg1 = self.read_reg(self.MAC_EFUSE_REG + 4)
mac1 = mac_reg1 & 0xFFFF
mac_ext = (mac_reg1 >> 16) & 0xFFFF
bitstring = struct.pack(">HIH", mac1, mac0, mac_ext)
# MAC: 60:55:f9:f7:2c:a2:ff:fe
# | mac1| mac0 | mac_ext|
return tuple(bitstring)

def get_flash_crypt_config(self):
Expand Down

0 comments on commit 54bbf62

Please sign in to comment.