Introduction: JTAGulating the Raspberry Pi 2
This instructable will cover how to get a root recovery console on a Raspberry Pi 2 with a NOOBS SD card using a Jtagulator, PuTTY, and three wires. It is thanks to the Instructables Raspberry Pi Build Night sponsored by Instructables and the Rabbit Hole.
What you will need:
- Jtagulator found @ https://www.parallax.com/product/32115
- Raspberry Pi 2
- USB A to USB Mini cable
- NOOBS SD Card (came with Raspberry Pi 2 from instructables)
Step 1: Wiring Up
- [Pic 1] Place your fresh NOOBS SD card into the sd card reader on your Raspberry Pi 2.
[Pic 2] Connect wires to the GND (Pin 1), CH0 (Pin 2), and CH1 (Pin 4) pins on the first header of your Jtagulator
[Pic 3] Connect the other ends of these wires to GND (Pin 6), GPIO14 TXD (Pin 8), and GPIO15 RXD (Pin 10) on your Raspberry Pi 2 GPIO header.
Make sure to use the same wire for both GND connections, the order of the other two are not quite as important, as you will soon see.
Step 2: Setting Up the Session
Connect your Jtagulator to a USB port on your local computer and open your favorite terminal software. For the purpose of this tutorial, I am using PuTTY on a Windows machine.
- On the PuTTY 'Session' settings:
Change 'Connection Type' to Serial
Change 'Speed' to 115200
Change 'Serial line' to which ever serial port your Jtagulator was picked up on. In my case, this was COM12. If you don't know how to find out which serial port a device is on, there are many guides online for your particular operating system.
Step 3: Optional Echo
- Click "Terminal' on the 'Category' treeview on the left side of the PuTTY Configuration dialog.
- Change the Line Discipline option 'Local Echo' to 'Force on'.
- The Jtagulator doesn't echo back the characters we are going to send it. To make things a little easier to see we can enable a local echo for the next few steps so we can see what we are doing.
Step 4: Jtagulator Setup
Click the 'Open' button on the PuTTY Configuration dialog
- Jtagulator greets you with a very helpful blank screen. [Pic 1]
- Hit the H key then Enter [Pic 2]
Ah, there we go! A command list. We start by setting the target system voltage. [Pic 3]
- Hit the V key then Enter. Type 3.3 then Enter
Now our JTagulator is set up to use the same voltages that the Raspberry Pi 2 uses.
Step 5: Finding the UART
Remember when I said the order of the two non-ground wires didn't matter? One of the features of the Jtagulator is that it can attempt all possible uart wiring and speed permutations to discover a serial port by brute force.
- Hit the U key and Enter to 'Identify UART Pinout'
- Hit Enter again to select the default [CR] (carriage return) as the test string that the Jtagulator will send out on each permutation.
- Hit 2 and Enter to select 2 as the number of channels to use. [Pic 1]
If we didn't know which pins on the Raspberry Pi 2 were our serial port, we could use more channel / more wires here to scan more possibilities. You get the idea.
- Hit the spacebar [Pic 2]
Here is the last part of all of the text the Jtagulator has sent us while scanning for a UART. As you scroll through them all, take a look at the 'Data:' In my example here, the only one that spit out anything that looks human readable is the last one.
TXD: 0 RXD: 1 Baud: 115200 Data: ..Password: [ same in hex ]
From this we can tell that if we set our Jtagulator to use Channel 0 as TX and Channel 1 as RX at a speed of 115200 baud - we get some kind of login prompt from the Raspberry Pi 2
Step 6: Passing Through
- Hit P then Enter to set up serial pass through mode
- Hit 0 then Enter to set the TX channel to Channel 0
- Hit 1 then Enter to set the RX channel to Channel 1
- Type 115200 to set the baud rate to 115200
We are now interacting directly with the serial port on the Raspberry Pi 2
- Remove and replace the Raspberry Pi 2's power cord to reboot the Raspberry Pi 2 [Pic 2]
We see the Linux Kernel booting up and a recovery console login prompt!
Step 7: EEcchhoo OOffff
Unlike the Jtagulator, the Raspberry Pi 2 terminal will echo back everything we type. To make it easier to see what we are doing I am going to turn off the local echo. [Pic 1]
- Right click the icon in the upper left hand corner of the PuTTY window
- Click 'Change Settings' [Pic 2]
- Click 'Terminal' in the treeview on the left hand side of the PuTTY configuration dialog
- Change the line discipline option for 'Local Echo' to 'Auto'
- Click the 'Apply' button
Step 8: Logging In
The default login for the NOOBS recovery console is root:raspberry so
- Type root and enter at the 'recovery login:' prompt
- Type raspberry and enter at the 'Password:' prompt
Step 9: Recovery
You are in!
Here I have issued a few simple commands showing that this is indeed a fully functional shell.
Pretty awesome! No SD card funny business, and we never connected a keyboard, mouse, monitor, or even a network cable to our Raspberry Pi 2!