<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=BIP_AbstractJTAGProtocol</id>
	<title>BIP AbstractJTAGProtocol - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=BIP_AbstractJTAGProtocol"/>
	<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=BIP_AbstractJTAGProtocol&amp;action=history"/>
	<updated>2026-05-15T07:55:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>http://en.zaoniao.it/index.php?title=BIP_AbstractJTAGProtocol&amp;diff=3012&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;&lt;pre&gt;  BIP: ?  Title: Abstract JTAG Protocol  Author: Luke Dashjr &lt;luke+bipmhbp@dashjr.org&gt;  Status: Draft  Type: Standards Track  Created: 14-07-2012 &lt;/pre&gt;  ==Abstract== ==S...&quot;</title>
		<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=BIP_AbstractJTAGProtocol&amp;diff=3012&amp;oldid=prev"/>
		<updated>2019-04-08T02:41:28Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt;  BIP: ?  Title: Abstract JTAG Protocol  Author: Luke Dashjr &amp;lt;luke+bipmhbp@dashjr.org&amp;gt;  Status: Draft  Type: Standards Track  Created: 14-07-2012 &amp;lt;/pre&amp;gt;  ==Abstract== ==S...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
 BIP: ?&lt;br /&gt;
 Title: Abstract JTAG Protocol&lt;br /&gt;
 Author: Luke Dashjr &amp;lt;luke+bipmhbp@dashjr.org&amp;gt;&lt;br /&gt;
 Status: Draft&lt;br /&gt;
 Type: Standards Track&lt;br /&gt;
 Created: 14-07-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
