From b9a30e089227db441afd300989b0befce21b7da3 Mon Sep 17 00:00:00 2001 From: Ake Rehnman Date: Sun, 29 Mar 2020 12:13:18 +0200 Subject: [PATCH] Entering SWIM mode on ST-LINK does not update swim status word. As a consequence of a previous failed SWIM command any subsequent attempts to enter SWIM mode fails. Change stlink_usb_mode_enter to use stlink_usb_xfer_noerrcheck instead. Change-Id: I5c6a1a8e68d3dc77ec37264880383366fa6a75d9 Signed-off-by: Ake Rehnman Reviewed-on: http://openocd.zylin.com/5547 Tested-by: jenkins Reviewed-by: Antonio Borneo --- src/jtag/drivers/stlink_usb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 45bb5019f..a905576c8 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -1230,9 +1230,8 @@ static int stlink_usb_mode_enter(void *handle, enum stlink_mode type) case STLINK_MODE_DEBUG_SWIM: h->cmdbuf[h->cmdidx++] = STLINK_SWIM_COMMAND; h->cmdbuf[h->cmdidx++] = STLINK_SWIM_ENTER; - /* no answer for this function... */ - rx_size = 0; - break; + /* swim enter does not return any response or status */ + return stlink_usb_xfer_noerrcheck(handle, h->databuf, 0); case STLINK_MODE_DFU: case STLINK_MODE_MASS: default: