piles
October 19, 2023, 1:07pm
21
I now get …
Processing debug_STM32F446RE (platform: ststm32; framework: arduino; board: genericSTM32F446RE; monitor_speed: 115200; platform_packages: platformio/tool-openocd@^3.1200.0; debug_tool: custom; debug_server: C:\Users\pleserf\.platformio\packages/tool-openocd/bin/openocd, -s, C:\Users\pleserf\.platformio\packages/tool-openocd/openocd/scripts, -f, interface/ftdi/c232hm.cfg, -c, "transport select jtag", -f, target/stm32f4x.cfg; upload_protocol: custom; upload_flags: C:\Users\pleserf\.platformio\packages/tool-openocd/bin/openocd, -s, C:\Users\pleserf\.platformio\packages/tool-openocd/openocd/scripts, -f, interface/ftdi/c232hm.cfg, -c, transport select jtag, -f, target/stm32f4x.cfg; upload_command: C:\Users\pleserf\.platformio\packages/tool-openocd/bin/openocd $UPLOAD_FLAGS -c "program {$SOURCE} 0x8000000 verify reset; shutdown;")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F446RE.html
PLATFORM: ST STM32 (17.0.0) > STM32F446RE (128k RAM. 512k Flash)
HARDWARE: STM32F446RET6 180MHz, 128KB RAM, 512KB Flash
DEBUG: Current (custom) External (blackmagic, jlink, stlink)
PACKAGES:
- framework-arduinoststm32 @ 4.20600.231001 (2.6.0)
- framework-cmsis @ 2.50700.210515 (5.7.0)
- tool-dfuutil @ 1.11.0
- tool-dfuutil-arduino @ 1.11.0
- tool-openocd @ 3.1200.0 (12.0)
- tool-stm32duino @ 1.0.2
- toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
MethodWrapper(["checkprogsize"], [".pio\build\debug_STM32F446RE\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 0.6% (used 832 bytes from 131072 bytes)
Flash: [ ] 0.7% (used 3636 bytes from 524288 bytes)
.pio\build\debug_STM32F446RE\firmware.elf :
section size addr
.isr_vector 452 134217728
.text 3552 134218180
.rodata 0 134221732
.ARM.extab 0 134221732
.ARM 0 134221732
.preinit_array 0 134221732
.init_array 8 134221732
.fini_array 8 134221740
.data 84 536870912
.bss 748 536870996
.noinit 0 536871744
._user_heap_stack 1536 536871744
.ARM.attributes 48 0
.comment 57 0
Total 6493
<lambda>(["upload"], [".pio\build\debug_STM32F446RE\firmware.bin"])
AVAILABLE: blackmagic, custom, dfu, jlink, serial, stlink
CURRENT: upload_protocol = custom
C:\Users\pleserf\.platformio\packages/tool-openocd/bin/openocd C:\Users\pleserf\.platformio\packages/tool-openocd/bin/openocd -s C:\Users\pleserf\.platformio\packages/tool-openocd/openocd/scripts -f interface/ftdi/c232hm.cfg -c "transport select jtag" -f target/stm32f4x.cfg -c "program {.pio\build\debug_STM32F446RE\firmware.bin} 0x8000000 verify reset; shutdown;"
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Unexpected command line argument: C:\Users\pleserf\.platformio\packages/tool-openocd/bin/openocd
*** [upload] Error 1
Oh yeah OpenOCD is double in the upload flags.
[env:debug_STM32F446RE]
platform = ststm32
framework = arduino
board = genericSTM32F446RE
monitor_speed= 115200
platform_packages = platformio/tool-openocd@^3.1200.0
debug_tool = custom
debug_server =
${platformio.packages_dir}/tool-openocd/bin/openocd
-s
${platformio.packages_dir}/tool-openocd/openocd/scripts
-f
interface/ftdi/c232hm.cfg
-c
"transport select jtag"
-f
target/stm32f4x.cfg
upload_protocol = custom
upload_flags =
-s
${platformio.packages_dir}/tool-openocd/openocd/scripts
-f
interface/ftdi/c232hm.cfg
-c
transport select jtag
-f
target/stm32f4x.cfg
upload_command = ${platformio.packages_dir}/tool-openocd/bin/openocd $UPLOAD_FLAGS -c "program {$SOURCE} 0x8000000 verify reset; shutdown;"
piles
October 19, 2023, 2:00pm
24
Ah, that helped
Processing debug_STM32F446RE (platform: ststm32; framework: arduino; board: genericSTM32F446RE; monitor_speed: 115200; platform_packages: platformio/tool-openocd@^3.1200.0; debug_tool: custom; debug_server: C:\Users\pleserf\.platformio\packages/tool-openocd/bin/openocd, -s, C:\Users\pleserf\.platformio\packages/tool-openocd/openocd/scripts, -f, interface/ftdi/c232hm.cfg, -c, "transport select jtag", -f, target/stm32f4x.cfg; upload_protocol: custom; upload_flags: -s, C:\Users\pleserf\.platformio\packages/tool-openocd/openocd/scripts, -f, interface/ftdi/c232hm.cfg, -c, transport select jtag, -f, target/stm32f4x.cfg; upload_command: C:\Users\pleserf\.platformio\packages/tool-openocd/bin/openocd $UPLOAD_FLAGS -c "program {$SOURCE} 0x8000000 verify reset; shutdown;")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F446RE.html
PLATFORM: ST STM32 (17.0.0) > STM32F446RE (128k RAM. 512k Flash)
HARDWARE: STM32F446RET6 180MHz, 128KB RAM, 512KB Flash
DEBUG: Current (custom) External (blackmagic, jlink, stlink)
PACKAGES:
- framework-arduinoststm32 @ 4.20600.231001 (2.6.0)
- framework-cmsis @ 2.50700.210515 (5.7.0)
- tool-dfuutil @ 1.11.0
- tool-dfuutil-arduino @ 1.11.0
- tool-openocd @ 3.1200.0 (12.0)
- tool-stm32duino @ 1.0.2
- toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
MethodWrapper(["checkprogsize"], [".pio\build\debug_STM32F446RE\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 0.6% (used 832 bytes from 131072 bytes)
Flash: [ ] 0.7% (used 3636 bytes from 524288 bytes)
.pio\build\debug_STM32F446RE\firmware.elf :
section size addr
.isr_vector 452 134217728
.text 3552 134218180
.rodata 0 134221732
.ARM.extab 0 134221732
.ARM 0 134221732
.preinit_array 0 134221732
.init_array 8 134221732
.fini_array 8 134221740
.data 84 536870912
.bss 748 536870996
.noinit 0 536871744
._user_heap_stack 1536 536871744
.ARM.attributes 48 0
.comment 57 0
Total 6493
<lambda>(["upload"], [".pio\build\debug_STM32F446RE\firmware.bin"])
AVAILABLE: blackmagic, custom, dfu, jlink, serial, stlink
CURRENT: upload_protocol = custom
C:\Users\pleserf\.platformio\packages/tool-openocd/bin/openocd -s C:\Users\pleserf\.platformio\packages/tool-openocd/openocd/scripts -f interface/ftdi/c232hm.cfg -c "transport select jtag" -f target/stm32f4x.cfg -c "program {.pio\build\debug_STM32F446RE\firmware.bin} 0x8000000 verify reset; shutdown;"
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
jtag
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: 0x06421041 (mfg: 0x020 (STMicroelectronics), part: 0x6421, ver: 0x0)
Info : [stm32f4x.cpu] Cortex-M4 r0p1 processor detected
Info : [stm32f4x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f4x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : [stm32f4x.cpu] external reset detected
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: 0x06421041 (mfg: 0x020 (STMicroelectronics), part: 0x6421, ver: 0x0)
Error: timed out while waiting for target halted
embedded:startup.tcl:1516: Error: ** Unable to reset target **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1553
at file "embedded:startup.tcl", line 1516
*** [upload] Error 1
But it failed to burn the firmware and also the chip was suddenly reset? Does this happen every time and without you pressing any reset button?
The device is also not in bootloader mode? (BOOT0 / BOOT1 pins are both at GND)
piles
October 19, 2023, 2:49pm
26
This happens without pressing a RST button. Yes, both BOOT pins are on GND. Is the problem that I have no reset line at JTAG?
The interface definition does not define a pin as TRST (test-reset) that may be connected to NRST to issue a hardware-reset… However, a software-reset should still be possible. The possible misconfigure is in
when it would maybe need reset_config none
and cortex_m reset_config sysresetreq
for a software reset (see doc ). Just try overriding those settings after the target file is included, like
[env:debug_STM32F446RE]
platform = ststm32
framework = arduino
board = genericSTM32F446RE
monitor_speed= 115200
platform_packages = platformio/tool-openocd@^3.1200.0
debug_tool = custom
debug_server =
${platformio.packages_dir}/tool-openocd/bin/openocd
-s
${platformio.packages_dir}/tool-openocd/openocd/scripts
-f
interface/ftdi/c232hm.cfg
-c
"transport select jtag"
-f
target/stm32f4x.cfg
upload_protocol = custom
upload_flags =
-s
${platformio.packages_dir}/tool-openocd/openocd/scripts
-f
interface/ftdi/c232hm.cfg
-c
transport select jtag
-f
target/stm32f4x.cfg
-c
reset_config none
-c
cortex_m reset_config sysresetreq
upload_command = ${platformio.packages_dir}/tool-openocd/bin/openocd $UPLOAD_FLAGS -c "program {$SOURCE} 0x8000000 verify reset; shutdown;"
piles
October 20, 2023, 7:46am
28
I have tried it out, but unfortunately nothing has changed. I have also found your solution on another forum: sparkfun
In addition I have noted that the scan_chain
command seemed strange to me, because IDCode
and Expected
from Boundary Scan do not match.
> scan_chain
TapName Enabled IdCode Expected IrLen IrCap IrMask
-- ------------------- -------- ---------- ---------- ----- ----- ------
0 stm32f4x.cpu Y 0x4ba00477 0x4ba00477 4 0x01 0x0f
1 stm32f4x.bs Y 0x06421041 0x00000000 5 0x01 0x03
piles
October 20, 2023, 1:44pm
29
Final Solution:
The problem was that the debugging chip on the Nucleo board had no 3.3V supply. I thought it is better if the chip has no power supply, that it does not interfere with the JTAG. But that was the problem. I have now added the 5V where the VBUS supply actually comes in and set the jumper JP6 as in the picture.
Platformio.ini
[env:debug_STM32F446RE]
platform = ststm32
framework = arduino
board = genericSTM32F446RE
monitor_speed= 115200
platform_packages = platformio/tool-openocd@^3.1200.0
debug_tool = custom
debug_server =
${platformio.packages_dir}/tool-openocd/bin/openocd
-s
${platformio.packages_dir}/tool-openocd/openocd/scripts
-f
interface/ftdi/c232hm.cfg
-c
transport select jtag
-f
target/stm32f4x.cfg
upload_protocol = custom
upload_flags =
-s
${platformio.packages_dir}/tool-openocd/openocd/scripts
-f
interface/ftdi/c232hm.cfg
-c
transport select jtag
-f
target/stm32f4x.cfg
upload_command = ${platformio.packages_dir}/tool-openocd/bin/openocd $UPLOAD_FLAGS -c "program {$SOURCE} 0x8000000 verify reset; shutdown;"
Terminal message
Processing debug_STM32F446RE (platform: ststm32; framework: arduino; board: genericSTM32F446RE)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F446RE.html
PLATFORM: ST STM32 (17.0.0) > STM32F446RE (128k RAM. 512k Flash)
HARDWARE: STM32F446RET6 180MHz, 128KB RAM, 512KB Flash
DEBUG: Current (custom) External (blackmagic, jlink, stlink)
PACKAGES:
- framework-arduinoststm32 @ 4.20600.231001 (2.6.0)
- framework-cmsis @ 2.50700.210515 (5.7.0)
- tool-dfuutil @ 1.11.0
- tool-dfuutil-arduino @ 1.11.0
- tool-openocd @ 3.1200.0 (12.0)
- tool-stm32duino @ 1.0.2
- toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio\build\debug_STM32F446RE\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 0.6% (used 832 bytes from 131072 bytes)
Flash: [ ] 0.7% (used 3632 bytes from 524288 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, custom, dfu, jlink, serial, stlink
CURRENT: upload_protocol = custom
Uploading .pio\build\debug_STM32F446RE\firmware.bin
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
jtag
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: 0x06421041 (mfg: 0x020 (STMicroelectronics), part: 0x6421, ver: 0x0)
Info : [stm32f4x.cpu] Cortex-M4 r0p1 processor detected
Info : [stm32f4x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f4x.cpu on 3333
Info : Listening on port 3333 for gdb connections
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: 0x06421041 (mfg: 0x020 (STMicroelectronics), part: 0x6421, ver: 0x0)
[stm32f4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000e50 msp: 0x20020000
** Programming Started **
Info : device id = 0x10006421
Info : flash size = 512 KiB
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
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: 0x06421041 (mfg: 0x020 (STMicroelectronics), part: 0x6421, ver: 0x0)
shutdown command invoked
===================================================================== [SUCCESS] Took 4.40 seconds =====================================================================
Thank you maxgerhardt for your patience and help.
Und ich wünsche ein schönes Wochenende