Closed svanimisetti closed 7 months ago
There have been a few changes in the config files for openocd 11 and 12. I haven't tested them myself, but as of 11, tigard.cfg should be in interface/ftdi/tigard.cfg. You are correct, there's more than just the tigard cfg. stuff like swd vs jtag varies based on your target, so it can't be a part of the generic tigard cfg.
I'd recommend running something more like:
-f interface/ftdi/tigard.cfg -f target/stm32f4x.cfg
so you can stick to the generic files.
I have used tigard on an stm32 'blue pill' using openocd 10 and only vcc,gnd,swck, and swdio, so i know it should be possible.
my best guess at what's going on with your current issue is that tigard is properly configured, but for some reason, you're not getting the expected response from the stm32. That's why openocd gives you a prompt with none of the 'cpu' commands.
Can you try hooking tigard back up and using the 'targets' command in openocd?
Also - are the reset and swo pins necessary? If so - what are they connected to on tigard?
Do you know if your stm32 is actually running and not currently in reset for some reason?
I disconnected the nRST and SWO pins from Tigard - and tried using generic files using your suggestions. However, I get a different error.
>C:/apps/openocd-v0.12.0/bin/openocd.exe -f interface/ftdi/tigard.cfg -f target/stm32f4x.cfg
Open On-Chip Debugger 0.12.0 (2023-01-14-23:37)
...
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: stm32f4x.cpu: IR capture error; saw 0x0f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: Invalid ACK (3) in DAP response
Perhaps generic/default configuration files are setup for JTAG interface. When I use my custom SWD configuration (after commenting out the last target line), OpenOCD runs, but the output of targets
command is also empty. The STM32 is currently running as I flashed a simple blinky firmware to test/debug this issue - so I can confirm that it is not in reset. I am guessing that I need to manually add the target definition for stm32f4x to get this to work.
oh, oops. The generic file doesn't have the swd/jtag choice, and neither does the generic stm file. I have had multiple inconclusive conversations about this - does the transport select go with the adapter or the target... I have generic, jtag, and swd config files for tigard sitting in my path and use all three of them on different occasions. the one that made it into openocd is the one without the transport selected.
I found that @ruswerner posed a custom configuration for SWD on #63. He was using a rp2040. I tried using his configuration with the stm32f4x target. But even that gave the same original error I reported.
>openocd.exe -f tigard-swd.cfg -f target/stm32f4x.cfg
Open On-Chip Debugger 0.12.0 (2023-01-14-23:37)
...
Error: Error connecting DP: cannot read IDR
good news: you're not the only one with the problem bad news: they didn't solve it
Thanks! I was aware of this issue and researched the steps the OP documented in his post. Nonetheless, I have posted on that thread to see if the OP has an update! I am not sure how the BluePills (stm32f1x) work, but not the discovery board (stm32f4x). Perhaps there are other configuration changes I need to make on the board. Perhaps I will have to dig a little into the OpenOCD scripts for the on-board ST-LINK V2 interface.
Resolved the issue using notes from here and here. I updated the firmware on the discovery board using the STM32CubeProgrammer utility to V2J43M28. Also, made sure the board is only powered using VDD and the USB is disconnected from onboard ST-LINK V2.
Now I am able to use tigard-swd.cfg
posted in #63 with standard target script stm32f4x.cfg
(openocd.exe -f tigard-swd.cfg -f target/stm32f4x.cfg
). Running targets
via OpenOCD now lists the microcontroller.
Open On-Chip Debugger
> targets
TargetName Type Endian TapName State
-- ------------------ ---------- ------ ------------------ ------------
0* stm32f4x.cpu cortex_m little stm32f4x.cpu running
I am trying to use Tigard with OpenOCD to program/debug STM32F407G-DISC1 board using the onboard 6-pin SWD port. I have researched existing issues on this repo and articles elsewhere on the internet and got past most initial issues. However, I am currently stuck trying to resolve an error. For completeness, I am documenting all steps I have taken so far to easily reproduce the error.
FTDIBUS (v2.12.36.4)
toWinUSB (v6.1.7600.16385)
[USB ID:0403 6010 01
]openocd.exe -f interface/ftdi/tigard.cfg
), I observed many errors.openocd.exe -f tigard_openocd_swd_stm32f4disc.cfg
- but got stuck at following error.If I use the on-board ST-LINK V2 interface using
openocd -f board/stm32f4discovery.cfg
(after reconnecting the CN3 jumper), I don't have any issues with flashing firmware or debugging. I would appreciate any guidance on how to resolve this issue. Since this board does not have JTAG interface, I would like to find a way to use Tigard via OpenOCD with SWD.