Skip to content

Commit d7f1adf

Browse files
dobairolandradimkarnis
authored andcommitted
fix(esp32c6): Fix ESP32-C6FH8 package detection
1 parent a1a4e95 commit d7f1adf

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

esptool/targets/esp32c6.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,41 @@ def get_major_chip_version(self):
113113
num_word = 3
114114
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 22) & 0x03
115115

116+
def get_flash_cap(self):
117+
num_word = 4
118+
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 0) & 0x07
119+
116120
def get_chip_description(self):
117-
chip_name = {
118-
0: "ESP32-C6 (QFN40)",
119-
1: "ESP32-C6FH4 (QFN32)",
120-
}.get(self.get_pkg_version(), "Unknown ESP32-C6")
121+
pkg_version = self.get_pkg_version()
122+
123+
chip_name = "Unknown ESP32-C6"
124+
if pkg_version == 0:
125+
chip_name = "ESP32-C6 (QFN40)"
126+
elif pkg_version == 1:
127+
# Both ESP32-C6FH4 and ESP32-C6FH8 have pkg_version 1
128+
# so we need to distinguish them by flash_cap
129+
flash_cap = self.get_flash_cap()
130+
if flash_cap == 1:
131+
chip_name = "ESP32-C6FH4 (QFN32)"
132+
elif flash_cap == 2:
133+
chip_name = "ESP32-C6FH8 (QFN32)"
121134
major_rev = self.get_major_chip_version()
122135
minor_rev = self.get_minor_chip_version()
123136
return f"{chip_name} (revision v{major_rev}.{minor_rev})"
124137

125138
def get_chip_features(self):
139+
flash_version = {
140+
1: "Embedded Flash 4MB",
141+
2: "Embedded Flash 8MB",
142+
}.get(self.get_flash_cap(), "Unknown Embedded Flash")
143+
126144
return [
127145
"Wi-Fi 6",
128146
"BT 5 (LE)",
129147
"IEEE802.15.4",
130148
"Single Core + LP Core",
131149
"160MHz",
150+
flash_version,
132151
]
133152

134153
def get_crystal_freq(self):

0 commit comments

Comments
 (0)