Reputation: 13
I am trying to use raspberry pi with openocd as a debug probe for TI ARM CC3200 via jtag port on the TI ARM CC3200 board. I got it up and running but I can't get jtag or swd to work. I am new to openocd and hardware hacking in general and feel a bit lost.
I have set up openocd on pi and it is up and running. This is my configuration file
# SPDX-License-Identifier: GPL-2.0-or-later
# Config for Raspberry Pi used as a bitbang adapter.
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html
# Supports all models with 40-pin or 26-pin GPIO connector up to Raspberry Pi 4 B
# also supports Raspberry Pi Zero, Zero W and Zero 2 W.
# Adapter speed calibration is computed from cpufreq/scaling_max_freq.
# Adjusts automatically if CPU is overclocked.
adapter driver bcm2835gpio
proc read_file { name } {
if {[catch {open $name r} fd]} {
return ""
}
set result [read $fd]
close $fd
return $result
}
proc measure_clock {} {
set result [exec vcgencmd measure_clock arm]
set clock_hz [lindex [split $result "="] 1]
expr { $clock_hz / 1000 }
}
proc get_max_cpu_clock { default } {
set clock [read_file /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq]
if { $clock > 100000 } {
return $clock
}
# cpufreq not available. As the last resort try Broadcom's proprietary utility
if {![catch measure_clock clock] && $clock > 100000} {
return $clock
}
echo "WARNING: Host CPU clock unknown."
echo "WARNING: Using the highest possible value $default kHz as a safe default."
echo "WARNING: Expect JTAG/SWD clock significantly slower than requested."
return $default
}
set compat [read_file /proc/device-tree/compatible]
set clocks_per_timing_loop 4
if {[string match *bcm2711* $compat]} {
set speed_offset 52
} elseif {[string match *bcm2837* $compat] || [string match *bcm2710* $compat]} {
set speed_offset 34
} elseif {[string match *bcm2836* $compat] || [string match *bcm2709* $compat]} {
set speed_offset 36
} elseif {[string match *bcm2835* $compat] || [string match *bcm2708* $compat]} {
set clocks_per_timing_loop 6
set speed_offset 32
} else {
set speed_offset 32
echo "WARNING: Unknown type of the host SoC. Expect JTAG/SWD clock slower than requested."
}
set clock [get_max_cpu_clock 2000000]
set speed_coeff [expr { $clock / $clocks_per_timing_loop }]
# Transition delay calculation: SPEED_COEFF/khz - SPEED_OFFSET
# The coefficients depend on system clock and CPU frequency scaling.
bcm2835gpio speed_coeffs $speed_coeff $speed_offset
# Each of the JTAG lines need a gpio number set: tck tms tdi tdo
# Header pin numbers: 23 24 19 21
adapter gpio tck -chip 0 11
adapter gpio tms -chip 0 8
adapter gpio tdi -chip 0 10
adapter gpio tdo -chip 0 9
adapter gpio swdio -chip 0 11
adapter gpio swclk -chip 0 8
adapter speed 5000
transport select jtag
For target config I have used this text
When I run it with `pi_jtag@raspberrypi:~/config $ openocd -f /home/pi_jtag/config/rpi_config.cfg -f target/ti_cc32xx.cfg
I get this error for transport select jtag
:
pi_jtag@raspberrypi:~/config $ openocd -f /home/pi_jtag/config/rpi_config.cfg -f target/ti_cc32xx.cfg
Open On-Chip Debugger 0.12.0-g4d87f6dca (2023-08-11-07:45)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
jtag
0
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 1000 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: cc32xx.jrc: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : starting gdb server for cc32xx.cpu on 3333
Info : Listening on port 3333 for gdb connections
and this for transport select swd
:
typi_jtag@raspberrypi:~/config $ openocd -f /home/pi_jtag/config/rpi_config.cfg -f target/ti_cc32xx.cfg
Open On-Chip Debugger 0.12.0-g4d87f6dca (2023-08-11-07:45)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
swd
0
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 1000 kHz
Error: Error connecting DP: cannot read IDR
I have doublecheck the wiring and it is correct. The chip uses 3.3 volts the same as pi. I want to know how to get rid of this errors. Thank you for your help.
Upvotes: 0
Views: 262
Reputation: 1
Which Raspberry Pi are you using? If it's Raspberry Pi 3 Model B like I have, you need to use the gray ALT function pin numbers in your .cfg. I'm using pins 22-27 GPIO pin functions
Upvotes: 0