Skip to content

Commit 70733c1

Browse files
dobairolandradimkarnis
authored andcommitted
fix(esp32c6): Fix ESP32-C6FH8 package detection
1 parent 3660ff6 commit 70733c1

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

esptool/targets/esp32c6.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,42 @@ def get_major_chip_version(self):
112112
num_word = 3
113113
return (self.read_reg(self.EFUSE_BLOCK1_ADDR + (4 * num_word)) >> 22) & 0x03
114114

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

124137
def get_chip_features(self):
125-
return ["WiFi 6", "BT 5", "IEEE802.15.4"]
138+
flash_version = {
139+
1: "Embedded Flash 4MB",
140+
2: "Embedded Flash 8MB",
141+
}.get(self.get_flash_cap(), "Unknown Embedded Flash")
142+
143+
return [
144+
"Wi-Fi 6",
145+
"BT 5 (LE)",
146+
"IEEE802.15.4",
147+
"Single Core + LP Core",
148+
"160MHz",
149+
flash_version,
150+
]
126151

127152
def get_crystal_freq(self):
128153
# ESP32C6 XTAL is fixed to 40MHz

0 commit comments

Comments
 (0)