cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F769I-Disco Blinky: Debugger Connection Lost

MMiri.1
Associate II

I keep getting the following failures when I try to run/debug a simple blinky program on my dev board. This is a fresh install of stm32cubeide, new project started with all peripherals NOT set to default settings. Instead I just set pin N3 (GPIOA, Pin 0) to an input and then a pin toggle loop starts when that is activated. I get a "debugger connection lost". Can someone tell me where I'm going wrong?

Code snippet from main:

while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
	  if(HAL_GPIO_ReadPin(B_USER_GPIO_Port, B_USER_Pin) == GPIO_PIN_SET)
	  {
		  while(1)
		  {
			  HAL_GPIO_TogglePin(GPIOJ, LD_USER1_Pin);
			  HAL_Delay(500);
		  }
	  }
  }

Code snippet from MX_GPIO_Init()

/*Configure GPIO pin : B_USER_Pin */
  GPIO_InitStruct.Pin = B_USER_Pin;
  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  HAL_GPIO_Init(B_USER_GPIO_Port, &GPIO_InitStruct);

Console output when I run:

STMicroelectronics ST-LINK GDB server. Version 5.5.0
Copyright (c) 2019, STMicroelectronics. All rights reserved.
 
Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled
        InitWhile                  : Enabled
 
Waiting for debugger connection...
Debugger connected
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.4.0                  
      -------------------------------------------------------------------
 
ST-LINK SN  : 0669FF343530484D43191129
ST-LINK FW  : V2J36M26
Voltage     : 3.25V
SWD freq    : 4000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x451
Device name : STM32F76x/STM32F77x
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M7
 
 
 
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a01196.srec
  File          : ST-LINK_GDB_server_a01196.srec
  Size          : 7988 Bytes
  Address       : 0x08000000 
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sector 0
Download in Progress:
 
File download complete
Time elapsed during download operation: 00:00:00.844
 
Verifying ...
 
 
Download verified successfully 
 
 
Debugger connection lost.
Shutting down...

1 ACCEPTED SOLUTION

Accepted Solutions
MMiri.1
Associate II

Okay, posting this here for anyone else who runs into this.

I'm feeling pretty stupid, but "Debugger connection lost. Shutting down..." is expected if you hit "Run". It is not expected if you hit "Debug".

Also make sure that the default CUBEMX pin config is correct for what you want to do. It wasn't for me, but now I'm on my way.

View solution in original post

4 REPLIES 4
Uwe Bonnes
Principal III

It seem you remap some of the Pins involved into the JTAG/SWD communication, Try connect under reset to regain control

Interesting. What do you mean by "connect under reset to regain control"? I tried hitting the reset button just before starting the programming. Then I tried during, and neither of those got around the "Debugger connection lost." button.

I thought about what you said about remapping SWD pins. The default STM32CUBEIDE project setup has a lot of pins initialized in MX_GPIO_Init(), even though I clicked "NO" on the default peripheral setup when starting the project.

So I removed every GPIO pin initialization in the MX_GPIO_Init() function except for the one that I needed for the button input and the LED output. I still have that same problem, somewhat confusingly.

Oh, I think I found what you mentioned. In "Run" -> "Run Configurations" -> "Debugger" -> "Reset Behavior", I already had the option "Connect under reset" selected. So no luck there. I tried the option "Software System Reset", but the issue still exists there as well.

MMiri.1
Associate II

Okay, posting this here for anyone else who runs into this.

I'm feeling pretty stupid, but "Debugger connection lost. Shutting down..." is expected if you hit "Run". It is not expected if you hit "Debug".

Also make sure that the default CUBEMX pin config is correct for what you want to do. It wasn't for me, but now I'm on my way.