November 23, 2024, 02:35:16 AM

STM32E407 and openocd - next problem

Started by 143 828, December 08, 2020, 01:03:08 PM

Previous topic - Next topic

143 828

Hi there,

I have a problem flashing my program to Olimex STM32-E407 board. I use
ARM-USB-OCD as programmer, connected via the ribbon cable. My pwr_sel jumper
on the board is at "3-4 | +5V JTAG". I am running on Debian buster.
My command to program is
openocd -f openocd.cfg -c "program blinkerv1.hex verify reset exit"
My openocd.cfg is:
# Interface
source /usr/share/openocd/scripts/interface/ftdi/olimex-arm-usb-ocd.cfg
# Target configuration
source /usr/share/openocd/scripts/target/stm32f4x.cfg

#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst

The output of my openocd call ist
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
none separate
cortex_m reset_config sysresetreq
trst_and_srst separate srst_nogate trst_push_pull srst_open_drain connect_deassert_srst
Info : clock speed 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
adapter speed: 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000300 msp: 0x20000400
adapter speed: 8000 kHz
** Programming Started **
auto erase enabled
Info : device id = 0x10036413
Info : flash size = 1024kbytes
Error: Invalid ACK (6) in DAP response
Error: Failed to write memory at 0x20004048
Error: error writing to flash at address 0x08000000 at offset 0x00000000
** Programming Failed **
shutdown command invoked

I assume, the problem here is the "Error: Invalid ACK (6) in DAP response". But what does that mean?

But sometimes (I guess 1 out of 20) it works, I get the message
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
none separate
cortex_m reset_config sysresetreq
trst_and_srst separate srst_nogate trst_push_pull srst_open_drain connect_deassert_srst
Info : clock speed 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: stm32f4x.cpu -- clearing lockup after double fault
Polling target stm32f4x.cpu failed, trying to reexamine
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
adapter speed: 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
adapter speed: 8000 kHz
** Programming Started **
auto erase enabled
Info : device id = 0x10016413
Info : flash size = 1024kbytes
wrote 16384 bytes from file blinkerv1.hex in 0.698648s (22.901 KiB/s)
** Programming Finished **
** Verify Started **
verified 7728 bytes in 0.073217s (103.075 KiB/s)
** Verified OK **
** Resetting Target **
adapter speed: 2000 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
shutdown command invoked

But this is uncomfortable. I remember, in 2018 when I also ran on Debian buster, it worked every time.
When I try to flash my program via USB, I set the pwr_sel jumper to
"7-8 | +5V_OTG1_PWR" and call

/usr/bin/dfu-util -v -d 0483:df11 -a 0 -s 0x08000000 -D blinkerv1.bin
and this works every time. But it is also uncomfortable, because I always have
to set the jumper B0_1/B0_1 at each single programming/running try . Is there a
way to make the openocd method working at every try? I also exchanged the
ARM-USB-OCD, and also the STM32-E407, but no change.

I also worked through these threads:
https://www.olimex.com/forum/index.php?topic=7918.0
http://www.chibios.com/forum/viewtopic.php?f=16&t=5689&sid=5556fe3b48011bbe898d4430d3eb549d

but I did not see the clou.


olimex

adapter speed: 8000 kHz
slow down this speed when programming

143 828

I found in the stm32f4x.cfg some places where adapter_khz is set, 2 of them to 2000 and one to 8000. I made a local copy of this file and changed it to all adapter_khz are 2000.

Now it works, thank you very much.