File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -165,11 +165,16 @@ def check_if_stub(instance: ESPLoader) -> ESPLoader:
165165 ESPLoader .CHIP_DETECT_MAGIC_REG_ADDR
166166 )
167167 except UnsupportedCommandError :
168- raise FatalError (
169- "Unsupported Command Error received. "
170- "Probably this means Secure Download Mode is enabled, "
171- "autodetection will not work. Need to manually specify the chip."
168+ # Only ESP32-S2 does not support chip id detection
169+ # and supports secure download mode
170+ inst = CHIP_DEFS [ "esp32s2" ](
171+ detect_port . _port , baud , trace_enabled = trace_enabled
172172 )
173+ si = inst .get_security_info ()
174+ inst .secure_download_mode = si ["parsed_flags" ]["SECURE_DOWNLOAD_ENABLE" ]
175+ inst = check_if_stub (inst )
176+ inst ._post_connect ()
177+ return inst
173178 except FatalError :
174179 log .print (" Autodetection failed, trying again..." )
175180 detect_port .connect (
You can’t perform that action at this time.
0 commit comments