Assert reset when enabling debug
Fixes stm issues that cannot recover from bad binaries if not under reset.
@@ -892,6 +892,10 @@ uint8_t swd_set_target_state_hw(TARGET_RESET_STATE state)
return 0;
}
+ // Assert reset
+ swd_set_target_reset(1);
+ os_dly_wait(2);
+
// Enable debug
while(swd_write_word(DBG_HCSR, DBGKEY | C_DEBUGEN) == 0) {
if( --ap_retries <=0 )
@@ -908,9 +912,7 @@ uint8_t swd_set_target_state_hw(TARGET_RESET_STATE state)
return 0;
}
- // Reset again
- swd_set_target_reset(1);
- os_dly_wait(2);
+ // Deassert reset
swd_set_target_reset(0);
os_dly_wait(2);
