Debug issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-01 12:42 AM
Hello,
I have an issue debug issue in my custom board. The debug session works for a while and then stop to working and suddenly after many tries it works again.
When the debug session doesn't work, I get:
STMicroelectronics ST-LINK GDB server. Version 5.9.1
Copyright (c) 2021, STMicroelectronics. All rights reserved.
Starting server with the following options:
Persistent Mode : Disabled
LogFile Name : C:\Users\***\Debug\st-link_gdbserver_log.txt
Logging Level : 31
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Enabled
SWD Debug : Enabled
COM frequency = 4000 kHz
Target connection mode: Attach
Reading ROM table for AP 0 @0xe00fffd0
Hardware watchpoint supported by the target
ST-LINK Firmware version : V2J38M27
Device ID: 0x418
PC: 0x78f9e0
ST-LINK device status: RUN_MODE
ST-LINK detects target voltage = 3.26 V
ST-LINK device status: RUN_MODE
ST-LINK device initialization OK
Waiting for debugger connection...
Waiting for connection on port 61234...
Waiting for connection on port 61235...
Accepted connection on port 61234...
Debugger connected
Try halt...
ST-LINK device status: HALT_MODE
Enter STM32_HardwareReset() function
STM32_HardwareReset(), failure reset target.
ST-LINK device status: RESET_MODE
------ Switching to STM32CubeProgrammer -----
-------------------------------------------------------------------
STM32CubeProgrammer v2.8.0
-------------------------------------------------------------------
Log output file: C:\Users\***\AppData\Local\Temp\STM32CubeProgrammer_a14944.log
ST-LINK SN : 0668FF343537424257252146
ST-LINK FW : V2J38M27
Board : NUCLEO-F302R8
Voltage : 3.25V
Error: ST-LINK error (DEV_TARGET_CMD_ERR)
Encountered Error when opening C:\ST\STM32CubeIDE_1.4.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.0.0.202105311346\tools\bin\STM32_Programmer_CLI.exe
------ Switching context -----
Error in STM32CubeProgrammer
Debugger connection lost.
Shutting down...
Stopping port 61235
Received stop for port 61235, not accepting new connections.
I use ST-LINK device and pins SWCLK, SWDIO and NRST are connected to the custom board MCU STM32F105VC. (of course 3.3v and GND).
The debug configuration is attached.
Thank you.
- Labels:
-
DEBUG
-
STM32CubeProgrammer
-
STM32F3 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-01 1:25 AM
Two possible mistakes , your code enter STOP or lower mode and you dont setup session to this.
Or you dont setup sonnecion under reset ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-01 1:30 AM
Thank you for your reply,
The debug sometimes (when it works) ends in Error_Hanlder function.
void Error_Handler(void)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
__disable_irq();
while (1)
{
}
/* USER CODE END Error_Handler_Debug */
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-01 1:43 AM
Perhaps migrate to the form of this that identifies the file and line it is called from, or pulls the return address so you can pin it down via symbols and .MAP or .ELF file.​
​
P​erhaps don't disable interrupts here, and double check NRST is properly connected.
​
C​heck clock startup code for failure cases.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-01 2:04 AM
On the custom board, I am using two external 8MHz and 32KHz crystal oscillators. I have just disable the HSE from RCC configuration and it seems that the code doesn't run into the Error_Handler.
If the clock configuration is correct, then I have to check for the hardware.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-01 2:09 AM
If the HSE doesn't start it will trap. Should be a couple of points you can identify quickly with breakpoints in SystemClock_Config()
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-01 2:28 AM
When your hardware fail, then ofcourse debuger crash too. For hw debug use scope ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-01 6:26 AM
Thank you,
I will check for the hardware if something is wrong.
But would you please tell me, the reason I can't change the LSI to LSE in clock configuration (as I mentioned, I use two external crystal 8MHz/32KHz, HSE and LSE). A picture is attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-02 12:41 AM
I can verify that the 8MHz crystal is working on board when debug session is ok.
But I am still facing issue with debug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-02 3:59 AM
RTC have to be enabled.
