1. Introduction

This tutorial will show how to flash U-Boot on Iomega iConnect using JTAG.
It is based on my own experience as I broke U-Boot by improper flashing using serial cable and tftp server.

You might found already one tutorial here http://hardsoftmix.blogspot.com/2011/07/jtag-on-iconnect.html, it is written for OpenOCD 0.40 and works fine if you will use this version and your JTAG interface is working with it like Amontec JTAGkey-Tiny.

Since I bought my own JTAG interface JTAG-lock-pick Tiny 2, which support is included since OpenOCD 0.61 and this version has some changes in command names which makes it incompatible with old scripts, I decided to write my own tutorial. Additionally I will use OpenOCD on Windows.

2. Hardware and software used

Serial Interface based on board PL-2303 which originally was an USB cable for some old Nokia phone.

JTAG interface used:
- JTAG-lock-pick Tiny 2 (manual, drivers, eeprom) - based on latest high speed version of FT232HL chip, works with OpenOCD 0.61 and higher
- Amontec JTAGkey-Tiny - based on FT2232L, works with OpenOCD 0.40 and higher
- ZL30PRG (copy of ST-Link v1) - works with OpenOCD 0.61 and higher but only with ST ARMs so it is useless for iConnect (checked)
- see also supported hardware list on OpenOCD page

Software: OpenOCD Linux / Windows

3. Installing JTAG inteface in Windows

For FTDI chips there are at least four drivers avaliable. You may use:

- FTDI D2XX Direct drivers
- FTDI Virtual COM Port (VCP) drivers
- WinUSB (libusbx.org)
- libusb-win32

It is quite confusing which one to choose.
As I read in manual for JTAG-lock-pick Tiny 2 best option is to use WinUSB drivers so I will use that one.
Amontec JTAGkey-Tiny works with libusb-win32.

Instalation is simple, just connect JTAG to usb wait till system inform you that cannot find a drivers, then install it manually by device manager providing a patch to WinUSB drivers.

In case that you have a problems with installing drivers or want to replace it use Zadig.

4. Installing OpenOCD in Windows

Get latest stable version from www.freddiechopin.info page, for today it is 0.61 and this one will be used in this article.

Unzip it to C: and open openocd-0.6.1 folder.

We need to add iConnect board definition, download iconnect.cfg and copy it to to C:\openocd-0.6.1\scripts\board

Download openocd_iconnect.cfg and copy it to C:\openocd-0.6.1\bin or C:\openocd-0.6.1\bin-x64

I have 64bit Windows 7 and will use bin-x64 since now.

5. Configuration

Open openocd_iconnect.cfg find the line:

# Specify JTAG interface configuration file
source [find interface/ftdi/jtag-lock-pick_tiny_2.cfg]

browse C:\openocd-0.6.1\scripts\interface and find a cfg file whch describes yours interface and replace name.

6. Connecting with OpenOCD to board

Hold "Shift" button and right click on bin-x64 folder and choose "Open command line here".

Run:

openocd-x64-0.6.1.exe -f openocd_iconnect.cfg

You should see output similar to this:

D:\openocd-0.6.1\bin-x64>openocd-x64-0.6.1.exe -f openocd_iconnect.cfg
Open On-Chip Debugger 0.6.1 (2012-10-07-10:39)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
adapter_nsrst_delay: 200
jtag_ntrst_delay: 200
adapter speed: 6000 kHz
adapter_nsrst_assert_width: 1000
adapter_nsrst_delay: 200
debug_level: 1
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* feroceon.cpu       feroceon   little feroceon.cpu       running
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x000000d3 pc: 0xffff0000
MMU: disabled, D-Cache: disabled, I-Cache: disabled
background polling: on
TAP: feroceon.cpu (enabled)
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x000000d3 pc: 0xffff0000
MMU: disabled, D-Cache: disabled, I-Cache: disabled

in case that you have got an error like this below, try again.

TARGET: feroceon.cpu - Not halted

Runtime Error: openocd_iconnect.cfg:40:
in procedure 'script'
at file "embedded:startup.tcl", line 58
in procedure 'reset' called at file "openocd_iconnect.cfg", line 40

If still not working go to openocd_iconnect.cfg and comment line reset halt, uncomment reset run and soft_reset_halt.
In case of further problems refer to OpenOCD manual section Reset Configuration.
 

7. Connect to OpenOCD telnet interface.

You may use PuTTY for that.

Configure as follow:

Host Name: 127.0.0.1
Port: 4444
Connection type: Telnet

You may want to save configuration for future usage.

Now click "Open" button, you should see welcome message:

Open On-Chip Debugger
>

8. First method - direct flash U-Boot

Download U-Boot image openwrt-kirkwood-iconnect-u-boot.kwb from:
- OpenWRT trunk http://downloads.openwrt.org/snapshots/trunk/kirkwood/uboot-kirkwood-iconnect/
- or from stable branch http://downloads.openwrt.org/attitude_adjustment/ if already relased.

Save it to C:\openocd-0.6.1\bin-x64

Go to PuTTY session and execute:

iconnect_reflash_uboot

If it works you are lucky,unfortunately it does not work for me. I keep getting error:

