Ethernut Home Hardware Firmware Tools Download Community
 
 
Search | Legals | Deutsch

EIR JTAG

To our knowledge the best low cost solution so far is to use OpenOCD with any FT2232 based adapter hardware. OpenOCD will work on many platforms and several adapters from different vendors are available, which are using the FTDI chip. Some products are listed at the end of this page.

We are using the Turtelizer 2. However, its JTAG connector follows the AVR 10-pin layout. A special adapter is required to connect it to the 20-pin standard connector that is used on the EIR board.

Installing OpenOCD on Windows

Warning: You must have the USB driver available before attaching your JTAG adapter to a USB port.

OpenOCD binaries for Windows (including USB drivers) are available on Freddie Chopin's homepage.

A special version for the Turtelizer 2 can be found on our download page.

Connect one end of the USB cable to the PC USB port and the other to the USB connector on the JTAG adapter. Windows will automatically detect the new Turtelizer hardware. Concurrently the first screen of the Found New Hardware Wizard appears. Follow the instruction. Make sure that the option Specify a location is selected and deselect all others. Officially supported drivers are located in the subdirectory driver within the OpenOCD installation directory. You should also consult the documentation which is available for your specific adapter.

The following screenshots show the Turtelizer 2 driver installation.

FTDI USB Driver Installation Step 1 FTDI USB Driver Installation Step 2 FTDI USB Driver Installation Step 3 FTDI USB Driver Installation Step 4 FTDI USB Driver Installation Step 5 FTDI USB Driver Installation Step 6 FTDI USB Driver Installation Step 7
FTDI USB Driver Installation Step 8 FTDI USB Driver Installation Step 9 FTDI USB Driver Installation Step 10 FTDI USB Driver Installation Step 11 FTDI USB Driver Installation Step 12 FTDI USB Driver Installation Step 13 FTDI USB Driver Installation Step 14

Installing OpenOCD on Linux

The OpenOCD source code can be retrieved from the SVN repository at developer.berlios.de/svn .

$ svn co -r 423 svn://svn.berlios.de/openocd/trunk openocd-r423
The included README file contains a detailed description. A few essential tools are required to create the binaries. The following commands may be used on Debian to make sure that all tools are available:
$ sudo apt-get install build-essential
$ sudo apt-get install automake
$ sudo apt-get install autoconf
If not already installed, we further need the FTDI support library. There are two variants, we chose the one supplied by FTDI:
$ wget http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx0.4.13.tar.gz
$ tar -zxf libftd2xx0.4.13.tar.gz
$ sudo cp *.h /usr/local/include/
$ sudo cp libftd2xx.so.0.4.13 /usr/local/lib/
$ cd /usr/local/lib/
$ sudo ln -s libftd2xx.so.0.4.13 libftd2xx.so
$ sudo ln -s libftd2xx.so.0.4.13 libftd2xx.so.0
$ cd /usr/lib/
$ ln -s /usr/local/lib/libftd2xx.so.0.4.13 libftd2xx.so.0
/etc/fstab (sudo):
none /proc/bus/usb usbdevfs defaults,mode=0666 0 0
(use usbfs in 2.6 kernels, 'uname -a')
$ sudo mount -a
In the next step we can build OpenOCD, using
$ cd openocd-r423/
$ ./bootstrap
$ ./configure  --enable-ft2232_ftd2xx
$ make
$ sudo make install

The following entry should appear in /proc/bus/usb/devices after plugging in the Turtelizer 2:

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0403 ProdID=bdc8 Rev= 5.00
S:  Manufacturer=egnite
S:  Product=Turtelizer JTAG/RS232 Adapter
S:  SerialNumber=TLQ08BET
C:* #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=83(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

Installing OpenOCD on Mac OS X

Right now we do not have a binary package for OS X. Thus, we need to build OS X from the source code. If not already done, download Xcode from
developer.apple.com/tools/xcode/ and install it. Xcode contains all the GNU tools, which are needed to create the OpenOCD binary from the source code.

FTDI Disk Image Download the Mac OS X driver from
www.ftdichip.com/Drivers/D2XX.htm
The driver is packed in a disk image file. Double click it to mount the image.

