At 01:36 09-11-07 +0100, you wrote: >N. Coesel schrieb: >> At 23:12 08-11-07 +0100, you wrote: >>> N. Coesel schrieb: >>>> At 21:48 08-11-07 +0100, you wrote: >>>>> Grant Edwards schrieb: >>>>>> Can anybody confirm that the JTAG applications work when there >>>>>> are other devices besides the MSP430 in the TJAG chain? >>>>> i can't. ;-) >>>>> >>>>> as i understand, even disabled devices in the change add one cycle delay >>>>> when shifting data through the registers of the JTAG. so the JTAG code >>>>> talking to the MSP430 would need to know that additional delay when >> reading. >>>> This is strange. The JTAG specification is very clear on this point. An >>>> unused device should be loaded with a pass-through command which sets the >>>> 'delay' to 1 bit. >>> that's what i meant. the MSP430 also does this on command or fuse check >>> failure. >>> >>> but doesn't that say that you need one additional clock when reading a >>> register? compared to the msp430 alone without the other device in pass >>> through. so for example reading the msp430 JTAG identification will be >>> one bit position off when reading 8 bits as usual. >> >> Actually, you'll need to compensate for the number of devices in that chain >> to position the data correctly. > >yep > > > It has been a while since I wrote a jtag >> implementation, but the first thing my routine did was probing the number >> of devices in the chain in order to determine the amount of padding bits >> required to get the right data in and out of a device. > >using the known value for the JTAG ID of the MSP430 this should be quite >easy. as Grant has the necessity he might be willing to add such a >detection to libMSP430mspgcc? ;-) > >jtag/msp430/JTAGfunc.c::GetDevice() might be a good place to do that >(around line 155 adding a loop, maybe). > >and adding an option in jtag/msp430/MSP430mspgcc.c::MSP430_Configure >to enable automatic detection or force a certain value? i'd probably >leave the the default to "force 0 clocks" (just to not break any >existing systems) and "-1" for auto detection which must then be enabled >by the user with a call to MSP430_Configure > >maybe there is also the possibility to set all devices incl MSP430 into >pass-trough and just count the delay of a simple pattern shifted trough. >and i don't know how to ensure that the seconds device is in pass-trough >mode, which would be good if it were when testing the MSP430 ID.
This is actually fairely easy. The command register always has a fixed length. Shift a known pattern (like A50F) into the chain through the command register and keep feeding (and counting) 0 until you read the pattern from TDO. Dividing the number of bits required to get the known pattern back by the length of the command register gives you the number of devices. This allows you to create a pattern to be shifted into the command registers of all devices in which one device is given a command and the rest is in pass-through mode. Nico Coesel
