Discussion:
[UrJTAG-dev] openocd/urjtag/xc3sprog Weird FTDI or JTAG chain issue, weird work-arounds
Jérôme Carretero
2012-04-11 04:15:05 UTC
Permalink
Hi all,

First, sorry for posting on multiple lists, but I think this is appropriate
in this case.

Since I've used a second (still FT2232H-based) JTAG adapter I can see that the deadlocks that
I experienced are not due to my original JTAG adapter.

Using libftd2xx 1.0.4 at the moment, but it's probably not an issue (more on that later).
I noticed that urjtag and OpenOCD have issues, don't know yet if it's related
to FTDI cable or the JTAG chain (tested on 2 different ARM-based chains, same thing).

xc3sprog always works fine after n invocations; let's run it a couple of times,
just to print the JTAG chain:

$ ~/dev/xc3sprog-git_svn/xc3sprog -c arm-usb-ocd-h -j
XC3SPROG (c) 2004-2011 xc3sprog project $Rev$ OS: Linux
Free software: If you contribute nothing, expect nothing!
Feedback on success/failure/enhancement requests:
http://sourceforge.net/mail/?group_id=170565
Check Sourceforge for updates:
http://sourceforge.net/projects/xc3sprog/develop

Using Libftdi,
JTAG loc.: 0 IDCODE: 0x1b7d102f Desc: OMAP-L138 Rev: A IR length: 6

$ ~/dev/xc3sprog-git_svn/xc3sprog -c arm-usb-ocd-h -j
XC3SPROG (c) 2004-2011 xc3sprog project $Rev$ OS: Linux
Free software: If you contribute nothing, expect nothing!
Feedback on success/failure/enhancement requests:
http://sourceforge.net/mail/?group_id=170565
Check Sourceforge for updates:
http://sourceforge.net/projects/xc3sprog/develop

Using Libftdi,
JTAG loc.: 0 IDCODE: 0x1b7d102f Desc: OMAP-L138 Rev: A IR length: 6

$


Now, let's say I want to run UrJTAG, it works once but not a second time:

$ echo -ne "cable ARM-USB-OCD-H\ndetect\n" | ~/opt/urjtag/bin/jtag
Connected to libftd2xx driver.
IR length: 6
Chain length: 1
Device Id: 00011011011111010001000000101111 (0x1B7D102F)
Manufacturer: Texas Instruments (0x02F)
Unknown part! (1011011111010001) (/home/cJ/opt/urjtag/share/urjtag/ti/PARTS)
$ echo -ne "cable ARM-USB-OCD-H\ndetect\n" | ~/opt/urjtag/bin/jtag
Connected to libftd2xx driver.
[nothing happens, locked in FT_Read]
^C

If I run xc3sprog then UrJTAG again, UrJTAG is not happy, but in a different way:

$ echo -ne "cable ARM-USB-OCD-H\ndetect\n" | ~/opt/urjtag/bin/jtag
Connected to libftd2xx driver.
error: when parsing command 'detect'
$

Now let's run OpenOCD, it initializes properly (same thing if run after xc3sprog):

$ ~/opt/openocd/bin/openocd -f config.cfg
Open On-Chip Debugger 0.6.0-dev-00477-gf1c0133 (2012-03-26-20:56)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
RCLK - adaptive
RCLK - adaptive
fast memory access is enabled
dcc downloads are enabled
force hard breakpoints
use of EmbeddedICE dbgrq instead of breakpoint for target halt enabled
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
Error: unable to get latency timer: OK
Error: ftd2xx 1.04 detected - this has known issues with FT_GetLatencyTimer, upgrade to a newer version
Info : device: 6 "2232H"
Info : deviceID: 364511275
Info : SerialNumber: OLUSXGHBA
Info : Description: Olimex OpenOCD JTAG ARM-USB-OCD-H A
Info : max TCK change to: 30000 kHz
Info : RCLK (adaptive clock speed)
Info : JTAG tap: omapl138.jrc tap/device found: 0x1b7d102f (mfg: 0x017, part: 0xb7d1, ver: 0x1)
Info : JTAG tap: omapl138.etb enabled
Info : JTAG tap: omapl138.arm enabled
Info : Embedded ICE version 6
Info : omapl138.arm: hardware has 2 breakpoint/watchpoint units
Info : ETM v1.3
^C # chain detected
$

