How does Bus Pirate handle the different register widths of different devices?
How about the device in the chain?
I tried to read the jtag.c, but didn't catch it.
How the device in the chain is selected and
how the different register widths of different devices are handled?
Are they?
More info:
Wiki: http://dangerousprototypes.com/docs/JTAG (http://dangerousprototypes.com/docs/JTAG)
JTAG mode explanation: http://hackaday.com/2008/12/01/bus-pira ... -and-more/ (http://hackaday.com/2008/12/01/bus-pirate-firmware-update-v0c-jtag-and-more/)
BP doesn't do anything for you (except the macros). You have to do the calculations yourself. If you want to select a particular device, you have to find it's position in the chain and do the shifting.
[quote author="tayken"]
BP doesn't do anything for you (except the macros). You have to do the calculations yourself. If you want to select a particular device, you have to find it's position in the chain and do the shifting.[/quote]
Ah, that's what I wanted to know. Good, no FW imposed restrictions.
I have to go through the code again with that in mind...
Thanks.
Focus on line 78 of jtag.c, it's the probe chain macro:
Line 78-100: Resets the chain, sets data out pin high, sets the IR to BYPASS, then shifts out the DR until 1 is caught on data input. The number of 0's received is number of devices in the chain and stored in i. Then the device is reset.
Line 102-113: Normally after reset DR for device has IDCODE which is a 32-bit register. So for each device in the chain, we read 4 bytes and display them.
Writing and reading is done by bitbanging basically.
Thanks for the explanation.
I still wonder about the "if" on line 95
while(jtagReadBit()==0){
i++;
if(i<250)break;//250 device timout/limit...
}
Otherwise it became quite clear.
Yeah, I have the same thought there. I think that is a mistake that has to be fixed. Nobody was using JTAG mode in BP so it may have slipped through the cracks.
Since the bus pirate works while you wait, this is to keep it from waiting forever for a device to reply if none is present. I never thought anyone would be using this code to scan a chain more than 255 from a user-interactive interface :) I assume chains that big are explored with a proper tool :)
Should it be i>250 then?
Guess so.