==Specification==&lt;br /&gt;
&lt;br /&gt;
This protocol is designed to be spoken only over a reliable (including error correction) lower-level protocol, such as USB-Serial or USB-CDC, to a local device.&lt;br /&gt;
&lt;br /&gt;
===Packet Format===&lt;br /&gt;
*4 bytes: magic: always &amp;lt;tt&amp;gt;fd414a50&amp;lt;/tt&amp;gt;&lt;br /&gt;
*1 byte: packet length/type&lt;br /&gt;
*N bytes: packet data&lt;br /&gt;
*2 bytes: packet data [http://en.wikipedia.org/wiki/BSD_checksum BSD &amp;quot;sum1&amp;quot; checksum]&lt;br /&gt;
&lt;br /&gt;
Packet length/types:&lt;br /&gt;
* &amp;lt;tt&amp;gt;00&amp;lt;/tt&amp;gt; -- Abort&lt;br /&gt;
* &amp;lt;tt&amp;gt;01&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;ef&amp;lt;/tt&amp;gt; -- Data packet length (1 to 239 bytes)&lt;br /&gt;
* &amp;lt;tt&amp;gt;f0&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;fc&amp;lt;/tt&amp;gt; -- Reserved&lt;br /&gt;
* &amp;lt;tt&amp;gt;fd&amp;lt;/tt&amp;gt; -- Bad packet (command aborted)&lt;br /&gt;
* &amp;lt;tt&amp;gt;fe&amp;lt;/tt&amp;gt; -- ACK&lt;br /&gt;
* &amp;lt;tt&amp;gt;ff&amp;lt;/tt&amp;gt; -- End of command&lt;br /&gt;
&lt;br /&gt;
ACK should be sent in response to each 239-byte packet. Bulk data transfers, such as bitstream uploads, should wait until ACK is received before sending more packets.&lt;br /&gt;
&lt;br /&gt;
Checksum must include the complete packet up until the checksum itself; this is not used to prevent corruption (USB already guarantees that), but rather to avoid acting when something foreign sends stuff (possibly intermixed with a real AJP packet). If the checksum does not match, the device should send a &amp;quot;&amp;lt;tt&amp;gt;fd&amp;lt;/tt&amp;gt;&amp;quot; packet back and ignore the content.&lt;br /&gt;
&lt;br /&gt;
Note that while Abort packets abort the entire command, but do not guarantee it had no effect.&lt;br /&gt;
&lt;br /&gt;
Anything up to the initial magic is ignored.&lt;br /&gt;
&lt;br /&gt;
===Command Format===&lt;br /&gt;
*1 byte: request id&lt;br /&gt;
*1 byte: command id&lt;br /&gt;
**&amp;lt;tt&amp;gt;Cx&amp;lt;/tt&amp;gt; -- JTAG interface commands&lt;br /&gt;
**&amp;lt;tt&amp;gt;Dx&amp;lt;/tt&amp;gt; -- Replies to JTAG interface commands&lt;br /&gt;
**&amp;lt;tt&amp;gt;Ex&amp;lt;/tt&amp;gt; -- JAP Controller commands&lt;br /&gt;
**&amp;lt;tt&amp;gt;Fx&amp;lt;/tt&amp;gt; -- Replies to JAP Controller commands&lt;br /&gt;
*1 byte: device number (ignored for some commands)&lt;br /&gt;
**&amp;lt;tt&amp;gt;00&amp;lt;/tt&amp;gt; is the controller&lt;br /&gt;
**&amp;lt;tt&amp;gt;01&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;fe&amp;lt;/tt&amp;gt; are JTAG devices&lt;br /&gt;
**&amp;lt;tt&amp;gt;ff&amp;lt;/tt&amp;gt; for &amp;quot;all JTAG devices&amp;quot;&lt;br /&gt;
*1 byte: status (should always be &amp;lt;tt&amp;gt;00&amp;lt;/tt&amp;gt; for requests)&lt;br /&gt;
**&amp;lt;tt&amp;gt;00&amp;lt;/tt&amp;gt; -- success&lt;br /&gt;
**&amp;lt;tt&amp;gt;80&amp;lt;/tt&amp;gt; -- failure&lt;br /&gt;
*N bytes: data&lt;br /&gt;
&lt;br /&gt;
Commands less than 4 bytes should be ignored.&lt;br /&gt;
Additional data beyond what is expected should be ignored.&lt;br /&gt;
&lt;br /&gt;
===Commands===&lt;br /&gt;
====&amp;lt;tt&amp;gt;c0&amp;lt;/tt&amp;gt; -- clock====&lt;br /&gt;
Request Data:&lt;br /&gt;
* 1 byte: bit field (bitwise OR'd)&lt;br /&gt;
** &amp;lt;tt&amp;gt;10&amp;lt;/tt&amp;gt; -- return TDI status&lt;br /&gt;
** &amp;lt;tt&amp;gt;01&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;03&amp;lt;/tt&amp;gt; -- number of clocks to ignore at the end&lt;br /&gt;
* N bytes: two bits per clock&lt;br /&gt;
** 1 bit: TMS high&lt;br /&gt;
** 1 bit: TDO high&lt;br /&gt;
Reply Data (only if reading):&lt;br /&gt;
* N bytes: one bit per clock&lt;br /&gt;
** 1 bit: TDI high&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;tt&amp;gt;c1&amp;lt;/tt&amp;gt; -- read/write register====&lt;br /&gt;
Note that data is written/read in big endian bit order. This means that the first bit written/read is &amp;lt;tt&amp;gt;80&amp;lt;/tt&amp;gt;, then &amp;lt;tt&amp;gt;40&amp;lt;/tt&amp;gt;, and so on. If you are not using a multiple of 8 bits, this is still the case; for example, if you read 7 bits all high, you will get &amp;lt;tt&amp;gt;fe&amp;lt;/tt&amp;gt;, ''not'' &amp;lt;tt&amp;gt;7f&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Request Data:&lt;br /&gt;
* 1 byte: bit values (bitwise or'd)&lt;br /&gt;
** Mode:&lt;br /&gt;
*** &amp;lt;tt&amp;gt;00&amp;lt;/tt&amp;gt; -- Continue already-started r/w&lt;br /&gt;
*** &amp;lt;tt&amp;gt;80&amp;lt;/tt&amp;gt; -- Start r/w of DR register&lt;br /&gt;
*** &amp;lt;tt&amp;gt;40&amp;lt;/tt&amp;gt; -- Start r/w of IR register&lt;br /&gt;
** &amp;lt;tt&amp;gt;20&amp;lt;/tt&amp;gt; -- Finish r/w&lt;br /&gt;
** &amp;lt;tt&amp;gt;10&amp;lt;/tt&amp;gt; -- Read+Write (default is Write only)&lt;br /&gt;
** &amp;lt;tt&amp;gt;01&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;07&amp;lt;/tt&amp;gt; -- Don't do last N bits of data&lt;br /&gt;
* N bytes: data to write&lt;br /&gt;
Reply Data (may be parallel with request):&lt;br /&gt;
* N bytes: data read (only if Read+Write set in request)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;tt&amp;gt;c2&amp;lt;/tt&amp;gt; -- reset====&lt;br /&gt;
(No Request or Reply Data)&lt;br /&gt;
====&amp;lt;tt&amp;gt;c3&amp;lt;/tt&amp;gt; -- run====&lt;br /&gt;
Request Data:&lt;br /&gt;
* 1 byte: number of iterations to run&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;tt&amp;gt;e0&amp;lt;/tt&amp;gt; -- ping====&lt;br /&gt;
Device number ignored.&lt;br /&gt;
Replies with same data as request&lt;br /&gt;
====&amp;lt;tt&amp;gt;e1&amp;lt;/tt&amp;gt; -- get device count====&lt;br /&gt;
Device number ignored.&lt;br /&gt;
May be required before device access.&lt;br /&gt;
&lt;br /&gt;
Reply Data:&lt;br /&gt;
* 1 byte: number of devices&lt;br /&gt;
* N bytes:&lt;br /&gt;
** 1 byte: device id number&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;tt&amp;gt;e2&amp;lt;/tt&amp;gt; -- hardware version====&lt;br /&gt;
Note: Only expected to work for controller&lt;br /&gt;
&lt;br /&gt;
Reply Data:&lt;br /&gt;
* 4 bytes: hardware version (big endian)&lt;br /&gt;
* 2 bytes: hardware vendor id authority&lt;br /&gt;
** &amp;lt;tt&amp;gt;0000&amp;lt;/tt&amp;gt; -- USB&lt;br /&gt;
** &amp;lt;tt&amp;gt;ffff&amp;lt;/tt&amp;gt; -- Ad-hoc&lt;br /&gt;
* 1 byte: length of hardware vendor id&lt;br /&gt;
* N bytes: hardware vendor id (binary)&lt;br /&gt;
* 1 byte: length of hardware device id&lt;br /&gt;
* N bytes: hardware device id (binary)&lt;br /&gt;
* 1 byte: length of hardware serial number&lt;br /&gt;
* N bytes: hardware serial number (UTF-8)&lt;br /&gt;
* 1 byte: length of human-readable hardware model&lt;br /&gt;
* N bytes: human-readable hardware model/version string (UTF-8)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;tt&amp;gt;e3&amp;lt;/tt&amp;gt; -- software version====&lt;br /&gt;
Note: Only expected to work for controller&lt;br /&gt;
&lt;br /&gt;
Reply Data:&lt;br /&gt;
* 4 bytes: software version (big endian)&lt;br /&gt;
** &amp;lt;tt&amp;gt;ffffffff&amp;lt;/tt&amp;gt; -- Unknown&lt;br /&gt;
* 1 byte: length of software-specific unique identifier (git commit?)&lt;br /&gt;
* N bytes: software-specific unique identifier&lt;br /&gt;
* 1 byte: length of human-readable software name&lt;br /&gt;
* N bytes: human-readable hardware model/version string (UTF-8)&lt;br /&gt;
* 2 byte: number of AJP features supported&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;tt&amp;gt;e4&amp;lt;/tt&amp;gt; -- device capabilities====&lt;br /&gt;
Reply Data:&lt;br /&gt;
* 2*N bytes: supported capabilities&lt;br /&gt;
** &amp;lt;tt&amp;gt;c000&amp;lt;/tt&amp;gt; -- JTAG protocol commands&lt;br /&gt;
** &amp;lt;tt&amp;gt;e50x&amp;lt;/tt&amp;gt; -- watch/poll command, with up to X concurrent watches&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;tt&amp;gt;e5&amp;lt;/tt&amp;gt; -- watch/poll====&lt;br /&gt;
Request Data:&lt;br /&gt;
* 1 byte: how long to watch, in 1/0x10000th of a day (about 1.32 seconds)&lt;br /&gt;
** &amp;lt;tt&amp;gt;00&amp;lt;/tt&amp;gt; -- cancel watch&lt;br /&gt;
** &amp;lt;tt&amp;gt;ff&amp;lt;/tt&amp;gt; -- never expire&lt;br /&gt;
* 2 bytes: how often to poll, in 1/0x1000000th of a day (about 0.005 seconds)&lt;br /&gt;
** &amp;lt;tt&amp;gt;0000&amp;lt;/tt&amp;gt; -- constantly poll&lt;br /&gt;
** &amp;lt;tt&amp;gt;2d83&amp;lt;/tt&amp;gt; -- about once a minute&lt;br /&gt;
* N bytes: packets to send&lt;br /&gt;
Reply (immediately for all, and whenever results change individually):&lt;br /&gt;
* Same as if the packets were received directly&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
====Reset the command queue====&lt;br /&gt;
To reset the command queue, send 243 zero bytes followed by the Abort packet (&amp;lt;tt&amp;gt;fd414a50 00 7052&amp;lt;/tt&amp;gt;); this will pad-out any &amp;quot;open&amp;quot; packet, and abort any open command.&lt;br /&gt;
&lt;br /&gt;
It is also advisable to cancel any watch active: &amp;lt;tt&amp;gt;fd414a50 05 00e50000 00 5b9f&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Technology]]&lt;br /&gt;
[[Category:BIP]]&lt;br /&gt;
==See Also on BitcoinWiki==&lt;br /&gt;
* [[BitSimple]]&lt;br /&gt;
* [[Bitcoin Argentina]]&lt;br /&gt;
* [[BitcoinPlus.mx]]&lt;br /&gt;
* [[Bitcoincambodia.com]]&lt;br /&gt;
* [[Cryptocurrent]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
		
	</entry>
</feed>