Saturday, August 27, 2011

Debug TI PandaBoard with JTAG using BusBlaster V2 and OpenOCD

Before to start, you need to download OpenOCD 0.5.0 and built it with libftdi support, tested on windows XP SP3 & Ubuntu 10.10. For information default BusBlasterV2 JTAG Key v1.3 buffer logic just work fine.

Step 1) Download & Build OpenOCD 0.5.0 for windows/linux:
  1. Download OpenOCD 0.5.0 source
  2. Download libftdi-0.19 source
  3. For Windows only: Download & Install lib-usb windows and attach it to USB Serial Converter A(Interface0)
  4. Download & Install Yagarto ARM Tool chain for debug
  5. How To Build OpenOCD on Windows cygwin or Linux
Step2) OpenOCD configuration for BusBlaster v2

busblaster.cfg file or OpenOCD 0.5.0 (to be copied in openocd interface directory):
#
# Bus Blaster
#
# http://dangerousprototypes.com/docs/Bus_Blaster
#

interface ft2232
ft2232_device_desc "Dual RS232-HS"
ft2232_layout jtagkey
ft2232_vid_pid 0x0403 0x6010
Step3) Connect JTAG BusBlaster v2 to PandaBoard:

Pandaboard BusBlasterv2.jpg
Pandaboard JTAG connected to BusBlaster v2
Pandaboard JTAG & BusBlaster v2 Pinout:
Bus Blaster v2 vs Panda Board
BusBlasterV2 JTAG PandaBoard JTAG
VTG VIO_1V8 (Pin 5)
GND DGND (Pin 4)
TRST H_JTAG_NTRST (Pin 2)
TDI H_JTAG_TDI (Pin 3)
TMS H_JTAG_TMS (Pin 1)
TCK H_JTAG_TCK (Pin 11)
RTCK H_JTAG_RTCK (Pin 9)
TDO H_JTAG_TDO (Pin 7)
Other JTAG pins are not connected.

Pandaboard JTAG.png
Extract of PandaBoard JTAG pinout from OMAP(TM) 4 PandaBoard System Reference Manual Revision 0.4 September 22, 2010 DOC-21010

Step4) Start OpenOCD 0.5.0:
  1. Power ON PandaBoard (without SD Card) & BusBlaster V2.
  2. Launch mintty or standard cygwin shell.
  3. Launch openocd
openocd -f interface\busblaster.cfg -f board\ti_pandaboard.cfg
Example error if libftdi is not installed with libusb:
openocd -f interface/busblaster.cfg -f board/ti_pandaboard.cfg
Open On-Chip Debugger 0.5.0 (2011-08-13-19:03)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.berlios.de/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
RCLK - adaptive
Using dbgbase = 0x80000000
force hard breakpoints
trst_only separate trst_push_pull
Error: unable to open ftdi device: device not found
in procedure 'init'
If you have such type of error go in libusb-win32-bin-1.2.5.0\bin Launch inf-wizard.exe and attach all devices with VendorID=0x0403 & ProductID=0x6010.
You should obtain such log when all work fine:
openocd -f interface/busblaster.cfg -f board/ti_pandaboard.cfg
Open On-Chip Debugger 0.5.0 (2011-08-13-19:03)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.berlios.de/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
RCLK - adaptive
Using dbgbase = 0x80000000
force hard breakpoints
trst_only separate trst_push_pull
Info : max TCK change to: 30000 kHz
Info : RCLK (adaptive clock speed)
Info : JTAG tap: omap4430.jrc tap/device found: 0x3b95c02f (mfg: 0x017, part: 0xb95c, ver: 0x3)
Info : JTAG tap: omap4430.dap enabled
Polling target failed, GDB will be halted. Polling again in 100ms
Polling target failed, GDB will be halted. Polling again in 300ms
Info : JTAG tap: omap4430.m30_dap enabled
Polling target failed, GDB will be halted. Polling again in 700ms
Info : JTAG tap: omap4430.m31_dap enabled
Info : omap4430.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : omap4430.m30: hardware has 6 breakpoints, 4 watchpoints
Info : omap4430.m31: hardware has 6 breakpoints, 4 watchpoints
Polling succeeded again
Now you can start to debug you PandaBoard with ARM GDB commands(using Yagarto or other):
arm-none-eabi-gdb.exe
target remote localhost:3333
monitor halt
You should obtain such log if all work fine:
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses /gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show  copying" and "show warranty" for details.
This GDB was configured as "--host=i686-pc-mingw32 --target=arm- none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x00000000 in ?? ()
(gdb) monitor halt
target state: halted
target halted in Thumb state due to debug-request, current mode:  Supervisor
cpsr: 0x60000173 pc: 0x0002dc92
MMU: disabled, D-Cache: disabled, I-Cache: enabled
For other gdb commands type help. For openocd commands help type monitor help.

For other details on BusBlaster v2 see
http://dangerousprototypes.com/docs/Bus_Blaster
 


EvalBot (Stellaris) and Android Open Accessory Development Kit (ADK) Demo


EvalBot and Android Open Accessory (ADK) Hack

I have just finished to develop an USB Host Driver for Android Open Accessory on EvalBot (it should work also with any other Stellaris ARM chipset supporting USB OTG).

The video demo with link below show how it's easy and fun to communicate with EvalBot with a modern Android Phone (with Android version 2.3.4 or more) like my Samsung Google Nexus S.

About Hardware Hack:
The EvalBot USB Host Power Supply has been hacked in this demo because by default it does not work with Usb Host which require more than 100/150mA (due to limitation of hardware) and so I have modified USB Power supply to use external power in order to connect any USB Host compliant with USB specification which allow current until 500mA.
This Hack also work with any hardware because it's done on a Usb Extension and a BreadBoard with External PowerSupply.

About Software:
For Android software I have used DemoKit which is just a rebuild of sample in official Android NDK package.
For EvalBot I have developed the Usb Host driver for Open Accessory and an example which communicate with DemoKit, the code use Texas Instrument UsbLib and is built under CodeComposer v4.2.4.
What feature included for this demo:
  1. With EvalBot if you press Button Switch1 or 2 it send the button state to DemoKit.
  2. With DemoKit you can send command (Relay1 or 2) to switch On/Off EvalBot Leds(Led1 & 2).
PS:I plan to cleanup the whole driver and source and push the source code on a GitHub for free and fun.


Video: