Flyswatter2 Beagleboard How To

From eLinux.org
Revision as of 02:36, 18 April 2012 by Wmat (Talk | contribs) (Adding proper categories)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This guide will walk you through connecting the Flyswatter2 and the Beagleboard to your Linux PC, and installing and running OpenOCD. This guide was written with Ubuntu 10.04.


Connecting the Flyswatter2 and the Beagleboard

To hook up the Flyswatter2 and the Beagleboard, you will need:

  • Flyswatter2
    • USB Male A/Male B cable
    • 14-pin JTAG Ribbon Cable
  • Beagleboard
    • 5V1A Power Supply
  • Beagleboard Adapter Kit (product link)
    • 20-pin ARM to 14-pin TI JTAG Adapter Board
    • RS-232 Adapter Board
    • 10-pin Ribbon Cable


Set the EMU pins on the JTAG Adapter Board.

Ti adapter.png
The EMU0 and EMU1 pins should be set to 1. Set both jumpers to the position closest to the 14-pin interface, as in the picture.


Connect the JTAG Adapter Board to the Flyswatter2.

Fs2 ti adapter.png
Connect the 20-pin end of the adapter board to the Flyswatter2's JTAG interface.


Connect the 14-pin Ribbon Cable to the JTAG Adapter Board.

Fs2 ti jtag.png
Your cable most likely has a notch on the head to force it into the correct position. If it doesn't, align Pin 1 on the ribbon cable with the side of the board opposite the EMU pins. (In the picture, Pin 1 is marked by the red stripe on the cable.)


Connect the RS-232 adapter board to the Flyswatter2.

Take the RS-232 adapter board provided in the Beagleboard adapter kit, and connect it to the Flyswatter2's serial UART interface. Flyswatter2 ti rs232 adapters.png

Connect the 10-pin cable to the Flyswatter2.

The adapter board above allows you to connect the 10-pin ribbon cable in the Beagleboard adapter kit to the Flyswatter2. Do that now. Pay careful attention to the position of the red stripe. The red stripe should line up with the "1" printed on the adapter board, as in the picture below.

Fs2 jtag14serial10.png

Connect the other end of the 10-pin cable to the Beagleboard.

Connect the 10-pin RS-232 cable to the pins to the side of the Beagleboard, the ones next to the power adapter. Make sure the cable is correctly centered over the pins, and again pay attention to the red stripe. It should match up with the "1" printed on the Beagleboard.

Fs2 Beagle 10pin.png

Connect the JTAG cable to the Beagleboard.

Connect the free end of the 14-pin ribbon cable to the diagonal pins on the Beagleboard. Make sure the red stripe lines up with the "1" printed next to the pins on the Beagleboard, like in the picture.

Fs2 beagle bothcables.png

Important: The JTAG pins on the Beagleboard have no plastic housing to force the cable into the correct position. If you connect the cable backwards, powering the board may damage the JTAG interface. Make sure the ribbon cable is connected correctly before proceeding!

Beagle jtag wrong.png Beagle jtag wrong2.png Beagle jtag correct.png

Connect the USB cable to the Flyswatter2.

Find the USB cable that comes with the Flyswatter. Connect the B end (the square end, not the flat end) to the Flyswatter.

Fs2 usb.png

Connect the power supply to the Beagleboard.

Connect the 5V1A power supply to the Beagleboard. (Your power supply may not look exactly like the one pictured.)

Beagle power.png

Plug the power cable into a surge protector or wall outlet.

Green LEDs should light up on the Beagleboard to indicate that it is receiving power.

Plug the USB cable into your PC's USB port.

You should see the green LED on the Flyswatter2 light up, to indicate that the Flyswatter2 is receiving power through the USB connection.


Installing OpenOCD

OpenOCD (Open On-Chip Debugger) is open-source software that interfaces with the Flyswatter2. OpenOCD provides debugging and in-system programming for embedded target devices. You will need to compile OpenOCD from source, and patch the source with one of the OpenOCD Patches for Flyswatter 2 support.

