<!-- index.php3 -->
<?php
	$head = "Projects - JTAG";
	$title = $head;
	$thispage = "jtag";
	require("table-top.php3");
	require("sidebar.php3");
	require("table-mid.php3");
?>

<h2>JTAG for the LART</h2>

<p>
Before you can run an operating system on the LART, you have to write a
bootloader to the flash. The LART team uses a special external flash board;
for most people that's not really a solution because some special hardware
is required to (re-)program that board.

<p>
Fortunately, <a href="http://www.intel.com/">Intel</a> has a documented hack
to program flash memory through the SA1100 JTAG interface. Nonetheless it
took quite some time before everything was ported to Linux and the correct
hardware was built.

<p>
Nicolas Pitre first ported Intel's
<a href="http://www.intel.com/design/strong/swsup/downloads/SA1110JFlashKit_V12.htm">Jflash</a>
(<a href="http://www.intel.com/design/strong/swsup/SA11_V12_legal.htm">legal info</a>)
utility from Windows to Linux, Steve Wiseman hacked it a bit further
so it worked with the LART (Jflash was intended for the
<a href="http://developer.intel.com/design/strong/quicklist/eval-plat/sa-1110.htm">Intel Assabet</a>
which has an SA1110 CPU). Finally, Holly Gates designed a dongle so
you can connect your LART directly to the parallel port.



<h3>Pictures</h3>

<p>
Some pictures courtesy of Holly Gates.

<?php	hrow("<a name=\"jtag\"></a>JTAG pictures", "left");
	lrow('<a href="lart-jtag-1.jpg"><img src="lart-jtag-1-sm.jpg"
		alt="[Click to enlarge]" align=left width=100 height=75
		border=0></a> </td><td valign=top width="99%">
		A LART with the JTAG dongle attached.', "", "");
	zrow();
	lrow('<a href="lart-jtag-2.jpg"><img src="lart-jtag-2-sm.jpg"
		alt="[Click to enlarge]" align=left width=100 height=73
		border=0></a> </td><td valign=top width="99%">
		And a close-up of the dongle.', "", "");
	erow();
?>



<h3>Download</h3>

<?php dlist("jtag-lart*"); ?>

<?php dlist("jflash-linux*"); ?>



<h3>Usage</h3>

<p>
Using the JTAG programmer is quite easy:

<p>
Connect a parallel cable to you computer's printer port, connect the JTAG
dongle to the cable. Connect the other end of the JTAG dongle to the LART.
Powerup the LART. Have a copy of blob ready, and use the following command
(as root):

<?php	hrow("");
	lrow('<pre>
root@arthur:jflash-linux # ./Jflash-linux blob-1.0.7b 
using printer port at 378
Seems to be a pair of 28F160F3, bottom boot. Good. 

Starting erase for    da5 bytes
Erasing block   0   
Erasing done                                           
Starting programming
Writing flash at hex address      220, 15.57% done    
Writing flash at hex address      4b0, 34.35% done    
Writing flash at hex address      750, 53.59% done    
Writing flash at hex address      9f0, 72.83% done    
Writing flash at hex address      c90, 92.07% done    
Programming done                                            
Starting verify
Verifying flash at hex address      7a2, 55.94% done    
Verification successful!                           
root@arthur:jflash-linux #
</pre>', "", "");
	erow();
?>

<p>
In our first experiments, we have measured a throughput of
630 bytes/s. If the download is successful, the LART will immediately
reset itself and run blob. If you have a terminal (or terminal emulator)
connected to the serial port, you will see blob booting:

<?php	hrow("");
	lrow('<pre>
Consider yourself LARTed!
Running from internal Flash.
Starting the memory tester...
Zeroing memory...0xD0000000</pre>', "", "");
	erow();
?>



<h3>Notes</h3>

<p>
There is a small chance that the dongle doesn't work. You may get one
of the following error messages when using <tt>Jflash-linux</tt>:

<?php   hrow("");
	lrow('<pre>
error, failed to read device ID
ACT: 0000 0000000000000000 00000000000 0
EXP: X001 0001000010000100 00000110101 1

failed to read device ID for the SA-1100</pre>', "", "");
	erow();
?>

<?php   hrow("");
	lrow('<pre>
error, failed to read device ID
ACT: 1111 1111111111111111 11111111111 1
EXP: X001 0001000010000100 00000110101 1

failed to read device ID for the SA-1100</pre>', "", "");
	erow();
?>

<p>
If that's the case, put a 100 ohm resistor between pins 6 (+3.3V)
and 7 (nTRST) on the JTAG connector. In this way nTRST will be
pulled to +3.3V so the JTAG bus won't be able to reset itself.



<h3>Credits</h3>

<p>
This is an external project. The LART team wishes to thank
<a href="mailto:nico@cam.org">Nicolas Pitre</a>,
<a href="mailto:steve@steves-house.org.uk">Steve Wiseman</a>, and 
<a href="mailto:hgates@eink.com">Holly Gates</a> for their efforts.

<?php	require("table-btm.php3"); ?>
