PINE64
"Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PineTime (https://forum.pine64.org/forumdisplay.php?fid=134)
+--- Forum: Development Discussion on PineTime (https://forum.pine64.org/forumdisplay.php?fid=136)
+--- Thread: "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? (/showthread.php?tid=16031)



"Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? - ITCactus - 02-09-2022

as a beginner, a looked at "PineTime Devkit Wiring" tutorial, 
and decided to order the Pine64 USB JTAG Adapter (schematic) alongside with PineTime dev kit to play with it...

but then i realized, that it's not a ST-Link clone...
also, i had to play additionally with drivers using "Zadig" app on Windows.

i'm trying to make it work with OpenOCD, and so far no luck with
Code:
.\openocd.exe -f interface/ftdi/ft232h-module-swd.cfg -f target/nrf52.cfg

Quote:Open On-Chip Debugger 0.11.0 (2021-03-07-12:52)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : FTDI SWD mode enabled
swd
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Error: Error connecting DP: cannot read IDR



long story short, has anyone tried this?
is it supposed to work at all?


RE: "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? - ITCactus - 02-28-2022

the same on Linux (ubuntu kind. on real hardware).
no luck...

any suggestions?


RE: "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? - wibble - 03-01-2022

I'm guessing nobody here has tried it. I've only used the Raspberry Pi option since I already had one. Have you compared the schematic to that of the adafruit board the openocd config you're using was written for? What connections did you use?


RE: "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? - ITCactus - 03-01-2022

(03-01-2022, 12:34 PM)wibble Wrote: I'm guessing nobody here has tried it. I've only used the Raspberry Pi option since I already had one. Have you compared the schematic to that of the adafruit board the openocd config you're using was written for? What connections did you use?

i tried to connect like this using Pogo Pins connections (also tried wires included in PineTime box)

Code:
Pine64 USB       -> PineTime
(8) TDI/SWDIO    -> (1) SWDIO
(4) TCK/SWDCLK   -> (2) SWDCLK
not connected    -> (3) -
(9)  Ground      -> (4) GND


since Pine64 USB can outputs only 5v i ended up with not connecting the power, taking into account that PineTime is powered by battery. but i also tried with connecting power from pin#1, it leads to PineTime reboot, but nothing more - the OpenOCD outputs the same error.

unfortunately, i'm a newbie with OpenOCD, and not sure how to change configs according to the board or adapter schematic.
in the ft232h-module-swd.cfg there is a comment "ADAFRUIT FTDI FT232H as a SWD direct connect interface. Any FT232H based board may work.", so i was hoping it should just work. but it's not.


RE: "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? - wibble - 03-02-2022

I'm going on a little reading and informed guesswork, so treat what I'm about to say accordingly.

I would investigate the 5V issue first - if the adapter sends 5V to a device that can't tolerate it you will cause permanent damage. That's how people end up with dead GPIO pins on their Pi, or even a dead Pi. The adapter schematic doesn't show a 3.3V regulator, and I don't know if the FT232H has an internal one and a level config option. If it doesn't then you'll need to look for a bidirectional level converter to move the signals between 5V and 3.3V.

https://www.allaboutcircuits.com/technical-articles/getting-started-with-openocd-using-ft2232h-adapter-for-swd-debugging/
https://plaes.org/technotes/embedded-systems/ftdi-ft232h-for-hardware-hacking/

Based on the above it looks like you need both TDI and TDO (via a resistor) connected to SWDIO. The first one has some detail on what each bit of the config actually means too.