Let's run it a second time, it does not work so well anymore:

$ ~/opt/openocd/bin/openocd -f config.cfg
Open On-Chip Debugger 0.6.0-dev-00477-gf1c0133 (2012-03-26-20:56)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
RCLK - adaptive
RCLK - adaptive
fast memory access is enabled
dcc downloads are enabled
force hard breakpoints
use of EmbeddedICE dbgrq instead of breakpoint for target halt enabled
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
Error: unable to get latency timer: OK
Error: ftd2xx 1.04 detected - this has known issues with FT_GetLatencyTimer, upgrade to a newer version
Info : device: 6 "2232H"
Info : deviceID: 364511275
Info : SerialNumber: OLUSXGHBA
Info : Description: Olimex OpenOCD JTAG ARM-USB-OCD-H A
Info : max TCK change to: 30000 kHz
Info : RCLK (adaptive clock speed)
^C # stuck in JTAG init
$

If I run xc3sprog then OpenOCD afterwards, OpenOCD will initialize properly.
So currently, I run xc3sprog to detect the JTAG chain prior any OpenOCD invocation.
I spent a few minutes in the code but nothing yet.

Oh wait, if I run xc3sprog, then OpenOCD, then UrJTAG, then UrJTAG can work !
I say "can" because it seems to work with a higher probability when OpenOCD
is shutdown quickly after it started.

UrJTAG behaves in the same way when using libftdi, so I don't think it's ftd2xx's fault.

At the moment I have no diagnostic, just stupid workarounds.

I'd like to know if other people have encountered something like that before.
Perhaps someone has ideas on how to better diagnose this (I can live with
my work-arounds, as they are included in scripts, but I'm not glad I
have to resort to that).

Best regards,
--
cJ
Uwe Bonnes
2012-04-11 08:55:28 UTC
Permalink
Jérôme> Hi all, First, sorry for posting on multiple lists, but I think
Jérôme> this is appropriate in this case.

Jérôme> Since I've used a second (still FT2232H-based) JTAG adapter I
Jérôme> can see that the deadlocks that I experienced are not due to my
Jérôme> original JTAG adapter.

Did you stress test the chain with xc3sprog -T ? While running, perhaps look
at the waveforms with a scope!

Jérôme> Using libftd2xx 1.0.4 at the moment, but it's probably not an
Jérôme> issue (more on that later). I noticed that urjtag and OpenOCD
Jérôme> have issues, don't know yet if it's related to FTDI cable or the
Jérôme> JTAG chain (tested on 2 different ARM-based chains, same thing).

Jérôme> xc3sprog always works fine after n invocations; let's run it a
Jérôme> couple of times, just to print the JTAG chain:

Does that mean it doesn't work with the first invocation?


Jérôme> $ ~/dev/xc3sprog-git_svn/xc3sprog -c arm-usb-ocd-h -j
Jérôme> XC3SPROG (c) 2004-2011 xc3sprog project $Rev$ OS: Linux Free
Jérôme> software: If you contribute nothing, expect nothing! Feedback
Jérôme> on success/failure/enhancement requests:
Jérôme> http://sourceforge.net/mail/?group_id=170565 Check Sourceforge
Jérôme> for updates: http://sourceforge.net/projects/xc3sprog/develop

Jérôme> Using Libftdi, JTAG loc.: 0 IDCODE: 0x1b7d102f Desc:
Jérôme> OMAP-L138 Rev: A IR length: 6

Jérôme> $ ~/dev/xc3sprog-git_svn/xc3sprog -c arm-usb-ocd-h -j
Jérôme> XC3SPROG (c) 2004-2011 xc3sprog project $Rev$ OS: Linux Free
Jérôme> software: If you contribute nothing, expect nothing! Feedback
Jérôme> on success/failure/enhancement requests:
Jérôme> http://sourceforge.net/mail/?group_id=170565 Check Sourceforge
Jérôme> for updates: http://sourceforge.net/projects/xc3sprog/develop

