Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset through AIRCR (#540) #712

Merged
merged 1 commit into from May 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/stlink/reg.h
Expand Up @@ -12,4 +12,9 @@
#define STLINK_REG_DCRSR 0xe000edf4
#define STLINK_REG_DCRDR 0xe000edf8

/* Application Interrupt and Reset Control Register */
#define STLINK_REG_AIRCR 0xe000ed0c
#define STLINK_REG_AIRCR_VECTKEY 0x05fa0000
#define STLINK_REG_AIRCR_SYSRESETREQ 0x00000004

#endif /* STLINK_REG_H_ */
5 changes: 5 additions & 0 deletions src/sg.c
Expand Up @@ -535,6 +535,11 @@ int _stlink_sg_reset(stlink_t *sl) {
if (stlink_q(sl))
return -1;

// Reset through AIRCR so NRST does not need to be connected
if (stlink_write_debug32(sl, STLINK_REG_AIRCR,
STLINK_REG_AIRCR_VECTKEY | STLINK_REG_AIRCR_SYSRESETREQ))
return -1;

stlink_stat(sl, "core reset");
return 0;
}
Expand Down
9 changes: 4 additions & 5 deletions src/usb.c
Expand Up @@ -368,10 +368,7 @@ int _stlink_usb_exit_dfu_mode(stlink_t* sl) {
return 0;
}

/**
* TODO - not convinced this does anything...
* @param sl
*/

int _stlink_usb_reset(stlink_t * sl) {
struct stlink_libusb * const slu = sl->backend_data;
unsigned char* const data = sl->q_buf;
Expand All @@ -389,7 +386,9 @@ int _stlink_usb_reset(stlink_t * sl) {
return (int) size;
}

return 0;
// Reset through AIRCR so NRST does not need to be connected
return stlink_write_debug32(sl, STLINK_REG_AIRCR,
STLINK_REG_AIRCR_VECTKEY | STLINK_REG_AIRCR_SYSRESETREQ);
}


Expand Down