Skip to content

Commit

Permalink
fix(software) workaround by forcing SYSRESETQ on DAP_ResetTarget befo…
Browse files Browse the repository at this point in the history
…re nRESET
  • Loading branch information
kerms committed Apr 23, 2024
1 parent cc4f747 commit e2140fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/DAP/source/DAP.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ static uint32_t DAP_Disconnect(uint8_t *response) {
// return: number of bytes in response
static uint32_t DAP_ResetTarget(uint8_t *response) {

/* Workaround for software reset when nRESET is not connected */
uint32_t AIRCR_REG_ADDR = 0xE000ED0C;
uint32_t AIRCR_RESET_VAL = (0x05FA << 16 | 1 << 2); /* Vector key | SYSRESETREQ bit */
SWD_Transfer(0x05,&AIRCR_REG_ADDR);
dap_os_delay(2);
SWD_Transfer(0x0d,&AIRCR_RESET_VAL);

*(response+1) = RESET_TARGET();
*(response+0) = DAP_OK;
return (2U);
Expand Down

0 comments on commit e2140fd

Please sign in to comment.