Skip to content

Commit 4006bd0

Browse files
authored
get sdm detection back (#869)
1 parent 818a730 commit 4006bd0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

espflash/src/flasher/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,8 @@ impl Flasher {
680680
connection.begin()?;
681681
connection.set_timeout(DEFAULT_TIMEOUT)?;
682682

683+
detect_sdm(&mut connection);
684+
683685
let detected_chip = if before_operation != ResetBeforeOperation::NoResetNoSync {
684686
// Detect which chip we are connected to.
685687
let detected_chip = detect_chip(&mut connection, use_stub)?;
@@ -1409,3 +1411,11 @@ fn detect_chip(connection: &mut Connection, use_stub: bool) -> Result<Chip, Erro
14091411
}
14101412
}
14111413
}
1414+
1415+
#[cfg(feature = "serialport")]
1416+
fn detect_sdm(connection: &mut Connection) {
1417+
if connection.read_reg(CHIP_DETECT_MAGIC_REG_ADDR).is_err() {
1418+
log::warn!("Secure Download Mode is enabled on this chip");
1419+
connection.secure_download_mode = true;
1420+
}
1421+
}

0 commit comments

Comments
 (0)