nand write 0 openwrt-kirkwood-iconnect-u-boot.kwb 0 oob_softecc_kw
timed out while waiting for target halted
error executing hosted NAND write
Unable to write data to NAND device
failed writing file openwrt-kirkwood-iconnect-u-boot.kwb to NAND flash 0 at offset 0x00000000

So I found second option.

9. Second method - booting U-Boot in RAM and flashing image using it.

Download U-Boot image openwrt-kirkwood-iconnect-u-boot.kwb from:
- OpenWRT trunk http://downloads.openwrt.org/snapshots/trunk/kirkwood/uboot-kirkwood-iconnect/
- or from stable branch http://downloads.openwrt.org/attitude_adjustment/ if already relased.

This is alternative to direct flashing which is not working in my case.
We will run U-Boot in RAM and flash it's image using U-Boot itself and tftp server.

You need:
- serial cable installed and connected to board serial port
- download tftpd server ZIP file from here http://tftpd32.jounin.net/

9.1 Prepare network card settings

Go to Start -> Control Pannel -> Network and Sharing Center -> Local Area connection -> Properties -> Internet Protocol Version 4(TCP/IPv4)

Choose "Use the following IP address" and set:

IP address: 192.168.1.5
Sybnet mask: 255.255.255.0

Confirm by clicking OK.

9.2 Prepare tftpd server

Extract zip to c:\tftpd, create folder c:\tftpd\files.

Copy downloaded openwrt-kirkwood-iconnect-u-boot.kwb to c:\tftpd\files.

Run tftpd, click "Settings" button, choose TFTP tab and set "Base Directory" to c:\tftpd\files, click OK button.

Check if Server interface is 192.168.1.5, if not choose it from the list.

9.3 Runing U-Boot from RAM.

Establish Connection with board as described in point 6 and 7.

Using PuTTY connect to your serial cable, put window in visible area and monitor it.

In OpenOCD telnet connection (established in point 7) run:

Open On-Chip Debugger
> iconnect_load_uboot_bin

you should see this:

target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x000000d3 pc: 0xffff0000
MMU: disabled, D-Cache: disabled, I-Cache: disabled
use of EmbeddedICE dbgrq instead of breakpoint for target halt disabled
400620 bytes written at address 0x00600000
downloaded 400620 bytes in 18.702635s (20.918 KiB/s)
>

Then on serial console you will see booting U-Boot:

U-Boot 2012.10 (Feb 12 2013 - 18:24:56) Iomega iConnect

SoC:   Kirkwood 88F6281_A0
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  512 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   egiga0
Warning: failed to set MAC address

Hit any key to stop autoboot:  0 
iconnect =>

Press enter key as soon as you will see "Hit any key to stop autoboot".

9.4 Configure basic env variables

We need to set server address and iConnect address to establish communication.

In Serial console execute:

setenv ethaddr '00:D0:01:01:01:01'
setenv serverip 192.168.1.5
setenv ipaddr 192.168.1.200

then:

mw 0x0800000 0xffff 0x100000 
nand erase 0x0 0x100000
tftp 0x0800000 openwrt-kirkwood-iconnect-u-boot.kwb
nand write 0x0800000 0x0 0x100000

Here is an output which you will see:

iconnect => setenv ethaddr '00:D0:01:01:01:01'
iconnect => setenv serverip 192.168.1.5
iconnect => setenv ipaddr 192.168.1.200
iconnect => mw 0x0800000 0xffff 0x100000
iconnect => nand erase 0x0 0x100000

NAND erase: device 0 offset 0x0, size 0x100000
Erasing at 0xe0000 -- 100% complete.
OK

iconnect => tftp 0x0800000 openwrt-kirkwood-iconnect-u-boot.kwb
Using egiga0 device
TFTP from server 192.168.1.5; our IP address is 192.168.1.200
Filename 'openwrt-kirkwood-iconnect-u-boot.kwb'.
Load address: 0x800000
Loading: ############################
done
Bytes transferred = 401136 (61ef0 hex)

iconnect => nand write 0x0800000 0x0 0x100000

NAND write: device 0 offset 0x0, size 0x100000
 1048576 bytes written: OK

Now reset it by executing:

reset

After reset the blue LED should start blinking and on serial console you will see U-Boot boot messages.

That's all your iConnect is unbricked.

10. Post rescue procedure.

You should set basic env settings by executing:

setenv ethaddr '00:D0:##:##:##:##' #Put here your real MAC address
setenv serverip 192.168.1.5
setenv ipaddr 192.168.1.200
saveenv

For OpenWRT installation instructions see go to its Wiki.

 

 

 

 

 

# notes

“nand erase 0 0×0 0xa0000” - preserve the u-boot environment variables,

Flash Map

0x000000 0x0c0000 - U-Boot

0x0a0000 0x040000 - U-Boot Env settings

0x000000 0x100000 - cały U-Boot

0x800000 ram start

 

 

 

 

5. Needed scripts

6. Flasing U-Boot

More knowledge:

http://hardsoftmix.blogspot.com/2011/07/jtag-on-iconnect.html

 

   
© Paweł Woźniak