diff --git a/src/target.rs b/src/target.rs index 0d469ab..e195b9d 100644 --- a/src/target.rs +++ b/src/target.rs @@ -37,7 +37,6 @@ impl PhysicalTarget { } pub fn resync_target(&mut self) -> Result<(), Error> { - self.port.discard_buffers()?; self.port.set_dtr(true)?; self.port.set_rts(true)?; std::thread::sleep(Duration::from_millis(10)); @@ -45,6 +44,8 @@ impl PhysicalTarget { std::thread::sleep(Duration::from_millis(100)); for i in (0..5).rev() { + self.port.discard_buffers()?; + std::thread::sleep(Duration::from_millis(10)); self.port.write(b"U")?; let mut buf = [0u8; 1];