Skip to main content
Topic: Memory reads over JTAG slightly corrupt (Read 3081 times) previous topic - next topic

Memory reads over JTAG slightly corrupt

Hi all:

I am having an interesting problem with the Bus Pirate as a JTAG adapter: when I read memory contents back from the target, sometimes some of the data bytes are corrupt. For example, I tried uploading this data file to my target:

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

That's just a ladder from 0x00 to 0x0F, twice (32 bytes in total). When I read the memory contents back with OpenOCD, I get 0x0A instead of 0x0D in both 0x0D positions above. This does not happen when the test data are all zeros or 0xFFs.

Here is some background information on what I am trying to achieve:

  "How to stress-test a JTAG connection for troubleshooting purposes"
  OpenOCD users mailing list ... enocd-user

I am using the git head version of OpenOCD and this Bus Pirate version:
  Bus Pirate v3.5
  Firmware v6.1 r1676  Bootloader v4.4
  DEVID:0x0447 REVID:0x3043 (24FJ64GA002 B5)

I added a command to the target firmware in order to dump those memory contents to its debugging console, and the data arrived fine, the problem is reading it back over OpenOCD.

The same happens with my JTAG firmware clone for the Arduino Due, so it is probably a problem on the OpenOCD side. However, I took a good look at OpenOCD's buspirate.c and could not find anything obvious.

I tried the same data with an Atmel SAM-ICE JTAG adapter and that works fine.

Has anybody seen anything similar?


Re: Memory reads over JTAG slightly corrupt

Reply #1
is this on windows ? or linux ?

on widows there is some weirdness with translating LF to CR LF .... 0x0A and 0x0D are exactly those characters.

This can very easily be the same problem with linux. And there might be bug in the serial port initialization routine.


Re: Memory reads over JTAG slightly corrupt

Reply #2
Thanks robots, now that you mention it, it's rather obvious. It's a shame I wasted so much time because of this issue.