Debug Board v2

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m (Debug Board moved to Neo1973 Debug Board v2: This is only about the 2nd revision of the Debug Board for Neo1973 (GTA01 / GTA02))
(Exchg bootloader with U-Boot)
 
(29 intermediate revisions by 16 users not shown)
Line 1: Line 1:
The [[Debug Board | Debug Board page]] provides information on the architecture of the second version of the [[Debug Board | Neo1973 debug board]].
+
{{Languages|Debug Board v2}}
 
+
[[Image:Debugboard v2 diagram.png|left|500px|Architecture Diagram]]
+
 
+
[[Image:Neo1973 debugboard v2 top annotated.jpg|left|500px|Annotated PCB Photograph]]
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
  
 +
{{Dboard}}
  
  
 +
This page provides information on the architecture of the second version of the Neo1973 debug board (the one shipped with the "Advanced" [[Neo 1973]] kits).
  
 +
[[Image:Debugboard v2 diagram.png|left|500px|Architecture Diagram]]
  
 +
[[Image:Neo1973 debugboard v2 top annotated.jpg|left|500px|Annotated PCB Photograph]]
  
  
Line 27: Line 16:
 
The [[Debug Board | debug board]] provides these key components.
 
The [[Debug Board | debug board]] provides these key components.
  
* [[Debug Board#USB Hub | USB Hub]]
+
* [[Debug Board v2#USB Hub | USB Hub]]
* [[Debug Board#JTAG using FT2232 | JTAG using FT2232]]
+
* [[Debug Board v2#JTAG using FT2232 | JTAG using FT2232]]
* [[Debug Board#Serial Port | Serial Port]]
+
* [[Debug Board v2#Serial Port | Serial Port]]
 +
 
 +
=== Schematics ===
 +
 
 +
The Schematics of this board can be found at http://people.openmoko.org/laforge/doc/hardware/neo1973_debug_board/neo1973_debugboard_v2_schematics.pdf
  
 
=== USB Hub ===
 
=== USB Hub ===
  
This bus-powered hub  
+
This bus-powered hub
 
* attaches to the laptop using its upstream port
 
* attaches to the laptop using its upstream port
 
* attaches to the FT2232D for JTAG and serial console on downstream port 1
 
* attaches to the FT2232D for JTAG and serial console on downstream port 1
* attaches to a free USB-A connector using downstream port 2
+
* attaches to USB-A connectors using downstream ports 2 and 3
* attaches to the phone using downstream port 3
+
  
Using the hub, you can have access to the phone, JTAG and serial simultaneously, through a single USB cable.
+
For the USB hub we use the TUSB2046B chip.
  
You can actually even charge the phone (100mA slow charge) using that downstream port.
+
Using the hub, you can have access to the phone, JTAG and serial simultaneously, through a single USB cable. You can actually even charge the phone (100mA slow charge) using that downstream port.
  
For the ISB hub function, we use the TUSB2046B chip.
+
If you have 2 free USB ports on your PC, it is better to plug the debug board and the Neo1973 into the PC independently (rather than using the hub). This will allow the Neo1973 to charge at the full 500mA rate, and will also allow the debug-board USB to be unplugged/reconnected without affecting the Neo1973.
  
 
=== JTAG using FT2232 ===
 
=== JTAG using FT2232 ===
  
Basically, we integrate a USB-JTAG adaptor similar to the [Amontec JTAGkey-tiny].  The actual reference design that we used (Thanks to Joern!) can be found at http://www.oocdlink.com
+
Basically, we integrate a USB-JTAG adaptor similar to the [[Amontec JTAGkey-tiny]].  The actual reference design that we used (Thanks to Joern!) can be found at http://www.oocdlink.com
  
 
This provides us full JTAG debugging, at about 150times the speed of the [[wiggler]]
 
This provides us full JTAG debugging, at about 150times the speed of the [[wiggler]]
Line 59: Line 51:
  
 
Instead of replicating a true RS232 port, we wanted to use a USB serial converter chip,
 
Instead of replicating a true RS232 port, we wanted to use a USB serial converter chip,
such as the FT232 or the PL2303.  
+
such as the FT232 or the PL2303.
  
 
As it turns out, we can even use the second port of the FT2232 simultaneously with the JTAG.  So no extra FT232 or PL2303 is required.
 
As it turns out, we can even use the second port of the FT2232 simultaneously with the JTAG.  So no extra FT232 or PL2303 is required.
Line 73: Line 65:
 
==== FT2232D EEPROM ====
 
==== FT2232D EEPROM ====
  
Your Debug Board contains a small serial EEPROM which should be flashed correctly during production.  However, some boards have received incorrect/incomplete programming during production and thus you should verify this.
+
Please see [[Neo1973 Debug Board v2/EEPROM]] if you have an "early adopter" board with USB ID 0403:0610. If your board shows up as USB ID 1457:5118 then you can ignore this step.
  
If the board shows up as USB ID 1457:5118, then everything is correct.
+
==== Drivers ====
  
Only if your board shows up as USB ID 0403:6010, then you will need to flash the board!
+
===== libftdi =====
  
===== Flashing with Linux =====
+
Please make sure you have libftdi-0.8 or later.  Earlier versions are known to cause problems. This should not be an issue if you are using statically-linked binaries.
  
{{note|FIC has done that for you, in case you have officially been supplied with the board.  However, if you are one of the early adopters, the configuration and USB vendorID / productID might have not yet been set correctly.}}
+
===== ftdi_sio module =====
  
In order to do so, you can use the ftdi_eeprom program from
+
This module must be loaded with parameters that identify the debug board:
http://www.intra2net.com/de/produkte/opensource/ftdi/. Unfortunately, the latest version (0.2) doesn't yet contain support for our FT2232D, so you need the patch from http://people.openmoko.org/laforge/misc/debug_board_v2/ftdi_eeprom/ftdi_eeprom-0.2-moko.patch
+
  
You may also need to apply the following patch to libftdi:
+
rmmod ftdi_sio
http://people.openmoko.org/werner/libftdi-c56-strings-dirty-hack.patch
+
modprobe ftdi_sio vendor=0x1457 product=0x5118
(See http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=321 for additional details.)
+
  
Furthermore, you will need the EEPROM config:
+
or the equivalent in your modules.conf
http://people.openmoko.org/laforge/misc/debug_board_v2/ftdi_eeprom/neo1973_debug_board_v2.ftdi
+
  
Once you have compiled ftdi_eeprom, you can run
+
====== udev rule ======
ftdi_eeprom --flash-eeprom neo1973_debug_board_v2.ftdi
+
  
{{warning|Make sure you don't have any other FTDI FT232 / FT2232 based devices attached to the USB while running ftdi_eeprom. It might be wise to disconnect everything but the debug board}}
+
Please install the rules from http://people.openmoko.org/laforge/misc/debug_board_v2/udev_rules/
  
You should get something like the following printout if everything was successful:
+
====== Windows Driver ======
<pre>
+
FTDI eeprom generator v0.2
+
(c) Intra2net AG <opensource@intra2net.com>
+
FTDI init: 0
+
Unable to find FTDI devices under given vendor/product id: 0x1457/0x5118
+
Retrying with default FTDI id.
+
Used eeprom space: 102 bytes
+
FTDI write eeprom: 0
+
Writing to file: neo1973_debug_board_v2.eeprom
+
FTDI close: 0
+
</pre>
+
  
Once the flashing has finished, just disconnect and reconnect, and you should see
+
Please use the driver from http://people.openmoko.org/laforge/misc/debug_board_v2/windows_drivers/
<pre>
+
$ lsusb -v -d 0x1457:                                                                                                                                                                                              
+
Bus 005 Device 009: ID 1457:5118 
+
Device Descriptor:
+
  bLength                18
+
  bDescriptorType        1
+
  bcdUSB              2.00
+
  bDeviceClass            0 (Defined at Interface level)
+
  bDeviceSubClass        0
+
  bDeviceProtocol        0
+
  bMaxPacketSize0        8
+
  idVendor          0x1457
+
  idProduct          0x5118
+
  bcdDevice            5.00
+
  iManufacturer          1 OpenMoko
+
  iProduct                2 Debug Board for Neo1973
+
  iSerial                0
+
  bNumConfigurations      1
+
  [...]
+
</pre>
+
  
===== Flashing with Windows =====
+
==== Applications ====
{{note|FIC has done that for you, in case you have officially been supplied with the board.  However, if you are one of the early adopters, the configuration and USB vendorID / productID might have not yet been set correctly.}}
+
  
In order to do so, you can use the FTDI Mprog program from http://www.ftdichip.com/Resources/Utilities/MProg3.0_Setup.exe
+
===== openocd =====
+
You will need
+
* The EEPROM Template http://people.openmoko.org/laforge/misc/debug_board_v2/mprog_template/neo1973_debugboard_v2.ept
+
  
==== Drivers ====
+
[[openocd]] is required. It is recommended to use a statically-linked binary produced by the Openmoko build system. Other versions may give "unrecognized command" errors while parsing the configuration file.
  
===== Linux =====
+
====== openocd.cfg ======
  
Please make sure you have libftdi-0.8 or later.  Earlier versions are known to cause problems
+
Openocd requires a configuration file in the directory from which you run the application. A typical example is shown below:
  
Furthermore, you will need to do the following:
+
<pre>
 +
telnet_port 4444
 +
gdb_port 3333
 +
interface ft2232
 +
jtag_speed 0
 +
ft2232_vid_pid 0x1457 0x5118
 +
ft2232_layout "jtagkey"
 +
reset_config trst_and_srst
 +
jtag_device 4 0x1 0xf 0xe
 +
daemon_startup attach
 +
target arm920t little reset_run 0 arm920t
 +
working_area 0 0x200000 0x4000 backup
 +
run_and_halt_time 0 5000
 +
ft2232_device_desc "Debug Board for Neo1973"
 +
</pre>
  
====== ftdi_sio module option ======
+
===== dfu-util =====
  
rmmod ftdi_sio
+
[[dfu-util]] is used to write images to the NAND flash once you have a functional u-boot. It is recommended to use a statically-linked binary produced by the Openmoko build system.
modprobe ftdi_sio vendor=0x1457 product=0x5118
+
  
or the equivalent in your modules.conf
+
=== Hardware connection ===
  
====== udev rule ======
+
Refer to [[Connecting Neo1973 with Debug Board v2]]. The recommended connection sequence is:
  
Please install the rules from http://people.openmoko.org/laforge/misc/debug_board_v2/udev_rules/
+
* Unplug both USB cables
 +
* Remove the Neo1973 battery
 +
* Connect the FPC between the Neo1973 and the debug board
 +
* Replace the Neo1973 battery
 +
* Plug the Neo1973 USB cable into your PC
 +
* If the Neo1973 does not turn on automatically at this point, hold the power button for 5 seconds
 +
* Plug the debug-board USB cable into your PC
  
===== Windows =====
+
A Neo1973 with a working u-boot should power on when its USB cable is plugged in, but a "bricked" one will not. Note that there will be no visible feedback from the power-button press on a bricked device.
  
Please use the driver from http://people.openmoko.org/laforge/misc/debug_board_v2/windows_drivers/
+
==== Pinouts ====
  
=== Hardware connection ===
+
The Debug Board v2 may be used for other embedded projects. It provides the following connectors:
  
* [[Connecting Neo1973 with Debug Board v2]]
+
* J1 - is a regular 20 pin ARM JTAG at 3.3V level with 5V tolerance
 +
 
 +
* J10 - is a 3.3V serial connected to portB of the FTDI2232D
 +
<pre>
 +
pin name
 +
1  TXD
 +
2  RXD
 +
3  RTS
 +
4  CTS
 +
5  DSR
 +
6  DTR
 +
7  DCD
 +
8  RI
 +
9  GND
 +
10  VCC (3.3V)
 +
</pre>
  
 
=== Actually using it ===
 
=== Actually using it ===
Line 174: Line 161:
 
===== Serial Port =====
 
===== Serial Port =====
  
The Linux kernel of your host system will create a virtual serial device called '''/dev/ttyUSBx''' where 'x' is a sequentially assigned number.  If you don't have any other USB serial converters attached to your machine, the device name will be '''/dev/ttyUSB0'''.
+
The Linux kernel of your host system will create virtual serial devices called '''/dev/ttyUSBx''' where 'x' is a sequentially assigned number.  If you don't have any other USB serial converters attached to your machine, the device name will be '''/dev/ttyUSB1''' for the serial port. A '''/dev/ttyUSB0''' will also be created initially, but will disappear once [[openocd]] connects to the JTAG port.
  
You can use your favourite terminal emualtor (minicom, cu, zc, ...) just like for any other/real serial port. You may use gdb as well (eg. target remote /dev/ttya).
+
You can use your favourite terminal emulator (screen, minicom, cu, zc, ...) just like for any other/real serial port. The baud rate should be set to 115200. You may use gdb as well (eg. target remote /dev/ttya).
 +
 
 +
The /dev/ttyUSB1 device node will be removed if the debug-board USB cable is unplugged. You should exit your terminal program before unplugging the cable, and then re-run it after the cable is plugged back in.
 +
 
 +
'''Note'''
 +
 
 +
After Neo's boot, this last line will be displayed at the console:
 +
 
 +
gta01-pm-gsm gta01-pm-gsm.0: powering up GSM, thus disconnecting serial console
 +
 
 +
for reconnecting your serial console, please stop the gsmd daemon from ssh :
 +
 
 +
/etc/init.d/gsmd stop
 +
 
 +
and respawn getty on ttySAC0.
 +
 
 +
For example, if getty is on tty1 (given by: '''ps -aux | grep getty''') then you could type:
 +
cd /dev
 +
mv tty1 tty10
 +
ln -s ttySAC0 tty1
 +
pkill getty
 +
 
 +
if kernel messages on the console are too verbose, use klogd or dmesg (e.g. '''klogd -c 4''').
  
 
===== JTAG =====
 
===== JTAG =====
  
Once you have installed libftdi >= 0.8 and configured [[OpenOCD]] with the correct openocd.cfg from [[OpenOCD#openocd.cfg]], it should work just fine.
+
Once you have connected the hardware as described above, run "openocd" from the diretory containing its configuration file. You should see output similar to the following:
 +
 
 +
linux$ ./openocd
 +
Info:    openocd.c:93 main(): Open On-Chip Debugger 1.0 (2007-12-13-14:05) svn:226M
 +
Info:    openocd.c:94 main(): $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $
 +
Info:    jtag.c:1291 jtag_examine_chain(): JTAG device found: 0x0032409d (Manufacturer: 0x04e, Part: 0x0324, Version: 0x0)
 +
 
 +
Note that the Neo1973 must be powered on for this step to succeed. Otherwise, you will see:
 +
 
 +
Error:  jtag.c:1253 jtag_examine_chain(): JTAG communication failure, check connection, JTAG interface, target power etc.
 +
Error:  jtag.c:1440 jtag_init(): trying to validate configured JTAG chain anyway...
 +
Error:  jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR mismatch, scan returned 0x00
 +
 
 +
Once openocd is running, open another terminal window and connect to its telnet port:
 +
 
 +
linux$ telnet localhost 4444
 +
Trying 127.0.0.1...
 +
Connected to localhost.
 +
Escape character is '^]'.
 +
Open On-Chip Debugger
 +
>
 +
 
 +
You may now reset the device, set breakpoints, upload images, etc.
 +
 
 +
===== Unbricking Procedure =====
 +
 
 +
Refer to [[Neo1973 Debug Board v2/Unbricking]] for a manual procedure to re-flash a "bricked" phone (one with a damaged u-boot or environment, where the normal [[Flashing the Neo 1973]] update procedure cannot be used).
 +
 
 +
===== Further Reading =====
 +
 
 +
The following Wiki pages contain useful information about what can be done with the debug board and the u-boot console. Note, however, that some of the information applies to earlier versions of the product and is not suitable for use with purchased GTA01Bv4 phones.
 +
 
 +
- [[OpenOCD#OpenOCD_and_Debug_Board]]
 +
 
 +
- [[U-Boot#Using_JTAG_to_boot_from_RAM]]
 +
 
 +
- [[Devirginator]]
  
Please see [[OpenOCD#OpenOCD_and_Debug_Board]] for some more information.
+
- [[NAND_bad_blocks]]
  
 
== History ==
 
== History ==
  
We previously had [[Neo1973 Debug Board v1]] (inherited from some weird engineers who must have seen Brazil too often).
+
We previously had [[Debug Board v1]]. Version 1 was never shipped to phase-0 or phase-1, and not sold to anyone.
Version 1 was never shipped to phase-0 or phaes-1, and not sold to anyone.
+
  
 
=== Changes from v1 to v2 ===
 
=== Changes from v1 to v2 ===
Line 196: Line 240:
 
* get rid of 7-segment LED displays
 
* get rid of 7-segment LED displays
 
** not really needed.  We have a serial port
 
** not really needed.  We have a serial port
** could be replaced by one or two GPIO LED's
+
** could be replaced by one or two GPIO LEDs
 
* get rid of built-in [[wiggler]]
 
* get rid of built-in [[wiggler]]
 
** nobody has a parallel port on the laptop these days
 
** nobody has a parallel port on the laptop these days
Line 205: Line 249:
 
{{Languages|Debug_Board}}
 
{{Languages|Debug_Board}}
  
 +
[[Category:Debug Board]]
 +
[[Category:Neo1973 Hardware]]
 
[[Category:Neo1973 Hardware Debugging]]
 
[[Category:Neo1973 Hardware Debugging]]

Latest revision as of 09:28, 10 February 2012


Debug Board



This page provides information on the architecture of the second version of the Neo1973 debug board (the one shipped with the "Advanced" Neo 1973 kits).

Architecture Diagram
Annotated PCB Photograph


Contents

[edit] Overview

The debug board provides these key components.

[edit] Schematics

The Schematics of this board can be found at http://people.openmoko.org/laforge/doc/hardware/neo1973_debug_board/neo1973_debugboard_v2_schematics.pdf

[edit] USB Hub

This bus-powered hub

  • attaches to the laptop using its upstream port
  • attaches to the FT2232D for JTAG and serial console on downstream port 1
  • attaches to USB-A connectors using downstream ports 2 and 3

For the USB hub we use the TUSB2046B chip.

Using the hub, you can have access to the phone, JTAG and serial simultaneously, through a single USB cable. You can actually even charge the phone (100mA slow charge) using that downstream port.

If you have 2 free USB ports on your PC, it is better to plug the debug board and the Neo1973 into the PC independently (rather than using the hub). This will allow the Neo1973 to charge at the full 500mA rate, and will also allow the debug-board USB to be unplugged/reconnected without affecting the Neo1973.

[edit] JTAG using FT2232

Basically, we integrate a USB-JTAG adaptor similar to the Amontec JTAGkey-tiny. The actual reference design that we used (Thanks to Joern!) can be found at http://www.oocdlink.com

This provides us full JTAG debugging, at about 150times the speed of the wiggler

The actual JTAG port is connected with

  • the phone (via debug flex cable)
  • A separate 20-pin header using standard ARM-JTAG pinout
    • this allows the user to use this device as JTAG adaptor even for other arm-based devices

[edit] Serial Port

Instead of replicating a true RS232 port, we wanted to use a USB serial converter chip, such as the FT232 or the PL2303.

As it turns out, we can even use the second port of the FT2232 simultaneously with the JTAG. So no extra FT232 or PL2303 is required.

[edit] Tri-State Serial Port

The serial port needs a tri-state driver, since it is both connected to the GSM modem AND to the debug board. We drive the tri-state driver by an inverted GSM_EN signal (pin 7 on FPC connector).

[edit] Usage Instructions

[edit] Preconditions

[edit] FT2232D EEPROM

Please see Neo1973 Debug Board v2/EEPROM if you have an "early adopter" board with USB ID 0403:0610. If your board shows up as USB ID 1457:5118 then you can ignore this step.

[edit] Drivers

[edit] libftdi

Please make sure you have libftdi-0.8 or later. Earlier versions are known to cause problems. This should not be an issue if you are using statically-linked binaries.

[edit] ftdi_sio module

This module must be loaded with parameters that identify the debug board:

rmmod ftdi_sio modprobe ftdi_sio vendor=0x1457 product=0x5118

or the equivalent in your modules.conf

[edit] udev rule

Please install the rules from http://people.openmoko.org/laforge/misc/debug_board_v2/udev_rules/

[edit] Windows Driver

Please use the driver from http://people.openmoko.org/laforge/misc/debug_board_v2/windows_drivers/

[edit] Applications

[edit] openocd

openocd is required. It is recommended to use a statically-linked binary produced by the Openmoko build system. Other versions may give "unrecognized command" errors while parsing the configuration file.

[edit] openocd.cfg

Openocd requires a configuration file in the directory from which you run the application. A typical example is shown below:

telnet_port 4444
gdb_port 3333
interface ft2232
jtag_speed 0
ft2232_vid_pid 0x1457 0x5118
ft2232_layout "jtagkey"
reset_config trst_and_srst
jtag_device 4 0x1 0xf 0xe
daemon_startup attach
target arm920t little reset_run 0 arm920t
working_area 0 0x200000 0x4000 backup
run_and_halt_time 0 5000
ft2232_device_desc "Debug Board for Neo1973"
[edit] dfu-util

dfu-util is used to write images to the NAND flash once you have a functional u-boot. It is recommended to use a statically-linked binary produced by the Openmoko build system.

[edit] Hardware connection

Refer to Connecting Neo1973 with Debug Board v2. The recommended connection sequence is:

  • Unplug both USB cables
  • Remove the Neo1973 battery
  • Connect the FPC between the Neo1973 and the debug board
  • Replace the Neo1973 battery
  • Plug the Neo1973 USB cable into your PC
  • If the Neo1973 does not turn on automatically at this point, hold the power button for 5 seconds
  • Plug the debug-board USB cable into your PC

A Neo1973 with a working u-boot should power on when its USB cable is plugged in, but a "bricked" one will not. Note that there will be no visible feedback from the power-button press on a bricked device.

[edit] Pinouts

The Debug Board v2 may be used for other embedded projects. It provides the following connectors:

  • J1 - is a regular 20 pin ARM JTAG at 3.3V level with 5V tolerance
  • J10 - is a 3.3V serial connected to portB of the FTDI2232D
pin name
1   TXD
2   RXD
3   RTS
4   CTS
5   DSR
6   DTR
7   DCD
8   RI
9   GND
10  VCC (3.3V)

[edit] Actually using it

[edit] On Linux

[edit] Serial Port

The Linux kernel of your host system will create virtual serial devices called /dev/ttyUSBx where 'x' is a sequentially assigned number. If you don't have any other USB serial converters attached to your machine, the device name will be /dev/ttyUSB1 for the serial port. A /dev/ttyUSB0 will also be created initially, but will disappear once openocd connects to the JTAG port.

You can use your favourite terminal emulator (screen, minicom, cu, zc, ...) just like for any other/real serial port. The baud rate should be set to 115200. You may use gdb as well (eg. target remote /dev/ttya).

The /dev/ttyUSB1 device node will be removed if the debug-board USB cable is unplugged. You should exit your terminal program before unplugging the cable, and then re-run it after the cable is plugged back in.

Note

After Neo's boot, this last line will be displayed at the console:

gta01-pm-gsm gta01-pm-gsm.0: powering up GSM, thus disconnecting serial console

for reconnecting your serial console, please stop the gsmd daemon from ssh :

/etc/init.d/gsmd stop

and respawn getty on ttySAC0.

For example, if getty is on tty1 (given by: ps -aux | grep getty) then you could type: cd /dev mv tty1 tty10 ln -s ttySAC0 tty1 pkill getty

if kernel messages on the console are too verbose, use klogd or dmesg (e.g. klogd -c 4).

[edit] JTAG

Once you have connected the hardware as described above, run "openocd" from the diretory containing its configuration file. You should see output similar to the following:

linux$ ./openocd Info: openocd.c:93 main(): Open On-Chip Debugger 1.0 (2007-12-13-14:05) svn:226M Info: openocd.c:94 main(): $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ Info: jtag.c:1291 jtag_examine_chain(): JTAG device found: 0x0032409d (Manufacturer: 0x04e, Part: 0x0324, Version: 0x0)

Note that the Neo1973 must be powered on for this step to succeed. Otherwise, you will see:

Error: jtag.c:1253 jtag_examine_chain(): JTAG communication failure, check connection, JTAG interface, target power etc. Error: jtag.c:1440 jtag_init(): trying to validate configured JTAG chain anyway... Error: jtag.c:1346 jtag_validate_chain(): Error validating JTAG scan chain, IR mismatch, scan returned 0x00

Once openocd is running, open another terminal window and connect to its telnet port:

linux$ telnet localhost 4444 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Open On-Chip Debugger >

You may now reset the device, set breakpoints, upload images, etc.

[edit] Unbricking Procedure

Refer to Neo1973 Debug Board v2/Unbricking for a manual procedure to re-flash a "bricked" phone (one with a damaged u-boot or environment, where the normal Flashing the Neo 1973 update procedure cannot be used).

[edit] Further Reading

The following Wiki pages contain useful information about what can be done with the debug board and the u-boot console. Note, however, that some of the information applies to earlier versions of the product and is not suitable for use with purchased GTA01Bv4 phones.

- OpenOCD#OpenOCD_and_Debug_Board

- U-Boot#Using_JTAG_to_boot_from_RAM

- Devirginator

- NAND_bad_blocks

[edit] History

We previously had Debug Board v1. Version 1 was never shipped to phase-0 or phase-1, and not sold to anyone.

[edit] Changes from v1 to v2

  • get rid of ethernet
    • we don't need it, and
    • we especially don't want a 40pin parallel 66MHz bus going between two pcb's
  • get rid of 7-segment LED displays
    • not really needed. We have a serial port
    • could be replaced by one or two GPIO LEDs
  • get rid of built-in wiggler
    • nobody has a parallel port on the laptop these days
  • get rid of li-ion battery (including charger)
    • the device can be fully usb powered by the laptop

Personal tools

The Debug Board page provides information on the architecture of the second version of the Neo1973 debug board.

Architecture Diagram
Annotated PCB Photograph










Overview

The debug board provides these key components.

USB Hub

This bus-powered hub

  • attaches to the laptop using its upstream port
  • attaches to the FT2232D for JTAG and serial console on downstream port 1
  • attaches to a free USB-A connector using downstream port 2
  • attaches to the phone using downstream port 3

Using the hub, you can have access to the phone, JTAG and serial simultaneously, through a single USB cable.

You can actually even charge the phone (100mA slow charge) using that downstream port.

For the ISB hub function, we use the TUSB2046B chip.

JTAG using FT2232

Basically, we integrate a USB-JTAG adaptor similar to the [Amontec JTAGkey-tiny]. The actual reference design that we used (Thanks to Joern!) can be found at http://www.oocdlink.com

This provides us full JTAG debugging, at about 150times the speed of the wiggler

The actual JTAG port is connected with

  • the phone (via debug flex cable)
  • A separate 20-pin header using standard ARM-JTAG pinout
    • this allows the user to use this device as JTAG adaptor even for other arm-based devices

Serial Port

Instead of replicating a true RS232 port, we wanted to use a USB serial converter chip, such as the FT232 or the PL2303.

As it turns out, we can even use the second port of the FT2232 simultaneously with the JTAG. So no extra FT232 or PL2303 is required.

Tri-State Serial Port

The serial port needs a tri-state driver, since it is both connected to the GSM modem AND to the debug board. We drive the tri-state driver by an inverted GSM_EN signal (pin 7 on FPC connector).

Usage Instructions

Preconditions

FT2232D EEPROM

Your Debug Board contains a small serial EEPROM which should be flashed correctly during production. However, some boards have received incorrect/incomplete programming during production and thus you should verify this.

If the board shows up as USB ID 1457:5118, then everything is correct.

Only if your board shows up as USB ID 0403:6010, then you will need to flash the board!

Flashing with Linux
NOTE: FIC has done that for you, in case you have officially been supplied with the board. However, if you are one of the early adopters, the configuration and USB vendorID / productID might have not yet been set correctly.


In order to do so, you can use the ftdi_eeprom program from http://www.intra2net.com/de/produkte/opensource/ftdi/. Unfortunately, the latest version (0.2) doesn't yet contain support for our FT2232D, so you need the patch from http://people.openmoko.org/laforge/misc/debug_board_v2/ftdi_eeprom/ftdi_eeprom-0.2-moko.patch

You may also need to apply the following patch to libftdi: http://people.openmoko.org/werner/libftdi-c56-strings-dirty-hack.patch (See http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=321 for additional details.)

Furthermore, you will need the EEPROM config: http://people.openmoko.org/laforge/misc/debug_board_v2/ftdi_eeprom/neo1973_debug_board_v2.ftdi

Once you have compiled ftdi_eeprom, you can run

ftdi_eeprom --flash-eeprom neo1973_debug_board_v2.ftdi
WARNING: Make sure you don't have any other FTDI FT232 / FT2232 based devices attached to the USB while running ftdi_eeprom. It might be wise to disconnect everything but the debug board


You should get something like the following printout if everything was successful:

FTDI eeprom generator v0.2
(c) Intra2net AG <opensource@intra2net.com>
FTDI init: 0
Unable to find FTDI devices under given vendor/product id: 0x1457/0x5118
Retrying with default FTDI id.
Used eeprom space: 102 bytes
FTDI write eeprom: 0
Writing to file: neo1973_debug_board_v2.eeprom
FTDI close: 0

Once the flashing has finished, just disconnect and reconnect, and you should see

$ lsusb -v -d 0x1457:                                                                                                                                                                                               
Bus 005 Device 009: ID 1457:5118  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x1457 
  idProduct          0x5118 
  bcdDevice            5.00
  iManufacturer           1 OpenMoko
  iProduct                2 Debug Board for Neo1973
  iSerial                 0 
  bNumConfigurations      1
  [...]
Flashing with Windows
NOTE: FIC has done that for you, in case you have officially been supplied with the board. However, if you are one of the early adopters, the configuration and USB vendorID / productID might have not yet been set correctly.


In order to do so, you can use the FTDI Mprog program from http://www.ftdichip.com/Resources/Utilities/MProg3.0_Setup.exe

You will need

Drivers

Linux

Please make sure you have libftdi-0.8 or later. Earlier versions are known to cause problems

Furthermore, you will need to do the following:

ftdi_sio module option
rmmod ftdi_sio
modprobe ftdi_sio vendor=0x1457 product=0x5118

or the equivalent in your modules.conf

udev rule

Please install the rules from http://people.openmoko.org/laforge/misc/debug_board_v2/udev_rules/

Windows

Please use the driver from http://people.openmoko.org/laforge/misc/debug_board_v2/windows_drivers/

Hardware connection

Actually using it

On Linux

Serial Port

The Linux kernel of your host system will create a virtual serial device called /dev/ttyUSBx where 'x' is a sequentially assigned number. If you don't have any other USB serial converters attached to your machine, the device name will be /dev/ttyUSB0.

You can use your favourite terminal emualtor (minicom, cu, zc, ...) just like for any other/real serial port. You may use gdb as well (eg. target remote /dev/ttya).

JTAG

Once you have installed libftdi >= 0.8 and configured OpenOCD with the correct openocd.cfg from OpenOCD#openocd.cfg, it should work just fine.

Please see OpenOCD#OpenOCD_and_Debug_Board for some more information.

History

We previously had Neo1973 Debug Board v1 (inherited from some weird engineers who must have seen Brazil too often). Version 1 was never shipped to phase-0 or phaes-1, and not sold to anyone.

Changes from v1 to v2

  • get rid of ethernet
    • we don't need it, and
    • we especially don't want a 40pin parallel 66MHz bus going between two pcb's
  • get rid of 7-segment LED displays
    • not really needed. We have a serial port
    • could be replaced by one or two GPIO LED's
  • get rid of built-in wiggler
    • nobody has a parallel port on the laptop these days
  • get rid of li-ion battery (including charger)
    • the device can be fully usb powered by the laptop