To install the driver, execute the following commands in a Terminal window:

$ cd /Volumes/PPC\ D2XX/D2XX/
$ sudo mkdir -p /usr/local/lib /usr/local/include
$ sudo cp bin/libftd2xx.0.1.0.dylib /usr/local/lib/
$ sudo ln -sf /usr/local/lib/libftd2xx.0.1.0.dylib /usr/local/lib/libftd2xx.dylib
$ sudo cp bin/ftd2xx.h /usr/local/include/
$ sudo cp Samples/WinTypes.h /usr/local/include/

Retrieve the OpenOCD source code from the SVN repository at developer.berlios.de/svn . For this, open Terminal and enter:

$ svn co -r 423 svn://svn.berlios.de/openocd/trunk openocd-r423

Building and installing OpenOCD for OS X is similar to Linux. In a Terminal window enter:

$ cd openocd-r423/
$ ./bootstrap
$ ./configure  --enable-ft2232_ftd2xx
$ make
$ sudo make install

Flashing the Firmware

In order to familliarize yourself with flashing firmware into the EIR, we will go step by step through the whole process.

You should create a new empty folder to work with. Everything goes into it, and every command you enter has to be run out of this folder.

First copy your binary into the folder. In this document we suggest you use the internetradio, which can be downloaded as a sample with the following link:
eir-bin_1_1_0.bin

Second download the configfile for OpenOCD. If you're not using the Turtlelizer2 you need to modify it.
eirocd.cfg

Now connect the Turtleizer2 with the special adapter and the special adapter to the EIR.
chain setup

We start with erasing the old firmware. On the EIR board connect pins 34 and 36 of K3 (Port C) using a 2.54 mm jumper. Press the reset button and remove the jumper. This activates the SAM-BA boot loader.
Firmware löschen

To get access to our board with OpenOCD, we need to start OpenOCD with the proper config file. OpenOCD usually looks for a file called openocd.cfg, because you might use some of our other products too, we gave it names that resemble the specific product. To load config files with a different name use -f or --file if you like. Now we open our preferred command line interpreter, CLI for short (maybe you call it Dos-Box, Text Terminal, Shell, Console...), and enter:

$ openocd -f eirocd.cfg

Because OpenOCD blocks our last CLI we need to start another one. After, we've sucessfully started OpenOCD, we need to connect through OpenOCD to the board with Telnet using localhost and the port specified in eirocd.cfg.

$ telnet 127.0.0.1 4444

The CPU is already running, so we need to pause it with halt.

> halt

Now we need to detect flash bank 0. This can be done with flash probe which has the following syntax:

flash probe <bank>
Because we want to detect bank 0 we do:
> flash probe 0

We need to write the binary eir-bin_1_1_0.bin to bank 0 at offset 0. According to the syntax of the command flash write_bank

flash write_bank <bank> <file> <offset>
this should work:
> flash write_bank 0 eir-bin_1_1_0.bin 0

The at91sam7 has 2 boot modes, booting from ROM and booting from Flash, so we neet to set the boot mode:

at91sam7 gpnvm <bank> <bit> <set|clear>
boot modeflag
Flash set
ROM clear
> at91sam7 gpnvm 0 2 set

Finally to get the EIR to boot from Flash just reset it.

External Links

JTAG Adapters

We intentionally do not recommend any specific adapter for the EIR. Before buying one, make sure, that it fully supports your operating system and the AT91SAM7SE512 CPU.

www.amontec.com
Amontec is specialized on JTAG adapters, most of them are officially supported by OpenOCD.

microcontrollershop.com
MicroController Pros Corporation runs an online shop, which offers a large variety of JTAG adapters from different vendors.

www.olimex.com
Olimex is well known for its low prices. They offer two different JTAG adapters.

www.signalyzer.com
Xverve Technologies Inc. offers the Signalyzer Tool.

www.zylin.com
If you are fed up with software installation und USB driver mess, the ZY1000 is probably for you. It is actually a small Linux system, running OpenOCD internally. You can directly connect to it via TCP/IP, for example, using a common webbrowser. Of course, this luxury has its price.

Return to the EIR project page.