Skip to content

Commit

Permalink
Request debugger power down after target is set to RUN state.
Browse files Browse the repository at this point in the history
  • Loading branch information
gerargz committed Oct 6, 2020
1 parent 6ac64b9 commit f1bb93e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions source/daplink/interface/swd_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,19 @@ uint8_t swd_set_target_state_sw(target_state_t state)
osDelay(2);
swd_set_target_reset(0);
osDelay(2);

// Power down
if (!swd_write_dp(DP_CTRL_STAT, 0x0)) {
return 0;
}

// Wait until ACK is deasserted
do {
if (!swd_read_dp(DP_CTRL_STAT, &val)) {
return 0;
}
} while ((val & (CSYSPWRUPACK | CDBGPWRUPACK)) == 1);

swd_off();
break;

Expand Down

0 comments on commit f1bb93e

Please sign in to comment.