Debugging the Lora-STM32WL-devkit: Open On-Chip Debugger failed

Started by Volker, March 19, 2025, 01:23:20 PM

Previous topic - Next topic

Volker

Two Remarks:

1. Launching the debugger fails with a probability of about 50%.

2. OpenOCD.exe which came with STM32CubeIDE 1.10.0 does not work:

C:\ST\STM32CubeIDE_1.10.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.openocd.win32_2.2.100.202206011703\tools\bin\openocd.exe -f interface/cmsis-dap.cfg -c "cmsis-dap vid_pid 0x15ba 0x0044" -c "transport select swd" -c "adapter speed 2000" -f "target/stm32wlx.cfg"
Open On-Chip Debugger 0.11.0+dev-00449-g53fa0f7 (2022-06-09-09:42) [https://github.com/STMicroelectronics/OpenOCD]
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
cmsis-dap <cmd>
  cmsis-dap cmd
  cmsis-dap info

Volker

I tried using the openOCD.exe which comes with STM32CubeIDE 1.10.0. This version just issues a message and does nothing:

 C:\ST\STM32CubeIDE_1.10.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.openocd.win32_2.2.100.202206011703\tools\bin\openocd.exe -f interface/cmsis-dap.cfg -c "cmsis-dap vid_pid 0x15ba 0x0044" -c "transport select swd" -c "adapter speed 2000" -f "target/stm32wlx.cfg"
Open On-Chip Debugger 0.11.0+dev-00449-g53fa0f7 (2022-06-09-09:42) [https://github.com/STMicroelectronics/OpenOCD]
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
cmsis-dap <cmd>
  cmsis-dap cmd
  cmsis-dap info

LubOlimex

I believe the support for STM32wlx chips was added in OpenOCD 1.11.0, so it is expected to have problems with OpenOCD 1.10.0.
Technical support and documentation manager at Olimex

Volker

Has this problem solved in the meantime. Without software the Lora-STM32WL-devkit is pretty useless, or?

LubOlimex

No real progress had been made. I managed to run it through the STM32CubeIDE like you, thanks for this I didn't know it is possible, but unfortunately haven't found a solution. It is quite likely that the problem is in some compatibility between the CMSIS firmware and OpenOCD. I am not sure when it occurred since I've tested it in the past and it worked just fine. I will also test with IAR EW and see if it works there.

It is not as useful as it should be since the real-time debugging doesn't seem to work reliably (here it works sometimes, sometimes it fails) but it is not useless either - it still can be used relatively well for programming (albeit slow without the flash loader). Just make sure to reduce the work area in the stm32wlx.cfg config.

Yet, LoRa-STM32WL-DevKit is open-source hardware project and the firmware it runs is also open-source (modified dap42 https://github.com/devanlai/dap42), so even if we can't solve it, it is possible to try to fix it yourself.

Edit: I found some old revision boards and they behave similarly to the latest revision so it is not due a change in hardware.
Technical support and documentation manager at Olimex

Volker

Forget the onboard debugger interface. Use ST-Link/V2.

Connection to ST-Link/V2:
Remove the pins 1 and 2 of CON2 of the Modul BB-STM32WL sitting on the LoRa-STM32WL-DevKit. This disconnects the signals swclk and swdio from the base board.
Connect:
pin1 (swclk) with pin 9 (TCK_SWCLK) of ST-Link/V2
pin2 (swdio) with pin 7 (TMS_SWDIO) of ST-Link/V2
pin7 (+3.3V) with pin 1 (+3.3V in)  of ST-Link/V2
pin6 (NRST)  with pin 15 (NRST)    of ST-Link/V2
GND on baseboard with pin 20 (GND)  of ST-Link/V2

Debugger: Select AUtostart local GDB server, localhost, port 61234
Debug probe: ST-Link (ST-Link GDB server)
Select SWD
Frequency: Auto
Access port: 0-Cortex-M4
Connect under Reset
Verify flash download
Enable live expressions

ST-Link/V2 works very reliable.