Discussion:
[OpenOCD-devel] [PATCH]: 06c2a3e jtag/drivers/cmsis-dap: remove connect before send sequence [test only!]
gerrit
2017-04-09 09:55:14 UTC
Permalink
This is an automated email from Gerrit.

Tomas Vanek (***@fbl.cz) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4100

-- gerrit

commit 06c2a3edb16fc376398dde4556384511bb6c7105
Author: Tomas Vanek <***@fbl.cz>
Date: Sun Apr 9 10:59:57 2017 +0200

jtag/drivers/cmsis-dap: remove connect before send sequence [test only!]

Commit ef02b69b14d133b061217a91add5a028a77e86bc included
a call to cmsis_dap_cmd_DAP_Connect() before calling
cmsis_dap_cmd_DAP_SWJ_Sequence(). According to comment
it is necessary for at least Keil ULINK-ME.

Commit 72c3464be42088dc75245cf2fcc8f5c6e6959b4b added
a cmsis_dap_cmd_DAP_Disconnect() before connect call to pair
connection/disconnection. It solves some problems on Atmel EDBG.

Unfortunately calling either of cmsis_dap_cmd_DAP_Connect()
or cmsis_dap_cmd_DAP_Disconnect() deasserts reset signal.
So this workaround breaks ability to connect under reset.

Change-Id: I0914dae0a1360b8c7fe48231ff3867caedfb2dbe
Signed-off-by: Tomas Vanek <***@fbl.cz>
Reported-by: Leonardo Sabino dos Santos <***@gmail.com>

diff --git a/src/jtag/drivers/cmsis_dap_usb.c b/src/jtag/drivers/cmsis_dap_usb.c
index dd37522..8a196d4 100644
--- a/src/jtag/drivers/cmsis_dap_usb.c
+++ b/src/jtag/drivers/cmsis_dap_usb.c
@@ -790,15 +790,17 @@ static int cmsis_dap_swd_switch_seq(enum swd_special_seq seq)
unsigned int s_len;
int retval;

- /* First disconnect before connecting, Atmel EDBG needs it for SAMD/R/L/C */
- cmsis_dap_cmd_DAP_Disconnect();
+ if (0) {
+ /* Following workaround deasserts reset on most adapters.
+ * This unwanted side effect breaks connecting under reset!!! */

- /* When we are reconnecting, DAP_Connect needs to be rerun, at
- * least on Keil ULINK-ME */
- retval = cmsis_dap_cmd_DAP_Connect(seq == LINE_RESET || seq == JTAG_TO_SWD ?
+ /* When we are reconnecting, DAP_Connect needs to be rerun, at
+ * least on Keil ULINK-ME */
+ retval = cmsis_dap_cmd_DAP_Connect(seq == LINE_RESET || seq == JTAG_TO_SWD ?
CONNECT_SWD : CONNECT_JTAG);
- if (retval != ERROR_OK)
- return retval;
+ if (retval != ERROR_OK)
+ return retval;
+ }

switch (seq) {
case LINE_RESET:

--

Loading...