Okay I actually have to apologize, I used an old OpenOCD version that was with 
the distribution, and it did say OpenOCD 0.11.0. But it was from freaking 2021. 
I grabbed the latest git version, with libjaylink, compiled it mayself, and now 
the very same configuration file **can** connect to the chip with no changes, 
reliably!

~~~
$ ~/ocd/openocd/openocd_installed/usr/local/bin/openocd -f interface/jlink.cfg 
-c "transport select swd"  -s . -f dia.cfg -c "gdb_memory_map disable"  
Open On-Chip Debugger 0.12.0+dev-01082-gfc30feb51 (2023-03-15-16:12)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
Info : DEPRECATED target event trace-config; use TPIU events 
{pre,post}-{enable,disable}
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : J-Link V11 compiled Jul 28 2021 10:07:38
Info : Hardware version: 11.00
Info : VTarget = 3.300 V
Info : clock speed 50 kHz
Info : SWD DPIDR 0x0be12477
Info : [da1469x.cpu] Cortex-M33 r0p2 processor detected
Info : [da1469x.cpu] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for da1469x.cpu on 3333
Info : Listening on port 3333 for gdb connections
~~~

I will have to check with GDB now if debugging works fine, and if it does, I 
will close this ticket.

But one thing that is weird is that two subsequent connect + disconnects makes 
it fail at the second connect with a 

Debug: 292 152 arm_adi_v5.h:652 dap_dp_poll_register(): DAP: poll 4 timeout
Debug: 293 152 command.c:544 run_command(): Command 'dap init' failed with 
error code -5

but maybe that's another story.


---

** [tickets:#386] OpenOCD can't connect to Dialog DA1469x**

**Status:** new
**Milestone:** 0.11.0
**Labels:** swd da1469x jlink 
**Created:** Wed Mar 15, 2023 02:30 PM UTC by Maximilian Gerhardt
**Last Updated:** Wed Mar 15, 2023 02:56 PM UTC
**Owner:** nobody
**Attachments:**

- [dia.cfg](https://sourceforge.net/p/openocd/tickets/386/attachment/dia.cfg) 
(1.8 kB; application/octet-stream)
- 
[jlink_logs.txt](https://sourceforge.net/p/openocd/tickets/386/attachment/jlink_logs.txt)
 (1.5 kB; text/plain)
- 
[jlinkexe_good_connect.sr](https://sourceforge.net/p/openocd/tickets/386/attachment/jlinkexe_good_connect.sr)
 (3.6 kB; application/octet-stream)
- 
[openocd_ap_info_good_connect.txt](https://sourceforge.net/p/openocd/tickets/386/attachment/openocd_ap_info_good_connect.txt)
 (1.8 kB; text/plain)
- 
[openocd_bad_connect.sr](https://sourceforge.net/p/openocd/tickets/386/attachment/openocd_bad_connect.sr)
 (2.3 kB; application/octet-stream)


Specifically, I have a custom DA14695 board, but it's the same with a [USB 
DevKit](https://www.renesas.com/br/en/products/wireless-connectivity/bluetooth-low-energy/da14695-00hqdevkt-u-smartbond-da14695-bluetooth-low-energy-52-usb-development-kit).
 Chip datasheet [see 
here](https://www.renesas.com/br/en/products/wireless-connectivity/bluetooth-low-energy/da14695-multi-core-bluetooth-52-soc-system-power-management-unit#document).
 It's a Cortex-M33 and Cortex-M0+ coprocessor (runs Bluetooth stack). Each have 
their own SWDIO+SWDCLK signals. I'm only interested in connecting to the 
Cortex-M33 main processor right now.

Currently, the Dialog DA1469x is unsupported in OpenOCD. Only the proprietary 
JLinkExe can connect it. I want to be able to use OpenOCD and other debug 
adapters. So to get  started with getting OpenOCD + JLink to work first without 
changing the debug adapter.

this however fails horribly with the error

Debug: 1132 515 jlink.c:2197 jlink_swd_run_queue(): SWD ack not OK: 7 JUNK
Error: 1133 517 adi_v5_swd.c:144 swd_connect(): Error connecting DP: cannot 
read IDR

While when using JLinkExe, it detects the chip just fine

Found SW-DP with ID 0x0BE12477
AP0: AHB-AP (IDR: 0x14770015)
Found Cortex-M33 r0p2, Little endian.

OpenOCD fails at one of the very first steps, which is in the SWD protocol to 
do a LINERESET followed by the JTAG->SWD switch sequence, a LINERESET again and 
reading out the IDCODE. Looking at the SWD signals with a logic analyzers and 
PulseView, I compared the different signals that OpenOCD and JLinkExe produced 
and found that  JLinkExe does a few more LINERESETs as the first attempt of 
reading IDCode actually fails, without a JTAG->SWD sequence in between.

I'd also like to note that after using JLinkExe to connect, through some 
command sequence that I cannot reproduce anymore, openocd managed to connect 
using that config file. That's why I at least now -irlen 8 is right, it would 
not do that with -irlen 4. From there I coud do a "dap info".

Here attached are the PulseView session files which should have the signal 
trace (with SWD decoding) in it, from JLinkExe and OpenOCD, next to the  config 
file and JLinkExe output (sadly there are no verbose logs there).  The OpenOCD 
command I'm using is 'openocd -f interface/jlink.cfg -c "transport select swd"  
-s . -f dia.cfg -c "gdb_memory_map disable"'

I'd be happy for any pointer on how to get OpenOCD to talk to the Cortex-M33 
successfully.


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to