I'm trying to flash a cortex m0 based SoC from a Raspberry Pi 3 Compute Module GPIOs but it keeps failing with the same error.
Error: Could not initialize the debug port
I'm following this https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi?view=all and this tutorials https://movr0.com/2016/09/02/use-raspberry-pi-23-as-a-jtagswd-adapter/. Compilation and install happens without issues.
The cortex m0 SoC is a Nordic Semiconductor nRF51822 bluetooth chip packaged in ISP1302 module.
The module GND and 3.3V are wired directly to the Compute module dev-kitand SWDCLK and SWDIO are wired on the GPIO 25, 24 as per tutorials. There's no connection for SRST or TRST.
The configuration file is as follows:
source [find interface/raspberrypi2-native.cfg]
bcm2835gpio_swd_nums 25 24
transport select swd
# target
source [find target/nrf51.cfg]
init
targets
(and I removed bcm2835gpio_srst_num 18
from the raspberrypi2-native.cfg)
executing with sudo openocd -f config.cfg
The raspberry Pi CM3 is running with the option core_freq=250
on /boot/config.txt
and I need this option to reliably access UART1. I thought it could be something related to the clock, but not sure how to change/fix if it is.
I've tried several combinations of reset_config
nothing changed the error. The full initialization stack is as follows:
Open On-Chip Debugger 0.10.0+dev-00111-gca9dcc8 (2017-04-24-15:30)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
BCM2835 GPIO nums: swclk = 25, swdio = 24
cortex_m reset_config sysresetreq
adapter speed: 1000 kHz
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : SWD only mode enabled (specify tck, tms, tdi and tdo gpios to add JTAG mode)
Info : clock speed 1001 kHz
Info : SWD DPIDR 0x00150634
Error: Could not initialize the debug port
TargetName Type Endian TapName State
-- ------------------ ---------- ------ ------------------ ------------
0* nrf51.cpu cortex_m little nrf51.cpu unknown
No matter what I tried I always get this "Error: Could not initialize the debug port".
Interesting enough, using a ST-Link/V2 adapter connected to the PI USB and modifying the interface
on the configuration it works without issues.
Any suggestions? What am I doing wrong? Is there some initialization on the GPIO needed?
edit:
I've noticed someone voted to close the question as "unclear what's asking".
I'm asking: How can I connected the Raspberry Pi to a nRF51 SoC using its GPIO? Refer above everything I tried.
reset_config
also. The error "Could not initialize the debug port" is always there. Regardless! – Tuner-d3
option. – Vesica