I successfully used almost identical config (just without reset) with STM32H7 
devices.

From the technical point of view there is very interesting that nonsense zero 
DPIDR is read without an error. Curiously this behaviour is possible just by 
the capacity of input when SWDIO signal has a weak pull-down instead of 
recommended pull-up. I connected 15 pF capacitor from SWDIO to GND (no target 
connected) and got the exactly same output
~~~
Info : SWD DPIDR 0x00000000
~~~
SWDIO charges to '1' when adapter sends 'Park' bit and then gets discharged 
gradually by weak pull-down. The first bit of ACK field reads as '1', all 
subsequent read as '0' and we get ACK OK and zero data with correct even parity.

Check cabling, I would guess SWCLK is not connected.


---

** [tickets:#367] Raspberry Pi 4 through SWD with STM32F4x (version: 0.12.0)**

**Status:** new
**Milestone:** 0.11.0
**Labels:** raspberry pi 4 stm32f4x 
**Created:** Sat Oct 08, 2022 10:35 AM UTC by René 
**Last Updated:** Sat Oct 08, 2022 10:35 AM UTC
**Owner:** nobody


Hello,

I got problems to get OpenOCD 0.12.0 running with a Raspberry Pi 4 and a 
STM32F401 microcontroller.
I tested the SWD configuration with a Raspberry Pi 2 where I was succesfull. 
Now after also reading some threads, I adapted my configuration to the RPi4 but 
it still stops at this point:

~~~
 Open On-Chip Debugger 0.12.0-rc1+dev-00023-gae937791d (2022-10-04-23:20)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 2001 kHz
Info : SWD DPIDR 0x00000000


Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
~~~

My Pin configuration is:
Function | GPIO|
---------- | ---------- | 
nRST     | 13       | 
SWDCLK      | 24       | 
SWDIO      | 25       | 

My raspberrypi2-native.cfg looks like this:
~~~
# SPDX-License-Identifier: GPL-2.0-or-later

#
# Config for using Raspberry Pi's expansion header
#
# This is best used with a fast enough buffer but also
# is suitable for direct connection if the target voltage
# matches RPi's 3.3V and the cable is short enough.
#
# Do not forget the GND connection, pin 6 of the expansion header.
#

adapter driver bcm2835gpio

bcm2835gpio peripheral_base 0xFE000000

# Transition delay calculation: SPEED_COEFF/khz - SPEED_OFFSET
# These depend on system clock, calibrated for stock 700MHz
# bcm2835gpio speed SPEED_COEFF SPEED_OFFSET
bcm2835gpio speed_coeffs 236181 60

# Each of the JTAG lines need a gpio number set: tck tms tdi tdo
# Header pin numbers: 23 22 19 21
adapter gpio tck -chip 0 11
adapter gpio tms -chip 0 25
adapter gpio tdi -chip 0 10
adapter gpio tdo -chip 0 9

# Each of the SWD lines need a gpio number set: swclk swdio
# Header pin numbers: 23 22
adapter gpio swclk -chip 0 24
adapter gpio swdio -chip 0 25

# If you define trst or srst, use appropriate reset_config
# Header pin numbers: TRST - 26, SRST - 18

# adapter gpio trst -chip 0 7
# reset_config trst_only

adapter gpio srst -chip 0 13
reset_config srst_only srst_push_pull

# or if you have both connected,
# reset_config trst_and_srst srst_push_pull
~~~

And my openocd.cfg like that:

~~~
source [find interface/raspberrypi2-native.cfg]
transport select swd

set CHIPNAME stm32f401
source [find target/stm32f4x.cfg]

reset_config  srst_nogate

adapter srst delay 100
adapter srst pulse_width 100

init
targets
reset halt
flash erase_sector 0 0 7
flash write_bank 0 test_fw.bin 0
reset
shutdown
~~~

Did anyone manage to get OpenOCD 0.12.0 running on a RPi4?
Thanks in advance!





---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to