Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:techref:hardware:port.jtag [2018/03/31 23:22] – ↷ Page moved from docs:hardware:port.jtag to docs:techref:hardware:port.jtag bobafetthotmail | docs:techref:hardware:port.jtag [2020/07/09 10:23] (current) – [Hairydairymaid] Add Github for source, remove thecshore cshoredaniel1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== JTAG ====== | ====== JTAG ====== | ||
| - | JTAG stands for [[wp> | + | JTAG stands for [[wp> |
| - | * -> [[docs: | + | * -> [[docs:techref: |
| - | * -> [[docs: | + | * -> [[docs:techref: |
| - | * -> [[docs: | + | * -> [[docs:techref: |
| - | * -> [[docs: | + | * -> [[docs:techref: |
| - | * -> [[docs: | + | * -> [[docs:techref: |
| * -> [[docs: | * -> [[docs: | ||
| - | * -> [[/toh/davolink/dv-201amr# | + | * -> [[toh:davolink:dv-201amr# |
| * [[https:// | * [[https:// | ||
| ===== JTAG automate ===== | ===== JTAG automate ===== | ||
| - | There is always a JTAG automate (JTAG logic) integrated into your [[docs: | + | There is always a JTAG automate (JTAG logic) integrated into your [[docs:techref: |
| To do that, you need to connect the [[wp> | To do that, you need to connect the [[wp> | ||
| Line 21: | Line 21: | ||
| A JTAG port can be used without any software running on the IC itself, but the IC still has to be powered by a separate power supply. This means, you can solder a lonely SoC to a PCB, no Flash-Chip, no RAM; then connect to it via JTAG and interact with the SoC. Of course, on the PC itself, you should have some sort of software, to make this interaction with the hardware on the lowest level possible a bit more comfortable. | A JTAG port can be used without any software running on the IC itself, but the IC still has to be powered by a separate power supply. This means, you can solder a lonely SoC to a PCB, no Flash-Chip, no RAM; then connect to it via JTAG and interact with the SoC. Of course, on the PC itself, you should have some sort of software, to make this interaction with the hardware on the lowest level possible a bit more comfortable. | ||
| - | Of course, if there is a flash chips soldered onto the PCB, you could access this chip by programming the SoC via JTAG. It's one of those amazingly useful things that allows you to recover from pretty much anything that doesn' | + | Of course, if there is a flash chip soldered onto the PCB, you could access this chip by programming the SoC via JTAG. It's one of those amazingly useful things that allows you to recover from pretty much anything that doesn' |
| - | The JTAG Automate | + | The JTAG automate |
| Finding JTAG connector on a PCB can be a little easier than finding the UART since most vendors leave those headers unpopulated after production. JTAG connectors are usually 12, 14, or 20-pins headers with one side of the connector having some signals at 3.3V and the other side being connected to GND. | Finding JTAG connector on a PCB can be a little easier than finding the UART since most vendors leave those headers unpopulated after production. JTAG connectors are usually 12, 14, or 20-pins headers with one side of the connector having some signals at 3.3V and the other side being connected to GND. | ||
| Line 29: | Line 29: | ||
| ===== Identifying JTAG connector ===== | ===== Identifying JTAG connector ===== | ||
| - | ===== Headers | + | ==== Headers ==== |
| There are two major JTAG header arrangements used in SOHO routers based on MIPS CPUs. One uses 12 pins and the other uses 14 pins. While not radically different, you should be familiar with both. Other JTAG pinouts can be found at [[http:// | There are two major JTAG header arrangements used in SOHO routers based on MIPS CPUs. One uses 12 pins and the other uses 14 pins. While not radically different, you should be familiar with both. Other JTAG pinouts can be found at [[http:// | ||
| - | ==== 10 Pin Header | + | === 8 Pin Header - 1 row === |
| + | |||
| + | {{ : | ||
| + | |||
| + | < | ||
| + | # | ||
| + | | ||
| + | ? |#--#| 1 | ||
| + | | ||
| + | | ||
| + | nTRST |#--#| 2 | ||
| + | | ||
| + | | ||
| + | TCK |#--#| 3 | ||
| + | | ||
| + | | ||
| + | TMS |#--#| 4 | ||
| + | | ||
| + | | ||
| + | GND |#--#| 5 | ||
| + | | ||
| + | | ||
| + | TDO |#--#| 6 | ||
| + | | ||
| + | | ||
| + | TDI |#--#| 7 | ||
| + | | ||
| + | | ||
| + | GND |#--#| 8 | ||
| + | # | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | === 10 Pin Header === | ||
| Found in many Huawei routers: | Found in many Huawei routers: | ||
| - | | | + | < |
| - | | TDO ^ 3 ^ 4 | + | # |
| - | | TMS ^ | + | |
| - | | - ^ 7 ^ 8 | + | 1 |#--# #--#| 2 |
| - | | TDI ^ 9 ^ 10 | + | | | |
| + | | ||
| + | 3 |#--# #--#| 4 | ||
| + | | | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | 7 |#--# #--#| 8 | ||
| + | | | | ||
| + | | ||
| + | 9 |#--# #--#| 10 | ||
| + | # | ||
| + | </ | ||
| It matches with the ALTERA ByteBlasterMV 10-pin cable, but without the nSRST, nTRST pins. | It matches with the ALTERA ByteBlasterMV 10-pin cable, but without the nSRST, nTRST pins. | ||
| - | ==== 12 Pin Header | + | === 12 Pin Header === |
| Found in Linksys routers such as the WRT54G and WRT54GS, the 12-pin header has the following arrangement of JTAG signals and pins: | Found in Linksys routers such as the WRT54G and WRT54GS, the 12-pin header has the following arrangement of JTAG signals and pins: | ||
| - | | | + | |
| - | | TDI ^ 3 ^ 4 | + | < |
| - | | TDO ^ 5 ^ 6 | + | # |
| - | | TMS ^ 7 ^ 8 | + | nTRST |#--# #--#| GND |
| - | | TCK ^ 9 ^ 10 | + | |
| - | | nSRST ^ 11 ^ 12 | + | |
| + | TDI |#--# #--#| GND | ||
| + | | ||
| + | | ||
| + | TDO |#--# #--#| GND | ||
| + | | ||
| + | | ||
| + | TMS |#--# #--#| GND | ||
| + | | ||
| + | | ||
| + | TCK |#--# #--#| GND | ||
| + | | ||
| + | | ||
| + | nSRST |#--# #--#| GND | ||
| + | 11 |#--# #--#| 12 | ||
| + | # | ||
| + | </ | ||
| Seems, this header is a truncated version of the full EJTAG header. | Seems, this header is a truncated version of the full EJTAG header. | ||
| - | ==== 14 Pin Header | + | === 14 Pin Header === |
| This header is fully MIPS EJTAG 2.6 compatible and described in the EJTAG 2.6 standard. Found in Edimax routers (and other brands that are Edimax clones), the 14-pin header has the following arrangement of JTAG signals and pins: | This header is fully MIPS EJTAG 2.6 compatible and described in the EJTAG 2.6 standard. Found in Edimax routers (and other brands that are Edimax clones), the 14-pin header has the following arrangement of JTAG signals and pins: | ||
| - | | | + | < |
| - | | TDI ^ 3 ^ 4 | + | # |
| - | | TDO ^ 5 ^ 6 | + | nTRST |#--# #--#| GND |
| - | | TMS ^ 7 ^ 8 | + | |
| - | | TCK ^ 9 ^ 10 | + | |
| - | | nSRST ^ 11 ^ 12 | + | TDI |#--# #--#| GND |
| - | | n/a ^ 13 ^ 14 | + | |
| + | | ||
| + | TDO |#--# #--#| GND | ||
| + | | ||
| + | | ||
| + | TMS |#--# #--#| GND | ||
| + | | ||
| + | | ||
| + | TCK |#--# #--#| GND | ||
| + | | ||
| + | | ||
| + | nSRST |#--# #--#| n/a | ||
| + | 11 |#--# #--#| 12 | ||
| + | | ||
| + | n/a |#--# #--#| Vcc | ||
| + | 13 |#--# #--#| 14 | ||
| + | # | ||
| + | </ | ||
| A buffered cable such as the Wiggler requires an external Vcc voltage supply. The 14-pin header conveniently supplies this voltage on pin 14. The typical unbuffered cable, however, does not require an external voltage in order to function. Formally, the pin 14 is called VREF and used to indicate a JTAG signal levels: 5V, 3.3V or 2.5V. On the most devices this pin is tied to the device' | A buffered cable such as the Wiggler requires an external Vcc voltage supply. The 14-pin header conveniently supplies this voltage on pin 14. The typical unbuffered cable, however, does not require an external voltage in order to function. Formally, the pin 14 is called VREF and used to indicate a JTAG signal levels: 5V, 3.3V or 2.5V. On the most devices this pin is tied to the device' | ||
| - | ==== 16 Pin Header | + | === 16 Pin Header === |
| Usually found in IBM 4XX powerpc platform, this layout is also known as JTAG RISCWATCH | Usually found in IBM 4XX powerpc platform, this layout is also known as JTAG RISCWATCH | ||
| - | | TDO | o ^ 1 ^ 2 | nc | - | | ||
| - | | TDI | i ^ 3 ^ 4 | i | nTRST | | ||
| - | | HALTED | o ^ 5 ^ 6 | p | VREF | | ||
| - | | TCK | i ^ 7 ^ 8 | nc | - | | ||
| - | | TMS | i ^ 9 ^ 10 | nc | - | | ||
| - | | HALT | i ^ 11 ^ 12 | p | GND | | ||
| - | | nSRST | od ^ 13 ^ 14 | k | KEY | | ||
| - | | - | nc ^ 15 ^ 16 | p | GND | | ||
| - | ==== 20 Pin Header | + | < |
| + | # | ||
| + | TDO |#--# #--#| - | ||
| + | 1 |#--# #--#| 2 | ||
| + | | ||
| + | TDI |#--# #--#| nTRST | ||
| + | 3 |#--# #--#| 4 | ||
| + | | ||
| + | HALTED |#--# #--#| VREF | ||
| + | 5 |#--# #--#| 6 | ||
| + | | ||
| + | TCK |#--# #--#| - | ||
| + | 7 |#--# #--#| 8 | ||
| + | | ||
| + | TMS |#--# #--#| - | ||
| + | 9 |#--# #--#| 10 | ||
| + | | ||
| + | HALT |#--# #--#| GND | ||
| + | 11 |#--# #--#| 12 | ||
| + | | ||
| + | nSRST |#--# #--#| KEY | ||
| + | 13 |#--# #--#| 14 | ||
| + | | ||
| + | - |#--# #--#| GND | ||
| + | 15 |#--# #--#| 16 | ||
| + | # | ||
| + | </ | ||
| + | |||
| + | === 20 Pin Header === | ||
| Found in Comtrend routers: | Found in Comtrend routers: | ||
| - | | | + | < |
| - | | TDI ^ 3 ^ 4 | + | # |
| - | | TDO ^ 5 ^ 6 | + | |
| - | | TMS ^ 7 ^ 8 | + | |
| - | | TCK ^ | + | |
| - | | | + | TDI |#--# #--#| GND |
| - | | Vcc? ^ | + | |
| - | | | + | |
| - | | Vcc? ^ 17 ^ 18 | + | TDO |#--# #--#| GND |
| - | | Vcc? ^ 19 ^ 20 | + | |
| + | | ||
| + | TMS |#--# #--#| GND | ||
| + | | ||
| + | | ||
| + | TCK |#--# #--#| GND | ||
| + | 9 |#--# #--#| 10 | ||
| + | | | ||
| + | nSRST |#--# #--#| GND | ||
| + | 11 |#--# #--#| 12 | ||
| + | | ||
| + | Vcc |#--# #--#| ? | ||
| + | | ||
| + | | | ||
| + | | ||
| + | 15 |#--# #--#| 16 | ||
| + | | ||
| + | Vcc |#--# #--#| GND | ||
| + | 17 |#--# #--#| 18 | ||
| + | | ||
| + | Vcc |#--# #--#| GND | ||
| + | 19 |#--# #--#| 20 | ||
| + | # | ||
| + | </ | ||
| - | Not fully verified, Vcc at the bottom left are guessed, nSRST and nTRST might be swapped. FIXME | + | Not fully verified, Vcc at the bottom left are by add smd 0ohm. FIXME |
| - | ==== 8 Pin Header - 1 row ==== | + | |
| - | {{ : | ||
| - | | ? ^ 1 ^ | + | ==== JTAG pinout scan ==== |
| - | | nTRST ^ 2 ^ | + | We can detect the pinout using a microcontroller like Arduino with specific software for this purpose. There are several implementations, |
| - | | TCK ^ 3 ^ | + | |
| - | | TMS ^ 4 ^ | + | |
| - | | GND ^ 5 ^ | + | |
| - | | TDO ^ 6 ^ | + | |
| - | | TDI ^ 7 ^ | + | |
| - | | GND ^ 8 ^ | + | |
| + | === JTAGenum === | ||
| + | [[https:// | ||
| ===== JTAG software ===== | ===== JTAG software ===== | ||
| Line 113: | Line 230: | ||
| ==== Hairydairymaid ==== | ==== Hairydairymaid ==== | ||
| The most famous software for JTAG is probably the Linksys De-Brick Utility by Hairydairymaid (aka Lightbulb). As of 12 September 2006 the most recent version is v4.8. Virtually everyone who uses this software opts for an unbuffered cable, and the software itself, by default, expects this type of cable to be used. | The most famous software for JTAG is probably the Linksys De-Brick Utility by Hairydairymaid (aka Lightbulb). As of 12 September 2006 the most recent version is v4.8. Virtually everyone who uses this software opts for an unbuffered cable, and the software itself, by default, expects this type of cable to be used. | ||
| + | |||
| + | There is source code available on GitHub at [[https:// | ||
| The utility CAN operate on most any MIPS based cpu supporting EJTAG by using PrAcc routines (non-dma mode) - use the /nodma switch. It is not limited to WRT54G/GS units. | The utility CAN operate on most any MIPS based cpu supporting EJTAG by using PrAcc routines (non-dma mode) - use the /nodma switch. It is not limited to WRT54G/GS units. | ||
| - | If you don't have a PC with parallel port but instead own a [[http:// | + | If you don't have a PC with parallel port but instead own a [[wp>Raspberry_Pi|Raspberry Pi]], you can use a [[https:// |
| Downloads: | Downloads: | ||
| - | * [[https:// | ||
| - | * [[http:// | ||
| * {{: | * {{: | ||
| Line 146: | Line 263: | ||
| start: 0x40000000, length: 0x20000000, data width: 32 bit | start: 0x40000000, length: 0x20000000, data width: 32 bit | ||
| </ | </ | ||
| + | |||
| ==== OpenOCD ==== | ==== OpenOCD ==== | ||
| OpenOCD is more complex than Hairydairymaid or UrJTAG since it is mainly used for debugging. But it can be also used for debricking. | OpenOCD is more complex than Hairydairymaid or UrJTAG since it is mainly used for debugging. But it can be also used for debricking. | ||
| - | * http:// | + | * [[http:// |
| * [[docs: | * [[docs: | ||
| + | |||
| ===== Links ===== | ===== Links ===== | ||
| {{page> | {{page> | ||
| - | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| - | * [[/ | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| Line 165: | Line 278: | ||
| * [[http:// | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| - | * http:// | ||
| + | ===== Devices ===== | ||
| + | The list of related devices: | ||
| + | {{tagpage> | ||
| - | ===== Tags ===== | ||
| - | [[meta: | ||
| - | {{tag> | ||