JTAG-adapter

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 20:28, 17 July 2008 (edit)
Sash (Talk | contribs)
m (Intro)
← Previous diff
Revision as of 17:22, 11 May 2010 (edit) (undo)
Glenn (Talk | contribs)
(wiki)
Next diff →
(14 intermediate revisions not shown.)
Line 1: Line 1:
-[[Category:jtag]]+{{Languages|JTAG-adapter}}
-[[Category:Deutsche Dokumentation]]+
-[[Category:English documentation]]+
__TOC__ __TOC__
----- 
- 
-==English== 
===Intro=== ===Intro===
-What us [http://en.wikipedia.org/wiki/JTAG JTAG] Its communication/debug interface to access flash chips direktly even when the OS is corrupted or not installed.<br>+What is [http://en.wikipedia.org/wiki/JTAG JTAG]? JTAG is a communication/debug interface to access flash chips directly even when the OS is corrupted or not installed.<br>
-I you have [http://en.wikipedia.org/wiki/Brick_%28electronics%29 bricked] (nice story) device by flashing with a wrong firmware, interrupting the flashing process or someting else you can use JTAG to get your device back to life! The 2nd+
-thing you can do with it is making backups of you existing flash content. This is very usfull for porting.<br>+
-All you need is a short adapter cable, a piece of software and of cause a JTAG header on you devices pcb.<br>+
-The JTAG header is mostly located in the near area of the flash chip. In most cases its a 12 to 14 pin header which must be assembled with 2,54mm pins.<br>+
-JTAG software is available from [http://www.dd-wrt.com/phpBB2/profile_sec.php?mode=viewprofile&u=103 Tornado ] a DD-WRT developer. His current builds for windows and the sources for linuy can be found in the DD-WRT download section in the "others->tornado" folder.<br>+
-===Building the Cable===+If you have [http://en.wikipedia.org/wiki/Brick_%28electronics%29 bricked] (nice story) your device by flashing it with incorrect firmware, interrupting the flashing process, etc., you can use JTAG to bring your device back to life! You can also use JTAG to make backups of your existing flash content. This is very useful for porting.<br>
 +All you need is a short adapter cable, a piece of software, and of course a JTAG header on your device's circuit board. The JTAG header is usually located near the flash chip. In most cases it is a 12 to 14 pin header which must be assembled with 2,54mm pins.<br>
-===Using the Cable===+JTAG software is available from [http://www.dd-wrt.com/phpBB2/profile_sec.php?mode=viewprofile&u=103 Tornado] a DD-WRT developer. His current builds for windows and the source files for linux can be found in the DD-WRT download section in the "others->tornado" folder.<br>
-==German==+===Building the Cable===
-=== Einführung ===+Building the cable is quite easy. You will need some parts you can get at every electronic store in your area, some soldering skills and a voltage/resistance meter.<br><br>
-Falls man sich sein Graet kaputt geflasht hat, ist es praktisch so wie blockiert. Die POWER-LED blinkt nur noch, und er reagiert nicht mehr auf Pings oder Zugriffsversuche über den Browser. Abhilfe schafft da ggf. ein sogenannter [http://de.wikipedia.org/wiki/JTAG JTAG]-Adapter. Dieser wird an vorgesehene Pins am WRT und an einen parallelen 25poligen Anschluss am PC angeschlossen. Nun ist es einfach möglich über eine Software ganz gezielt bestimmte Bereiche (CFE, Kernel und NVRAM) des Intel-Flash-Chips zu sichern, löschen oder neu zu beschreiben.+Parts:
- +
-=== Aufbau ===+
- +
-Für den Aufbau benötigt man folgende Teile:+
<blockquote> <blockquote>
-*4x 100Ohm Widerstände +*4x 100Ohm resistors
-*1x 25pol.D-SUB-Stecker (für an den Parallel-Port des PCs) +*1x 25pol.D-SUB-Plug (PC Parallel-Port)
-*1x D-SUB-Kappe für den Stecker +*1x D-SUB-case for the plug
-*etwas Kabel/Flachbandkabel +*12 to 14 ping ribbon cable or single wires
-*nach Wunsch Wannenstecker und Pfostenbuchse fürs Flachbandkabel +*1x Pfostenbuchse (i dont know how its called in english. its the header pin which gets soldered to the board)
-*Lötkolben usw. +*1x Wannenstecker (i dont know how its called in english, too. its the plug which fits to the header on the board)
 +
</blockquote> </blockquote>
-Schaltplan:+Circuit:
<pre> <pre>
- D-SUB-Stecker JTAG (JP2 am WRT)+ D-SUB-Plug JTAG
Pin 2 -------[100Ohm]------- Pin 3 Pin 2 -------[100Ohm]------- Pin 3
D0 TDI D0 TDI
Line 61: Line 49:
GND GND
</pre> </pre>
-Wer keine 100 Ohm Widerstände zu Hand hat, kann sie u.U. auch weglassen: Die Eingänge der JTAG Schnittstelle sind ohnehin mit 4,7 KOhm Widerständen beschaltet. So war das zumindest bei meinem WRT54G v5, also bei anderen Versionen lieber nochmal nachschauen. Achtung: Bei dem Modell WRT54G v.3.1 fehlen die SMD-Widerstände RH4 - RH9 (PullUp) und RG4 (PullDown). 
-Vorsicht! Die Beschriftung der Anschlußfelder kann variieren. Auf manchen Platinen ist das JTAG mit "JP1" und der COM-Anschluß mit "JP2"beschriftet. Grade die Nummerrierung am COM-Anschluß ist etwas verwirrend. Aber: JTAG hat 12 Kontakte, der COM-Anschluß 10 Kontakte.+===Using the Cable===
-Bei WRT54G 1.0 , 1.1 und WRT54GS 1.0 sind zwei COM-Anschlüsse vorgesehen und das Anschlußfeld ist 20-polig. Fazit: den 12poligen benutzen ;-)+
-===Verwendung des Adapters===+install the software, connect your device to the cable and the cable to your pc. leave the psu unplugged.
- +open a cli, go to the folder where the jtag software is stored.<br>
-Nachdem man den Adapter gebaut hat und alle Kontakte überprüft sind, muss der WRT geöffnet werden.+'''Always do a backup of your existing flash state before doing something else!''' This is necessary for recovering to the pre flash state and for testing that everything is working fine!<br>
-Dazu den blauen vorderen Bereich von dem zweigeteilten hinteren Bereich entfernen. Geht etwas schwer anfangs.+Always let the software auto neg the right settings first.<br><br>
- +The flash areas you can modify are cfe (the broadcom bootloader), nvram (the system nonvolatile ram), kernel(the system) and wholeflash (takes a very long time).
-Nun die Kabelenden bzw. den Wannenstecker entsprechend dem Schaltplan anlöten und mit dem Adapter verbinden.+The switches which can be used are -erase (purging the flash area), -backup and -flash.
- +<br><br>
-Nun den Adapter an den PC anschliessen. (WRT ist dabei stromlos!)+If you have a brick caused by a bad flash the easiest way to debrick is to erase the kernel and nvram. After a powercycling the router it will wait for a [[Tftp_flash]] firmware flash. You can upload the new firmware via JTAG, too, but this will take hours! <br>
- +'''In a standard bricked situation you will never have to erase the cfe! Hands OFF!!'''<br><br>
-In der Konsole nun folgende Zeile eintippen aber noch nicht ausführen:+Some examples:<br>
- +This console commands are for linux
-<pre>./wrtjtag -erase:nvram</pre>+Backup:<br>
- +<pre>./wrtjtag -backup:kernel</pre>
-Jetzt erst den WRT mit Strom versorgen und gleich dannachbinnerhalb von 0,5s bis 2,0s nach der Stromzufuhr Enter drücken und das Programm ausführen.+ 
-Es wird nun der NVRAM-Bereich gelöscht. Nach erfolgreichem Löschen den WRT wieder stromlos machen und obiges Spielchen mit folgender Zeile wiederhohlen:+Erase Kernel
- +
<pre>./wrtjtag -erase:kernel</pre> <pre>./wrtjtag -erase:kernel</pre>
- +These are for windows (maybe the .exe is called different):<br>
-Wenn nun auch der Kernel erfolgreich gelöscht wurde, sollte der WRT auf eine neue Firmware warten. Diese kann man mittels TFTP an die IP 192.168.1.1 an den WRT senden (sollte unter 2,8MB sein):+Backup:<br>
- +<pre>wrtjtag -backup:kernel</pre>
- <pre>tftp -i 192.168.1.1 PUT Firmware.bin</pre>+
- +
-Der WRT erhält durch das Löschen automatisch die IP 192.168.1.1.+
-[http://www.linksysinfo.org/modules.php?name=Content&pa=showpage&pid=33 http://www.linksysinfo.org/modules.php?name=Content&pa=showpage&pid=33]+Erase Kernel
 +<pre>wrtjtag -erase:kernel</pre>
 +<br><br>
-[http://lonewolf.hacker-nin.com/wrt/cfe/cfe.php cfe.bin Datei]+[[Category:jtag]]
-Lonewolf von Sveasoft betreibt eine Seite wo man die verschiedenen Versionen runterladen kann.+[[Category:Documentation]]

Revision as of 17:22, 11 May 2010


Contents


Intro

What is JTAG? JTAG is a communication/debug interface to access flash chips directly even when the OS is corrupted or not installed.

If you have bricked (nice story) your device by flashing it with incorrect firmware, interrupting the flashing process, etc., you can use JTAG to bring your device back to life! You can also use JTAG to make backups of your existing flash content. This is very useful for porting.

All you need is a short adapter cable, a piece of software, and of course a JTAG header on your device's circuit board. The JTAG header is usually located near the flash chip. In most cases it is a 12 to 14 pin header which must be assembled with 2,54mm pins.

JTAG software is available from Tornado a DD-WRT developer. His current builds for windows and the source files for linux can be found in the DD-WRT download section in the "others->tornado" folder.

Building the Cable

Building the cable is quite easy. You will need some parts you can get at every electronic store in your area, some soldering skills and a voltage/resistance meter.

Parts:

  • 4x 100Ohm resistors
  • 1x 25pol.D-SUB-Plug (PC Parallel-Port)
  • 1x D-SUB-case for the plug
  • 12 to 14 ping ribbon cable or single wires
  • 1x Pfostenbuchse (i dont know how its called in english. its the header pin which gets soldered to the board)
  • 1x Wannenstecker (i dont know how its called in english, too. its the plug which fits to the header on the board)

Circuit:

 D-SUB-Plug JTAG
 Pin 2  -------[100Ohm]------- Pin 3
 D0                              TDI
 
 Pin 3  -------[100Ohm]------- Pin 9
 D1                              TCK
 
 Pin 4  -------[100Ohm]------- Pin 7
 D2                              TMS
 
 Pin 13 -------[100Ohm]------- Pin 5
 Select                          TD0
 
 Pin 20 ---+------------------ Pin 6
 GND       |                     GND
           |
 Pin 25 ---+
 GND

Using the Cable

install the software, connect your device to the cable and the cable to your pc. leave the psu unplugged. open a cli, go to the folder where the jtag software is stored.
Always do a backup of your existing flash state before doing something else! This is necessary for recovering to the pre flash state and for testing that everything is working fine!
Always let the software auto neg the right settings first.

The flash areas you can modify are cfe (the broadcom bootloader), nvram (the system nonvolatile ram), kernel(the system) and wholeflash (takes a very long time). The switches which can be used are -erase (purging the flash area), -backup and -flash.

If you have a brick caused by a bad flash the easiest way to debrick is to erase the kernel and nvram. After a powercycling the router it will wait for a Tftp_flash firmware flash. You can upload the new firmware via JTAG, too, but this will take hours!
In a standard bricked situation you will never have to erase the cfe! Hands OFF!!

Some examples:
This console commands are for linux Backup:

./wrtjtag -backup:kernel

Erase Kernel

./wrtjtag -erase:kernel

These are for windows (maybe the .exe is called different):
Backup:

wrtjtag -backup:kernel

Erase Kernel

wrtjtag -erase:kernel