Hello PLECS community, in recent days I have been trying to make a communication between a custom board using STLinkv2 and PLECS, however, I have not been able to communicate them, I am using the STM32G431KBT6 microcontroller as depicted in the figure for my custom PCB board
Error in build step #3 (Execute):
Open On-Chip Debugger 0.11.0 (2021-12-23-14:02)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : STLINK V2J45S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.180311
Info : clock speed 100 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x2ba01477
Info : chip.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: chip.cpu -- clearing lockup after double fault
Polling target chip.cpu failed, trying to reexamine
Info : chip.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : gdb port disabled
Error: Failed to read memory at 0x5c001004
shutdown command invoked
Have you tried to create a similar blinking LED example project in STM32CubeIDE and flashing the microcontroller from there? That would allow us to establish that the wiring on the custom PCB is not causing the issue.
Also, I made the LED Blink as its particularly depicted in this figure with the coder configurations using an ST-Link and OpenOCD programming interface:
I don’t sure what I’m doing wrong, though, because the error message is essentially the same in every instance I’ve had. I also wrote code for those boards separately using only the STM32 IDE and OpenOCD, and works OK.
EDIT: Since my knowledge of OpenOCD is zero, I builted the project directly to STMCubeIDE and works fine using ST-Link with the OpenOCD option, nevertheless, I search the registers inside, that is the STM32CubeIDE:
Open On-Chip Debugger 0.12.0+dev-00623-g0ba753ca7 (2025-04-30-14:17) [https://github.com/STMicroelectronics/OpenOCD]
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : STLINK V2J46S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.156505
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : clock speed 4000 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x2ba01477
Info : [STM32G431RBTx.cpu] Cortex-M4 r0p1 processor detected
Info : [STM32G431RBTx.cpu] target has 6 breakpoints, 4 watchpoints
Info : [STM32G431RBTx.cpu] Examination succeed
Info : starting gdb server for STM32G431RBTx.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Info : device idcode = 0x20036468 (STM32G43/G44xx - Rev 'unknown' : 0x2003)
Info : RDP level 0 (0xAA)
Info : flash size = 128 KiB
Info : flash mode : single-bank
Warn : GDB connection 1 on target STM32G431RBTx.cpu not halted
undefined debug reason 8 (UNDEFINED) - target needs reset
Info : accepting 'gdb' connection on tcp/3333
Warn : GDB connection 2 on target STM32G431RBTx.cpu not halted
undefined debug reason 8 (UNDEFINED) - target needs reset
[STM32G431RBTx.cpu] halted due to breakpoint, current mode: Thread
xPSR: 0x01000000 pc: 0x08000be4 msp: 0x20008000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Padding image section 0 at 0x080001d8 with 8 bytes
Info : Padding image section 1 at 0x08002624 with 4 bytes (bank write end alignment)
[STM32G431RBTx.cpu] halted due to breakpoint, current mode: Thread
xPSR: 0x01000000 pc: 0x08000be4 msp: 0x20008000
Info : dropped 'gdb' connection
[STM32G431RBTx.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x080006fc msp: 0x20007fd0
shutdown command invoked
Info : dropped 'gdb' connection
And this is the one of PLECS:
Error in build step #3 (Execute):
Open On-Chip Debugger 0.11.0 (2021-12-23-14:02)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : STLINK V2J46S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.152424
Info : clock speed 100 kHz
Info : stlink_dap_op_connect(connect)
Info : SWD DPIDR 0x2ba01477
Info : chip.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : gdb port disabled
Error: Failed to read memory at 0x5c001004
shutdown command invoked
During my research I found that it could be the possibility that OpenOCD v0.11 have a wrong direction for the G4 microccontrollers 0x5C001004
I don’t know if it’s a simple bug, or another thing,
Thank you for digging deeper! We will soon update OpenOCD from v0.11 to v0.12. I reached out to you by email to send you OpenOCD v0.12 in a form that you can use with the STM32 Target Support Package.