stlink icon indicating copy to clipboard operation
stlink copied to clipboard

NUCLEO-G431KB ERROR gdb-server.c: cannot recv: -2

Open keck9939 opened this issue 8 months ago • 3 comments

  • [ ] Programmer/board type: NUCLEO-G431KB
  • [ ] Operating system an version: Linux raspberrypi 6.12.20+rpt-rpi-2712
  • [ ] stlink tools version and/or git commit hash: 5259daa4bfb345d9f80f4e4b703f6d8453564744
  • [ ] stlink commandline tool name: st-util
  • [ ] Target chip (and board, if applicable): NUCLEO-G431KB

When remote debugging from Cube IDE 1.18.1 (Windows) to st-util GDB server on a RaspberryPi5, at the IDE I get the error: Could not verify ST device. Please verify that the latest version of the GDB server is used for the connection.

At the RaspberryPi I get:

keck@raspberrypi:~/git/stlink $ st-util -p 3333
st-util 1.8.0-103-g5259daa
2025-04-22T17:11:06 INFO common_legacy.c: STM32G43x_G44x: 32 KiB SRAM, 128 KiB flash in at least 2 KiB pages.
2025-04-22T17:11:06 INFO gdb-server.c: Listening at *:3333...
2025-04-22T17:11:17 INFO common_legacy.c: STM32G43x_G44x: 32 KiB SRAM, 128 KiB flash in at least 2 KiB pages.
2025-04-22T17:11:17 INFO gdb-server.c: Found 6 hw breakpoint registers
2025-04-22T17:11:17 INFO gdb-server.c: GDB connected.
2025-04-22T17:11:19 ERROR gdb-server.c: cannot recv: -2

and st-util quits.

The tools were built on the Pi following the build instructions.

keck9939 avatar Apr 22 '25 21:04 keck9939

I used Wireshark to capture the conversation from the IDE to the debugger stub, for both the st-util stub on the Pi and ST's stub on the Windows PC. One thing I notice is the difference in the memory map returned by st-util. It does not appear to be correct. I have attached localGDB.pdf (ST's stub on the PC) and remoteGDB.pdf (st-util on the Pi) which shows Wireshark's analyzed conversations.

remoteGDB.pdf localGDB.pdf

keck9939 avatar Apr 23 '25 13:04 keck9939

Perhaps this is not related, but I see frequent USB bus hangs when doing st-flash writes to a Nucleo-STM32G431KB (LIBUSB_ERROR_TIMEOUT, the x64 host needs a power-cycle to recover). Never happened with the other 10 or so attached boards, so far. The G431 boards have an ST-Link V3 on board, the others V2.1, FWIW.

jcw avatar May 04 '25 19:05 jcw

I've seen timeouts when debugging locally primarily when using live expressions. I found that things improve considerably if I re-flash the ST-LINK so it does not support the mass storage capability. Also, slowing down the SWD clock rate helps. I do not think however that this is related to the remote debug issue I'm seeing here.

keck9939 avatar May 04 '25 22:05 keck9939

I have tested this with my Nucleo-G431KB board and was not able to reproduce the issue following the described procedure. Thus I am closing this issue now as resolved.

Nightwalker-87 avatar Oct 01 '25 20:10 Nightwalker-87