Skip to main content
Topic: JTAG not working at all? (Read 2909 times) previous topic - next topic

JTAG not working at all?

I'm trying to get the Bus Pirate OpenOCD support working, but I can't get it to work as expected. I've tried a dozen different configurations, with or without pullups, open-drain and normal, etc. but I mostly get all zeroes or all ones readings (sometimes the first and last byte are slightly different). I had the JTAG mode working to some degree before (basic TAP scan worked) but I can't get it to work now. I'm using 6.3 beta1 firmware, but I've also tried downgrading with no succes.

I know JTAG works on the targets (I have two different AVR microcontrollers), since a supersimple Arduino sketch is able to read the IDCODE register on both targets. I tried sniffing the JTAG data using that same Arduino, but it saw just one or two clock edges. Suspecting the clock might be too fast, I hooked up my bus pirate to a scope and I modified the openocd sources to send a JTAG_SPEED command with a value of 10000, which if I'm reading the BP firmware source right, should cause the clock to slow down, but on the scope I couldn't properly see the clock pulse at all. Around the start of the transaction I could see the SRST pin become low (I had connect_assert_srst set for debugging) and a while later the clock pin would go high. However, the clock pin would not go low again (only once at the end when the BP left it floating again). I did see some noise on the clock line on seemingly regular intervals, which might suggest the BP is doing something with the line, but it wouldn't actually go low.

Does this sound familiar to anyone? I expect that openocd support is not completely broken for everyone, so there must be something in my setup that breaks it?

Edit: move code remarks, which are probably unrelated, into a new topic

Re: JTAG not working at all?

Reply #1
After hours of more debugging, it seems that the CLK / RB8 pin on the PIC on my bus pirate has broken itself somehow... When I insert the following code at the top of main():

Code: [Select]
int main(void) {

    BP_CLK_DIR = 0;
    BP_AUX0_DIR = 0;
    while (1) {
    BP_CLK = 1;
    Nop();
    BP_AUX0 = 0;
    Nop(); Nop(); Nop();
    Nop(); Nop(); Nop();
    BP_CLK = 0;
    Nop();
    BP_AUX0 = 1;
    Nop(); Nop(); Nop();
    Nop(); Nop(); Nop();
  }

    Initialize(); //setup bus pirate

and connect a scope to CLK and AUX0, it shows a proper square wave on the AUX0 pin, but nothing on the CLK pin. I also connected the probe directly to the relevant pins on the PIC chip, so it's not a bad solder connection somewhere. Interestingly enough the pin works just fine in input mode, which I tested using the SUMP logic analyzer mode...

Does this sound familiar to anyone? Did I burn out the CLK pin somehow? In any case, I'll order another bus pirate now to see if my JTAG works as expected with that...