Olimex Support Forum

ARM => JTAG => Topic started by: prasanren on December 17, 2021, 09:42:56 AM

Title: Basic JTAG access using ARM-USB-OCD-H
Post by: prasanren on December 17, 2021, 09:42:56 AM
I want to write a few registers into JTAG device in my target board. I am planning to use ARM-USB-OCD-H. I installed WINUSB and FTDI drivers. I am trying to use write() function to write to JTAG port. But I do not see any toggle on my TCK/TDI/TMS pins.  Below is the python code I tried. What am I missing?

//*******
import time
import ftd2xx
import sys, ftd2xx as ftd
d = ftd.open(0) # Open first FTDI device
d.setBaudRate(9600)
d.setBitMode(0x7F, 0x04)

while True:
data = str(0)
d.write(data)
time.sleep(0.01)
data1 = str(1)
d.write(data1)

******////
Title: Re: Basic JTAG access using ARM-USB-OCD-H
Post by: LubOlimex on December 17, 2021, 10:19:23 AM
We don't have any Python examples for ARM-USB-OCD-H. I think that the OpenOCD community might have more experience with such software. I've seen some projects for OpenOCD wrappers like this one:

https://github.com/screwer/OpenOCD

and this one:

https://github.com/zmarvel/python-openocd

and this one:

https://pypi.org/project/pyocd/

And there are more but we have no experience with any of it.

My advice is to first test the basic connection as described in "3.4 Basic OpenOCD connection" in the user's manual. It requires just two terminals one for GDB server and another for Telnet connection to it. In the Telnet connection window issue commands for the GDB server that was started. This tests is good enough for checking if the OpenOCD, the debugger and the target are properly working together.

When the basic test is successful, switch to the Python wrappers shared above.
Title: Re: Basic JTAG access using ARM-USB-OCD-H
Post by: prasanren on December 17, 2021, 11:06:21 AM
THank you Lub. I am not planning to use OpenOCD. I want to use the basic FTDI driver function only. Do I still need to do the two terminal setup mentioned in your response? It looks a bit complecated.
Title: Re: Basic JTAG access using ARM-USB-OCD-H
Post by: JohnS on December 17, 2021, 03:01:14 PM
You are trying to do something hard if you go that route.

OpenOCD will do it and be much easier.

John