SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By AALLeeXX
#191548
Hello,

I' m trying to use openOCD 0.9.0 on linux (Ubuntu 16.04) to connect to my PI2 with the FTDI RPi HUB Module. That module is very similar to the TFDI FT2232H mini-module (it just provides an additional USB HUB: I do not use it yet).

When starting openOCD, It cannot get connected properly:
Code: Select all
alex@ALeX-VirtualBox:~$ openocd -f RPi_HUB_Module.cfg -f raspi2.cfg 
Open On-Chip Debugger 0.9.0 (2015-09-02-10:42)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
jtag
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: bcmrpi2.dap: IR capture error; saw 0x0f not 0x01
Warn : Bypassing JTAG setup events due to errors
Warn : Invalid ACK 0x7 in JTAG-DP transaction
Warn : Invalid ACK 0x7 in JTAG-DP transaction
.../...
The first configuration file contains:
Code: Select all
#
# FTDI RPi HUB Module

interface ftdi
ftdi_device_desc "FT2232H RPi HUB Module"

ftdi_channel 0
ftdi_vid_pid 0x0403 0x6010

transport select jtag
The second one:
Code: Select all
telnet_port 4444
#TODO: Verify gdb setup works as intended.
#TODO: With the command "cache_config" we could configure the L2 cache and avoid the problem which occurs if you wait too long to connect via JTAG...
gdb_port 3333
#tcl_port 0 #No Tcl port needed...

#jtag_khz 1000 #Not needed?
adapter_khz 1000

if { [info exists CHIPNAME] } {
        set  _CHIPNAME $CHIPNAME
} else {
        set  _CHIPNAME bcmrpi2
}

if { [info exists DAP_TAPID] } {
        set _DAP_TAPID $DAP_TAPID
} else {
        set _DAP_TAPID 0x4ba00477
}

jtag newtap $_CHIPNAME dap -expected-id $_DAP_TAPID -irlen 4 -ircapture 0x01 -irmask 0x0f

set _TARGETNAME0 $_CHIPNAME.cpu0
set _TARGETNAME1 $_CHIPNAME.cpu1
set _TARGETNAME2 $_CHIPNAME.cpu2
set _TARGETNAME3 $_CHIPNAME.cpu3

target create $_TARGETNAME0 cortex_a -chain-position $_CHIPNAME.dap -coreid 0 -dbgbase 0x80010000
target create $_TARGETNAME1 cortex_a -chain-position $_CHIPNAME.dap -coreid 1 -dbgbase 0x80012000
target create $_TARGETNAME2 cortex_a -chain-position $_CHIPNAME.dap -coreid 2 -dbgbase 0x80014000
target create $_TARGETNAME3 cortex_a -chain-position $_CHIPNAME.dap -coreid 3 -dbgbase 0x80016000
target smp $_TARGETNAME0 $_TARGETNAME1 $_TARGETNAME2 $_TARGETNAME3

$_TARGETNAME0 configure -event gdb-attach {
        cortex_a dbginit
}
$_TARGETNAME1 configure -event gdb-attach {
        cortex_a dbginit
}
$_TARGETNAME2 configure -event gdb-attach {
        cortex_a dbginit
}
$_TARGETNAME3 configure -event gdb-attach {
        cortex_a dbginit
}
The PI2 board is properly configured in JTAG mode (connected GPIO are in JTAG mode) since when I use FTDI examples program I can get some outputs which seem correct - at least not all ones or all zeroes unlike with openOCD above...
I'm very new to openOCD and have no exact idea of what could be wrong.
Is it possible openOCD has a driver conflict with the FTDI D2xx driver - preventing a proper connection ?
On the PI2 board, is there anything special to do more than just enabling the GPIO in JTAG mode ?

Thanks in advance for any hint...
Alexandre
Last edited by AALLeeXX on Mon Sep 12, 2016 4:04 am, edited 2 times in total.
By AALLeeXX
#191565
I should add the following: when I use the FTDI D2xx driver's examples program, I can see the JTAG signald activity: the clock TCK, TDI and TDO are properly generated by both the RPi HUB Module and the PI2 board. This, at least, validates the connections and the PI2 GPIO configuration in JTAG mode.
When I starts openOCD, I cannot see any signal activity, even the clock just keeps stuck high. I finally even do not understand how openOCD cann reports all ones or all zeroes without any generated clock.
Thus I guess something very simple just block openOCD, but cannot figure out what...