2021-04-25 12:59 AM
Hi everybody! I am using Windows10, STM32CubeIDE v1.5.1 and SEGGER JLink debugger, HW is STM32F103C8T6, Firmware is default Blink using HAL(But its occurs in all projects)
I Have 2 problems:
1) Running code execution:
When I try to run the code, the MCU is flashed successfully, but at the end I see a message about halting MCU and I need to press Reset button on PCB to run the code.
When problem occurs log looks like this
SEGGER J-Link GDB Server V6.82g Command Line Version
JLinkARM.dll V6.82g (DLL compiled Aug 28 2020 16:57:23)
Command line: -port 2331 -s -device STM32F103C8 -endian little -speed 4000 -if swd -vd
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: localhost only
Generate logfile: off
Verify download: on
Init regs on start: off
Silent mode: off
Single run mode: on
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: STM32F103C8
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V9 compiled Dec 13 2019 11:14:50
Hardware: V9.60
S/N: XXXXXXXXX
Feature(s): GDB, RDI, FlashBP, FlashDL, JFlash, RDDI
Checking target voltage...
Target voltage: 3.28 V
Listening on TCP/IP port 2331
Connecting to target...
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x0800048E (Data = 0x002C4770)
Read 2 bytes @ address 0x0800048E (Data = 0x4770)
Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x0800048E (Data = 0x002C4770)
Received monitor command: WriteDP 0x2 0xF0
O.K.
Received monitor command: ReadAP 0x2
O.K.:0xE00FF003
Reading 32 bytes @ address 0xE00FFFD0
Received monitor command: reset
Resetting target
Downloading 268 bytes @ address 0x08000000 - Verified OK
Downloading 4368 bytes @ address 0x0800010C - Verified OK
Downloading 32 bytes @ address 0x0800121C - Verified OK
Downloading 4 bytes @ address 0x0800123C - Verified OK
Downloading 4 bytes @ address 0x08001240 - Verified OK
Downloading 12 bytes @ address 0x08001244 - Verified OK
Writing register (PC = 0x 8000384)
Starting target CPU...
GDB closed TCP/IP connection (Socket 1008)
Debugger requested to halt target...
...Target halted (PC = 0x08000486)
GDB closed TCP/IP connection (Socket 1036)
Sometimes it runs without halting and no need to press Reset button.
Then log looks like this:
SEGGER J-Link GDB Server V6.82g Command Line Version
JLinkARM.dll V6.82g (DLL compiled Aug 28 2020 16:57:23)
Command line: -port 2331 -s -device STM32F103C8 -endian little -speed 4000 -if swd -vd
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: localhost only
Generate logfile: off
Verify download: on
Init regs on start: off
Silent mode: off
Single run mode: on
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: STM32F103C8
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V9 compiled Dec 13 2019 11:14:50
Hardware: V9.60
S/N: XXXXXXXXX
Feature(s): GDB, RDI, FlashBP, FlashDL, JFlash, RDDI
Checking target voltage...
Target voltage: 3.28 V
Listening on TCP/IP port 2331
Connecting to target...
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x08000486 (Data = 0x4618681B)
Read 2 bytes @ address 0x08000486 (Data = 0x681B)
Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x08000486 (Data = 0x4618681B)
Received monitor command: WriteDP 0x2 0xF0
O.K.
Received monitor command: ReadAP 0x2
O.K.:0xE00FF003
Reading 32 bytes @ address 0xE00FFFD0
Received monitor command: reset
Resetting target
Downloading 268 bytes @ address 0x08000000 - Verified OK
Downloading 4368 bytes @ address 0x0800010C - Verified OK
Downloading 32 bytes @ address 0x0800121C - Verified OK
Downloading 4 bytes @ address 0x0800123C - Verified OK
Downloading 4 bytes @ address 0x08001240 - Verified OK
Downloading 12 bytes @ address 0x08001244 - Verified OK
Writing register (PC = 0x 8000384)
Starting target CPU...
GDB closed TCP/IP connection (Socket 1008)
GDB closed TCP/IP connection (Socket 1044)
2) Second problem is about quiting debugger mode, press "Terminate" Button, MCU isn't starting, it is in Halt mode, but sometimes it starts.
When MCU starts log looks like this:
Bla, bla, bla...
GDB closed TCP/IP connection (Socket 916)
GDB closed TCP/IP connection (Socket 1016)
Restoring target state and closing J-Link connection...
Shutting down...
When MCU is Halted log looks like this:
Bla, bla, bla...
GDB closed TCP/IP connection (Socket 916)
GDB closed TCP/IP connection (Socket 1016)
It occurs only in CubeIDE, when i am using VS + VisualGDB or Keil uVision 5 i don't have thesee problems.
Help me please!
Solved! Go to Solution.
2021-10-08 12:52 AM
Hi @AMaxs.1, @Lk.2,
The problem you are experiencing may stem from an issue in CDT. You are using Windows machines right?
On Windows, when CDT is terminating debug sessions it uses a utility known as starter.exe. This utility is not shutting down processes in a good way resulting in that SEGGER and actually any other GDB-server may exit in a not so graceful way. We believe that this is what you are experiencing.
You could actually work-around this by launching the GDB-server remotely in persistent mode. Then CubeIDE would only launch the GDB-client. Consequently starter.exe is not allowed to manage the GDB-server thread(s).
If you want to try this work-around, modify your debug config like this:
Let us know if that lead to a more reliable experience when clicking the "Terminate" button...
2021-04-25 01:08 AM
I also tried to change JLink software versions, change SWD Speed,change Debugger settings, nothing happens!
Update: Tried CubeIDE 1.6.1 clearly installed on NEW Win7 x64 System, same problem.
2021-06-23 10:32 PM
I have same problem. Sometime runs sometime halted!
2021-06-23 10:40 PM
Hi! I bought STLINK v3mini, now all is working like a charm!
Didn't find any solution with JLink.
2021-06-23 11:35 PM
Thanks for information. But I still want to find a solution for SEGGER JLink.
2021-06-23 11:40 PM
I tried to use JTAG, other frequencies, connect RST from Jlink to target, other software versions, many PCs, many different Windows versions, and many other things. I didn't find any dependency when all working fine and when not working. I think there is a problem in CubeIDE.
2021-06-23 11:50 PM
Have you tried STM32Cube Programmer? Any success?
2021-06-23 11:54 PM
No, I am using only CubeIDE or Keil. I was need Debug function, so Stm32Programmer doesn't support it.
2021-06-24 12:00 AM
Thanks very much your kind information. I'll try Stm32Programmer later to see if it works. Debugging is not necessary for me.
2021-10-08 12:52 AM
Hi @AMaxs.1, @Lk.2,
The problem you are experiencing may stem from an issue in CDT. You are using Windows machines right?
On Windows, when CDT is terminating debug sessions it uses a utility known as starter.exe. This utility is not shutting down processes in a good way resulting in that SEGGER and actually any other GDB-server may exit in a not so graceful way. We believe that this is what you are experiencing.
You could actually work-around this by launching the GDB-server remotely in persistent mode. Then CubeIDE would only launch the GDB-client. Consequently starter.exe is not allowed to manage the GDB-server thread(s).
If you want to try this work-around, modify your debug config like this:
Let us know if that lead to a more reliable experience when clicking the "Terminate" button...