Jérôme> Using Libftdi, JTAG loc.: 0 IDCODE: 0x1b7d102f Desc:
Jérôme> OMAP-L138 Rev: A IR length: 6

Jérôme> $


Jérôme> Now, let's say I want to run UrJTAG, it works once but not a
Jérôme> second time:

Jérôme> $ echo -ne "cable ARM-USB-OCD-H\ndetect\n" |
Jérôme> ~/opt/urjtag/bin/jtag Connected to libftd2xx driver. IR length:
Jérôme> 6 Chain length: 1 Device Id: 00011011011111010001000000101111
Jérôme> (0x1B7D102F) Manufacturer: Texas Instruments (0x02F) Unknown
Jérôme> part! (1011011111010001)
Jérôme> (/home/cJ/opt/urjtag/share/urjtag/ti/PARTS) $ echo -ne "cable
Jérôme> ARM-USB-OCD-H\ndetect\n" | ~/opt/urjtag/bin/jtag Connected to
Jérôme> libftd2xx driver. [nothing happens, locked in FT_Read] ^C

Jérôme> If I run xc3sprog then UrJTAG again, UrJTAG is not happy, but in
Jérôme> a different way:

Jérôme> $ echo -ne "cable ARM-USB-OCD-H\ndetect\n" |
Jérôme> ~/opt/urjtag/bin/jtag Connected to libftd2xx driver. error:
Jérôme> when parsing command 'detect' $

Jérôme> Now let's run OpenOCD, it initializes properly (same thing if
Jérôme> run after xc3sprog):

Jérôme> $ ~/opt/openocd/bin/openocd -f config.cfg Open On-Chip
Jérôme> Debugger 0.6.0-dev-00477-gf1c0133 (2012-03-26-20:56) Licensed
Jérôme> under GNU GPL v2 For bug reports, read
Jérôme> http://openocd.sourceforge.net/doc/doxygen/bugs.html Info : only
Jérôme> one transport option; autoselect 'jtag' RCLK - adaptive RCLK -
Jérôme> adaptive fast memory access is enabled dcc downloads are enabled
Jérôme> force hard breakpoints use of EmbeddedICE dbgrq instead of
Jérôme> breakpoint for target halt enabled trst_and_srst separate
Jérôme> srst_gates_jtag trst_push_pull srst_open_drain Error: unable to
Jérôme> get latency timer: OK Error: ftd2xx 1.04 detected - this has
Jérôme> known issues with FT_GetLatencyTimer, upgrade to a newer version
Jérôme> Info : device: 6 "2232H" Info : deviceID: 364511275 Info :
Jérôme> SerialNumber: OLUSXGHBA Info : Description: Olimex OpenOCD JTAG
Jérôme> ARM-USB-OCD-H A Info : max TCK change to: 30000 kHz Info : RCLK
Jérôme> (adaptive clock speed) Info : JTAG tap: omapl138.jrc tap/device
Jérôme> found: 0x1b7d102f (mfg: 0x017, part: 0xb7d1, ver: 0x1) Info :
Jérôme> JTAG tap: omapl138.etb enabled Info : JTAG tap: omapl138.arm
Jérôme> enabled Info : Embedded ICE version 6 Info : omapl138.arm:
Jérôme> hardware has 2 breakpoint/watchpoint units Info : ETM v1.3 ^C #
Jérôme> chain detected $

Jérôme> Let's run it a second time, it does not work so well anymore:

Jérôme> $ ~/opt/openocd/bin/openocd -f config.cfg Open On-Chip
Jérôme> Debugger 0.6.0-dev-00477-gf1c0133 (2012-03-26-20:56) Licensed
Jérôme> under GNU GPL v2 For bug reports, read
Jérôme> http://openocd.sourceforge.net/doc/doxygen/bugs.html Info : only
Jérôme> one transport option; autoselect 'jtag' RCLK - adaptive RCLK -
Jérôme> adaptive fast memory access is enabled dcc downloads are enabled
Jérôme> force hard breakpoints use of EmbeddedICE dbgrq instead of
Jérôme> breakpoint for target halt enabled trst_and_srst separate
Jérôme> srst_gates_jtag trst_push_pull srst_open_drain Error: unable to
Jérôme> get latency timer: OK Error: ftd2xx 1.04 detected - this has
Jérôme> known issues with FT_GetLatencyTimer, upgrade to a newer version
Jérôme> Info : device: 6 "2232H" Info : deviceID: 364511275 Info :
Jérôme> SerialNumber: OLUSXGHBA Info : Description: Olimex OpenOCD JTAG
Jérôme> ARM-USB-OCD-H A Info : max TCK change to: 30000 kHz Info : RCLK
Jérôme> (adaptive clock speed) ^C # stuck in JTAG init $

Jérôme> If I run xc3sprog then OpenOCD afterwards, OpenOCD will
Jérôme> initialize properly. So currently, I run xc3sprog to detect the
Jérôme> JTAG chain prior any OpenOCD invocation. I spent a few minutes
Jérôme> in the code but nothing yet.

Jérôme> Oh wait, if I run xc3sprog, then OpenOCD, then UrJTAG, then
Jérôme> UrJTAG can work ! I say "can" because it seems to work with a
Jérôme> higher probability when OpenOCD is shutdown quickly after it
Jérôme> started.

Jérôme> UrJTAG behaves in the same way when using libftdi, so I don't
Jérôme> think it's ftd2xx's fault.

Jérôme> At the moment I have no diagnostic, just stupid workarounds.

Jérôme> I'd like to know if other people have encountered something like
Jérôme> that before. Perhaps someone has ideas on how to better
Jérôme> diagnose this (I can live with my work-arounds, as they are
Jérôme> included in scripts, but I'm not glad I have to resort to that).

Jérôme> Best regards,

Jérôme> -- cJ

Jérôme> ------------------------------------------------------------------------------
Jérôme> Better than sec? Nothing is better than sec when it comes to
Jérôme> monitoring Big Data applications. Try Boundary one-second
Jérôme> resolution app monitoring today. Free.
Jérôme> http://p.sf.net/sfu/Boundary-dev2dev
Jérôme> _______________________________________________
Jérôme> UrJTAG-development mailing list
Jérôme> UrJTAG-***@lists.sourceforge.net
Jérôme> https://lists.sourceforge.net/lists/listinfo/urjtag-development
--
Uwe Bonnes ***@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Jérôme Carretero
2012-04-11 13:25:39 UTC
Permalink
On Wed, 11 Apr 2012 10:55:28 +0200
Did you stress test the chain with xc3sprog -T ? While running, perhaps look at the waveforms with a scope!
I didn't do it, I'll look into that back at home.
I quickly added a dummy entry in the devlist.txt file and ran it,
getting the following output:

Using Libftdi, Using JTAG frequency 1500000 from undivided clock
IDCODE mismatch pos 0 Read 0xfffffffe vs 0x1b7d102f
Running IR_TEST 10000 times
IR len = 6
0x binary 000001 ..........
JTAG loc.: 0 IDCODE: 0x1b7d102f Desc: test Rev: A IR length: 6
USB transactions: Write 10009 read 10006 retries 0

From this output it looks like the stress-test was OK.
Does that mean it doesn't work with the first invocation?
It always works :)
--
cJ
Jérôme Carretero
2012-05-12 04:41:22 UTC
Permalink
Post by Jérôme Carretero
On Wed, 11 Apr 2012 10:55:28 +0200
Did you stress test the chain with xc3sprog -T ? While running, perhaps look at the waveforms with a scope!
I didn't do it, I'll look into that back at home.
Argh, changed jobs and I don't have access to this JTAG chain anymore.
For future reference, it was a single OMAP-L138.
I gave the trick to my coworkers, maybe they will help.

Regards,
--
cJ
Loading...