I’ve compare debug output of cmsis-dap adapter and FTDI/SWD and found couple
differences.
Here is patch that solves “reset init” stuck for me:
----------------------------------------------------------------------------------------------------------------------------
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index 0debc2d..92411c9 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -654,7 +654,7 @@ static int ftdi_initialize(void)
mpsse_loopback_config(mpsse_ctx, false);
/* Set a low default */
- freq = mpsse_set_frequency(mpsse_ctx, 1000);
+ freq = mpsse_set_frequency(mpsse_ctx, 150000);
if (swd_mode)
ftdi_swd_switch_seq(NULL, JTAG_TO_SWD);
diff --git a/src/target/adi_v5_swd.c b/src/target/adi_v5_swd.c
index f8d3650..b018ba2 100644
--- a/src/target/adi_v5_swd.c
+++ b/src/target/adi_v5_swd.c
@@ -145,6 +145,9 @@ static int swd_queue_dp_write(struct adiv5_dap *dap,
unsigned reg,
const struct swd_driver *swd = jtag_interface->swd;
assert(swd);
+ if (reg == AP_REG_CSW)
+ data &= ~CSW_DBGSWENABLE;
+
swd_finish_read(dap);
swd_queue_dp_bankselect(dap, reg);
swd->write_reg(dap, swd_cmd(false, false, reg), data);
@@ -429,6 +432,9 @@ static int swd_init(struct command_context *ctx)
if (status == ERROR_OK)
LOG_INFO("SWD IDCODE %#8.8" PRIx32, idcode);
+ /* this is a workaround to get polling working */
+ jtag_add_reset(0, 0);
+
return status;
}
----------------------------------------------------------------------------------------------------------------------------
If interrupt flash writing process then DAP still can falls to some strange
state.
Power reset or [-c “init” -c “reset init”] required before start new session.
I’ll do more tests tomorrow.
Still can’t get GDB working:
----------------------------------------------------------------------------------------------------------------------------
Info : accepting 'gdb' connection on tcp/3333
Warn : Unknown device (HWID 0x00000000)
Error: Failed to read memory at 0x00000000
Error: Couldn't read code page size
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to
prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
----------------------------------------------------------------------------------------------------------------------------
Could anyone point me where to look for the problem?
Regards
On 20 Jul, 2014, at 2:33 pm, Andrii Anpilogov <[email protected]> wrote:
> Hi guys.
>
> I got some progress here. But it still looks very confusing…
> As for me it looks like reset sequence or its timing is wrong.
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel