This guide will walk you through connecting the Flyswatter2 and the BeagleBone Black board to your Linux PC, and installing and running OpenOCD. This guide was written with Ubuntu 12.04 LTS.
- 1 Connecting the Flyswatter2 to the BeagleBone Black
- 1.1 Locate the connector pads for P2 on the back side of the BeagleBone Black board
- 1.2 Take note of P2 pin numbers
- 1.3 Center the cTI 20-pin male header pins on the P2 pads.
- 1.4 Ensure the missing pin is aligned to the key pad
- 1.5 Solder each pin of the male header to the board
- 1.6 Double check the cTI 20-pin connector and make sure it is vertical to the surface of the BeagleBone Black
- 1.7 Attach the four standoffs to the back of the BeagleBone Black board
- 1.8 Connect the ARM20cTI20 JTAG Adapter to the BeagleBone Black Board.
- 1.9 Connect the 20-pin ribbon cable to the ARM20cTI20 JTAG Adapter
- 1.10 Position the 20-pin ribbon cable coming from the ARM20cTI20 JTAG Adapter
- 1.11 Connect the 20-Pin Ribbon Cable to the Flyswatter2.
- 2 Installing OpenOCD
- 3 The BeagleBone Black Config File
- 4 Running OpenOCD
- 5 Common OpenOCD Commands
- 6 Setting up Eclipse for ARM Cross-Development and Debugging
Connecting the Flyswatter2 to the BeagleBone Black
To connect the Flyswatter2 and the BeagleBone Black, you will need the following:
- Flyswatter2 USB JTAG Debugger
- ARM20cTI20 – ARM 20-pin to cTI 20-pin JTAG Adapter Board
- 20-pin ribbon cable
- USB Male A/Male B Cable (included with the Flyswatter2)
- mini USB Cable assembly (included with the BeagleBone Black)
Locate the connector pads for P2 on the back side of the BeagleBone Black board
Locate P2 on the back side of the BeagleBone Black board.
The BeagleBone Black board comes from the factory without the 20-pin male JTAG header installed. In order to use JTAG with the BeagleBone Black board you must hand solder the cTI 20-pin male JTAG header onto the back of the BeagleBone Black board at location P2 (circled in yellow).
Take note of P2 pin numbers
Note the locations of the following pins: pin #1 and especially pin #6 which is marked: “KEY–“. You will use the “KEY” pin to correctly position the 20-pin unshrouded male header (cTI 20-pin).
Center the cTI 20-pin male header pins on the P2 pads.
Align the cTI 20-pin unshrouded male header so that the missing pin on the male header is aligned with pin #6 marked as “KEY–“.
Make sure the connector pins are centered on the P2 surface mount pads on the pcb.
Ensure the missing pin is aligned to the key pad
Notice how the missing pin on the male header is positioned to align with the 3rd pad from the bottom right (the key pad).
Solder each pin of the male header to the board
Make sure each pin of the 20-pin male header is centered on each surface mount pad on P2. Then using a low wattage soldering iron, heat each individual pin at the junction of the male pin and the P2 surface mount pad and apply a small amount of lead-free solder. You must use lead-free solder to maintain the board’s RoHS (lead-free) status. Use the minimum amount of heat to get the solder flowing and make a good electrical connection. Over heating the pin can cause the male header plastic base to melt and ruin the connector. There is no need to heat pin #6 (the key pin) since it is not connected.
After you complete soldering all of the pins, double check each pin and make sure there is no solder shorts between adjacent pins. You can use a cotton tipped swab or small toothbrush dipped in isopropyl alcohol to clean and remove any residual solder flux. Removing the sold flux from the board is optional. The solder flux will not cause any electrical problems with the board. Cleaning the board is simply to improve the looks of the board.
Double check the cTI 20-pin connector and make sure it is vertical to the surface of the BeagleBone Black
The cTi 20-pin male header should be positioned vertically on the BeagleBone Black board like it is shown in this photo.
Make sure there are no solder shorts between any pins on the male header. Also, if you cleaned the board with isopropyl alcohol, make sure all of the isopropyl alcohol has evaporated and the the BeagleBone Black board is completely dry before applying any power to the board.
Attach the four standoffs to the back of the BeagleBone Black board
To protect the unshrouded 20-pin male JTAG header from damage we must raise the BeagleBone Black board up off the surface. This is accomplished by attaching the four standoffs to the back of the BeagleBone Black board using the four #4-40 machine screws.
The four hex standoffs are 1 inch long. This raises up the BeagleBone Black board up high enough so that the ARM20cTI20 JTAG Adapter board will clear the surface.
Connect the ARM20cTI20 JTAG Adapter to the BeagleBone Black Board.
Plug the ARM20cTI20 JTAG adapter board into the male header at location P2. Make sure you align the key to the missing pin on the cTI20 male header.
Connect the 20-pin ribbon cable to the ARM20cTI20 JTAG Adapter
Plug the 20-pin ribbon cable into the ARM20cTI20 JTAG adapter board.
Position the 20-pin ribbon cable coming from the ARM20cTI20 JTAG Adapter
Flip the BeagleBone Black board over so that its upright. Fold the 20-pin ribbon cable so that its positioned as shown in the photo to the left. This will orient the ribbon cable connector so that it will easily plug into the Flyswatter2’s JTAG connector.
Connect the 20-Pin Ribbon Cable to the Flyswatter2.
Plug the 20-pin ribbon cable into the Flyswatter2.
Plug the mini USB cable into the BeagleBone Black and the other end into the PC.
Plug the USB cable into the Flyswatter2 and the other end into the PC. The green LED should illuminate and indicate power is on.
OpenOCD (Open On-Chip Debugger) is open-source software that interfaces with the BeagleBone Black. OpenOCD provides debugging and in-system programming for embedded target devices. You will need to compile OpenOCD from source. For instructions, see the guide below:
The BeagleBone Black Config File
OpenOCD uses specific configuration files for different devices. The config file for the Flyswatter2 is included with OpenOCD. A config file for the Beaglebone Black is also included, but it isn’t compatible with the file for the Flyswatter2. Download the config file below:
Save the file into OpenOCD’s /board/ directory. If you followed the compile guide above, you can find the /board/ directory at
Now you are ready to run OpenOCD. If you compiled OpenOCD yourself following the guide above, open a terminal window and enter:
cd ~/openocd-bin sudo ./openocd -f interface/flyswatter2.cfg -f board/ti_beaglebone_with_fs2.cfg -c init -c "reset init"
Your terminal window should now look something like this:
Pay careful attention to this line:
Info : JTAG tap: am335x.jrc tap/device found: 0x1b94402f (mfg: 0x017, part: 0xb944, ver: 0x1)
If you don’t see that, you have an error of some kind. Refer to [OpenOCD Troubleshooting] and try again.
JTAG-DP_STICKY_ERROR on startup
The -c init -c “reset init” commands in the OpenOCD startup are a workaround for a bug in OpenOCD that affects the Beagleboard product line. If you start OpenOCD without these commands, you will see errors like this:
If you see these errors, then the next time you try to start OpenOCD it will give an error the next time it tries to communicate with the BeagleBone Black. When you exit OpenOCD you will need to disconnect and reconnect the power cable to the Flyswatter2 before OpenOCD will be able to communicate with the board again.
You cannot enter commands directly into OpenOCD. Open a new terminal window and start a telnet session by typing:
telnet localhost 4444
You will should see this prompt:
You can give commands to OpenOCD through this prompt.
Common OpenOCD Commands
To see a full list of OpenOCD commands, enter help in the telnet window.
Resets the BeagleBone Black. The output of the Reset command should look like this:
You can also use halt followed by a time in milliseconds. OpenOCD waits for the target to halt the specified amount of time, then gives up if the target has not halted. You can use this to avoid OpenOCD hanging because the BeagleBone Black fails to halt. For example, to send a halt command with a timeout of one second, type:
Enter resume to end a halt. You will not see any text output in the telnet window.
Displays a numbered list of all of the BeagleBone Black’s registers.
Run reg with a register number to display the contents of a register, in hexadecimal. The register number corresponds to the output of the reg command with no arguments, above. You must run the halt command before reading registers.
If you run reg while the BeagleBone Black is not halted, you will still see the value stored in the register. However, registers change contents very quickly while the device is running; by the time you see the value, the value actually in the register may be different. If you try to run reg while the device is not halted, you will see this:
reg [entry] [value]
Sets the value of a register. The register number corresponds to the output of the reg command with no arguments, above. Make sure the BeagleBone Black is halted (with the halt command) before you change the value of a register!
You can enter registry values in either decimal, by typing a number by itself, or in hexadecimal, by prefacing the value with 0x.
Shuts down OpenOCD cleanly. Also ends your Telnet session. Use this to exit OpenOCD instead of Ctrl-C.
Setting up Eclipse for ARM Cross-Development and Debugging
For information on setting up cross-development toolchain, Eclipse, and GDB Debugger for use with the BeagleBone Black, see the following guide: