Any way to use JTAG TAP for a boundary scan, 32u4?

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
vputz
 
Posts: 79
Joined: Mon May 03, 2010 5:43 am

Any way to use JTAG TAP for a boundary scan, 32u4?

Post by vputz »

I've been just learning SMD production, and still at the point where I get lots of solder bridges. Testing by hand was painful, so I was really intrigued to find out the 32u4 supports boundary scan with the JTAG TAP pins. Cool! The only problem is... I can't find ANY documentation on how to do it; I posted on the Arduino forums and got nothing in answer (and expecting nothing here, but you never know). This seems like it would be hugely useful for hobbyists, but I've no idea how to even start. Any clues? I'm suspecting this sort of thing would have to be built up, and I don't need full JTAG debugging, but I figure there's GOT to be a relatively simple way to run through a boundary scan and figure out which pins are connected to which.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Any way to use JTAG TAP for a boundary scan, 32u4?

Post by adafruit_support_rick »

I've been using the Atmel JTAGICE III with the 32U4. The 32U4 datasheet (see chapter 25) identifies the JTAG pins TDI, TDO, TCK, and TMS. You just match them up to the pins on the pod.

User avatar
vputz
 
Posts: 79
Joined: Mon May 03, 2010 5:43 am

Re: Any way to use JTAG TAP for a boundary scan, 32u4?

Post by vputz »

Encouraging, but I was hoping for an open-source boundary-scan tool, or at least documentation enough to do it. I don't need full JTAG, just boundary scan. Is there a good guide on that protocol? I'll develop a tool if I have to...

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Any way to use JTAG TAP for a boundary scan, 32u4?

Post by adafruit_support_rick »

No idea. Atmel Studio is free, and the JTAG pod is $200. For me, that's way easier than trying to develop my own stuff.

User avatar
vputz
 
Posts: 79
Joined: Mon May 03, 2010 5:43 am

Re: Any way to use JTAG TAP for a boundary scan, 32u4?

Post by vputz »

As a followup to this, since I'd very much prefer to use free-as-in-speech tools rather than free-as-in-beer... it worked just fine--to a point. I was able to get the BusPirate connected to the TAP lines and recognized by OpenOCD, and it shows up on the boundary scan:

Code: Select all

 0 avr32.cpu              Y     0x4958703f 0x4958703f     5 0x01  0x01
Of course, that's just because I changed the "id" field in the avr32 target file to "0x4958703f" because that's what seemed to be detected. But that's what OpenOCD gets me with "scan_chain" and also what I get with a small SVF program:

Code: Select all

! Begin Test Program
! Disable Test Reset line
  TRST OFF;
! Enter test-logic-reset
  STATE RESET;
  ENDIR IDLE;
! Scan the ID opcode into the IR
  SIR 4 TDI (1) SMASK(f);
  SDR 32 TDI (0) TDO (4958703f) mask(ffffffff);
Good so far; this runs fine (indicating that I was able to scan the chip ID and that it matched 4958703f, which is basically me writing the file to succeed. The problem is I'm not sure if I have a good boundary scan description file. The darn file I got from the Atmel site seems to indicate a different chip ID, so I'm not sure I can trust it.

In particular, the BSDL file claims a 141-bit data register with a bunch of "safe" bits... I wrote a python script to parse the description and generate a test string...

Code: Select all

ENDDR IDLE;
! Scan the EXTEST opcode into the IR
  SIR 4 TDI (0) SMASK(f);
  SDR 141 TDI (100100440230000000000000000000000008) TDO (10010044023000000000000000000000000A) MASK (0000000000000000000000F0FFFFFFFFFFFF);
! End test program

...but it doesn't quite make sense. For one thing, the "..00A" that I get in return (which I wrote the above test to detect) doesn't make sense--I can't see why those bits would be set. And if I replace the "...F0FF..." above with "...FFFF..." in the mask, the test fails anyway, but OpenOCD doesn't print enough to say why; it gives me the very frustrating and cryptic result that

Code: Select all

tdo check error at line 14
read = 0xA, want = 0xA, mask = 0xFFFFFFFF

Time used: 0m0s10ms 
svf file programmed failed
in procedure 'svf'
...ordinarily I'd think that if I wanted 0xA and in fact got 0xA, that would be good, but evidently some other bits are failing.

Documentation on this whole process is pretty sketchy and confusing. I can't even figure out if "bit 0" in the BSDL description is the MSB or LSB of the SDR values in the SVF file, and after posting on multiple boards, there doesn't seem to be a lot of information on the whole thing. If I ever do make some headway, I think there's good stuff to be had here for the hobbyist.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”