Sunday, August 31, 2008

Low cost Jtag for beagle

In the quest for a proper debug tool.. printfs have been my friend so far.. but printfs cannot help in many cases optimally.. JTAG is the right solution for such cases. keesj and I have been independently working on getting openocd working with flyswatter. is the starting point in this quest! join us, provide your thoughts etc..

[Update: Sept 3, 2008:
1. keesj has mailed an excellent report to the beagleboard list on his progress on the JTAG saga. Read about it here (excellent job Kees :) ).
2. As pointed by keesj, tincan tools have the adapter on the product page]

Today, the thought has been in creating a jtag debugger convertor - given that "ARM standard" and "TI standard" are not 1-1!

Note: Tincan tools is planning on making a more professional connector than "mine" and most probably will work.. one thing I can say for sure.. OMAP still works after plugging this in.. and I can probe the chip ID from openocd we are still way off from getting openocd working..

keesj had an adapter which does the translation. here is how it ought to look:

Now, I dont have the above connector, so I set about creating my own:
step 1: connectors and my setup as per this:

step 2: created a connectivity of the same as per this:

NOTE: I screwed up the EMU0,1 wiring to pull up instead of down in the above picture.. my"rev0.2" fixes it ;)..

Thanks to keesj: (sample openocd.cfg):
#Basic configuration
#default port 4444
telnet_port 4444


interface ft2232
ft2232_device_desc "Flyswatter"
ft2232_layout "flyswatter"
ft2232_vid_pid 0x0403 0x6010
jtag_speed 1

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 6 0x1 0x0 0x0

target arm926ejs little 0 arm926ejs

# trst == test rest is part of the jtag optional specs and allows the jtag state machine
# to be reset to an initial state
# srst ==system reset?
reset_config trst_and_srst
Building openOCD:
I did it with libftdi using ubuntu, as the binaries of the closed source ftdi driver is x32 bit :(
nmenon@coyote:~/Src/opensource/openocd/trunk$ sudo ./src/openocd -f ../keesj/jtag-3530.cfg
Open On-Chip Debugger 1.0 (2008-09-01-16:50) svn:977
$URL: svn:// $
jtag_speed: 1
Info: JTAG device found: 0x0b7ae02f (Manufacturer: 0x017, Part: 0xb7ae, Version: 0x0)
Error: unknown EmbeddedICE version (comms ctrl: 0x00000000)
Warning:no gdb port specified, using default port 3333
Warning:no tcl port specified, using default port 6666
telnet localhost 4444
> halt
timed out while waiting for target halted
Runtime error, file "command.c", line 436:
> scan_chain
0: idcode: 0x0b7ae02f ir length 6, ir capture 0x1, ir mask 0x0, current instruction 0xc
Not too good, as keesj points here, we probably need to give tapid commands before things start working..

[Update: Sept 3, 2008:
as keesj mentions:

SCANINIT t1:w1000:t0:w1000: ;toggle TRST,
SCANINIT ch10:w1000: ;clock TCK with TMS high and wait
SCANINIT i6=07:d8=89:i6=02: ;connect and select router
SCANINIT d32=81000080: ;IP control: KeepPowered
SCANINIT d32=a3002048: ;TAP3: DebugConnect, ForcePower, ForceActive
SCANINIT d32=81000081: ;IP control: KeepPowered, SysReset
SCANINIT d32=a3002148: ;enable TAP3
SCANINIT cl10:i10=ffff ;clock 10 times in RTI, scan bypass

In openocd this would translate to the following sequence.

irscan 0 7
drscan 0 8 0X89
irscan 0 2
drscan 0 32 0xA3002108
irscan 0 0x3F
sleep 10
jtag_device 4 0x1 0x0 0xe

A final frontier remains: EMU0,1 -> unlocking it's mysteries..]

No comments: