fix: enable auto-detection of ESP32-S2 in secure download mode

This commit is contained in:
Jaroslav Burian
2025-06-30 02:53:55 +02:00
parent 6fc3e44279
commit c2f5d2164d

View File

@@ -165,11 +165,16 @@ def detect_chip(
ESPLoader.CHIP_DETECT_MAGIC_REG_ADDR ESPLoader.CHIP_DETECT_MAGIC_REG_ADDR
) )
except UnsupportedCommandError: except UnsupportedCommandError:
raise FatalError( # Only ESP32-S2 does not support chip id detection
"Unsupported Command Error received. " # and supports secure download mode
"Probably this means Secure Download Mode is enabled, " inst = CHIP_DEFS["esp32s2"](
"autodetection will not work. Need to manually specify the chip." detect_port._port, baud, trace_enabled=trace_enabled
) )
si = inst.get_security_info()
inst.secure_download_mode = si["parsed_flags"]["SECURE_DOWNLOAD_ENABLE"]
inst = check_if_stub(inst)
inst._post_connect()
return inst
except FatalError: except FatalError:
log.print(" Autodetection failed, trying again...") log.print(" Autodetection failed, trying again...")
detect_port.connect( detect_port.connect(