Whichever guide you use, be sure to install the patch! Both guides include instructions on downloading and installing the patch.


Compiling OpenOCD Linux - This set of instructions uses libFTDI, an open-source driver library for FTDI devices.

Compiling OpenOCD Linux D2XX - This set of instructions uses FTDXX, a closed-source driver library from Future Technology Devices International.


Running OpenOCD

Now you are ready to run OpenOCD. If you installed the OpenOCD Ubuntu package, open a terminal window and type the following from any directory:

openocd -f interface/flyswatter2.cfg -f board/ti_beagleboard.cfg -c init -c "reset init"


If you compiled OpenOCD yourself, navigate to the openocd-bin directory you created in the compile guide and type:

cd ~/openocd-bin
sudo ./openocd -f interface/flyswatter2.cfg -f board/ti_beagleboard.cfg -c init -c "reset init"


For more information, see Running OpenOCD on Linux. When you start OpenOCD, its output should look like this:

Fs2 beagle linux ocdstartup.png

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 and TI Beagleboard XM. If you start OpenOCD without these commands, you will see errors like this:

Fs2 beagle linux ocderr.png

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 Beagleboard. When you exit OpenOCD you will need to disconnect and reconnect the power cable to the Flyswatter before OpenOCD will be able to communicate with the Beagleboard again.

JTAG Tap Unexpected Errors

On startup you may sometimes encounter this error:

Info : JTAG tap: omap3530.jrc tap/device found: 0x000000ff (mfg: 0x07f, part: 0x0000, ver: 0x0)
Warn : JTAG tap: omap3530.jrc       UNEXPECTED: 0x000000ff (mfg: 0x07f, part: 0x0000, ver: 0x0)
Error: JTAG tap: omap3530.jrc  expected 1 of 1: 0x0b7ae02f (mfg: 0x017, part: 0xb7ae, ver: 0x0)

This output means OpenOCD has failed to initialize the JTAG chain. The -c init -c "reset init" commands are a partial workaround for this error. Look for the following line later in the output:

 Info : JTAG tap: omap3530.jrc tap/device found: 0x0b7ae02f (mfg: 0x017, part: 0xb7ae, ver: 0x0)

If you see this line, everything is fine.

Troubleshooting

Getting OpenOCD to initialize JTAG correctly with the Beagleboard is sometimes difficult. If you are having difficulties beyond those described above, consult the troubleshooting page below.

Beagleboard Troubleshooting: JTAG Tap Unexpected

Telnet Connection

You cannot enter commands directly to OpenOCD. Open a new terminal window and type:

telnet localhost 4444

You will should see this prompt:

Telnet.png

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.

reset

Resets the Beagleboard. The output of the Reset command should look like this:

Reset.png

halt

Sends a halt request to the Beagleboard. If the Beagleboard halts, you will see text output in the telnet window. (If the Beagleboard is already halted, you will see no output.)

Halt.png

halt [timeout]

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 Beagleboard fails to halt. For example, to send a halt command with a timeout of one second, type:

halt 1000

resume

Enter resume to end a halt. You will not see any text output in the telnet window.

reg

Displays a numbered list of all of the Beagleboard's registers.

Reg.png

reg [entry]

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.

Reg0.png

If you run reg while the Beagleboard 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:

Reg0 not halted.png


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 Beagleboard 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.

Regset.png


GDB Debugger

GDB, the GNU Project Debugger is a debugging tool provided with the GNU Compiler Collection (GCC). GDB allows you to stop and start a running program, examine its functioning, and make changes. GDB is installed on Ubuntu 10.04 by default, but you will need a different version of GDB build for embedded targets. Follow the instructions on the GDB Debugger page below.

GDB Debugger

The GDB debugger page will walk you through installing GDB for use with OpenOCD, and loading and testing a simple program.