Skip to content

Commit

Permalink
Fix JTAG reset
Browse files Browse the repository at this point in the history
  • Loading branch information
trainman419 committed Oct 8, 2015
1 parent 148997c commit 4819eaa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions flash/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ int main(int ac, char** av)
if (sl == NULL) goto on_error;
sl->verbose = o.log_level;
}
printf("USB device opened\n");

if (stlink_current_mode(sl) == STLINK_DEV_DFU_MODE)
stlink_exit_dfu_mode(sl);
Expand Down
8 changes: 5 additions & 3 deletions src/stlink-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ static inline int send_only
}


static int fill_command
(stlink_t * sl, enum SCSI_Generic_Direction dir, uint32_t len) {
static int fill_command(stlink_t * sl, enum SCSI_Generic_Direction dir,
uint32_t len) {
struct stlink_libusb * const slu = sl->backend_data;
unsigned char* const cmd = sl->c_buf;
int i = 0;
Expand Down Expand Up @@ -435,7 +435,8 @@ void _stlink_usb_jtag_reset(stlink_t * sl, int value) {
cmd[i++] = STLINK_JTAG_DRIVE_NRST;
cmd[i++] = value;

size = send_recv(slu, 1, cmd, slu->cmd_len, data, rep_len);
DLOG("*** stlink_usb_jtag_reset ***\n");
size = send_recv(slu, 1, cmd, i, data, rep_len);
if (size == -1) {
printf("[!] send_recv\n");
return;
Expand Down Expand Up @@ -864,6 +865,7 @@ stlink_t* stlink_open_usb(const int verbose, int reset) {
}

if (reset) {
stlink_jtag_reset(sl, 2);
stlink_reset(sl);
}
stlink_version(sl);
Expand Down

0 comments on commit 4819eaa

Please sign in to comment.