cancel
Showing results for 
Search instead for 
Did you mean: 

unable to connect STM32F072RBT6 via stlink (usb cable )

Sudharshan
Associate II

Hi Team,

 

ST-Link Connection Issues with STM32F072RBT6 Discovery Board

Hi everyone,

I’m experiencing issues with my STM32F072RBT6 Discovery Board. It was working fine until recently when I started encountering errors with the ST-Link debugger.

Error Details:

  • During Debug Mode: The debugger displays the error message "TARGET HALT" and disconnects.
  • Flashing Code: When trying to flash the code, I receive the error "Debugger Disconnected."
  • STM32CubeProgrammer: I also get a warning message saying "Connection to device 0x448 is lost," followed by "Disconnected from device."

I have attached screenshots of the errors for reference.

Steps I Have Tried:

  1. Verified hardware connections.
  2. Reset the STM32 board.
  3. Updated ST-Link firmware.
  4. Checked STM32CubeProgrammer and STM32CubeIDE settings.
  5. Confirmed stable power supply.
  6. Looked for hardware issues on the board.
  7. Attempted a full chip erase via STM32CubeProgrammer.

    PFA (images)below including stm32cubeprogrammer logs.

Despite these efforts, the issue persists. Any advice or suggestions on how to resolve this problem would be greatly appreciated. Thank you!

Best regards,
Sudharshan 

6 REPLIES 6
Andrew Neil
Evangelist III

So it's losing connection to the device.

Does your application put the CPU to sleep, and/or disable or reconfigure the SWD pins?

Hi,

The application/code doesn't put the CPU to sleep .  The flashing or debugging is using a ST-Link (a USB wire). In STM32CubeIDE , during debug mode , i am facing this issue . Could you explain the disable  or reconfigure the SWD pins mean here ?

Thanks

Sudarshan


@Sudharshan wrote:

Could you explain the disable  or reconfigure the SWD pins mean here ?


The SWD lines (SWDIO and SWCLK) are on PA13 and PA14:

AndrewNeil_0-1725532926891.png

So, if your code does anything to PA13 and/or PA14, it will break the debug connection.

https://community.st.com/t5/stm32-mcus/how-to-solve-debugger-connection-issues/ta-p/49693

 

TDK
Guru

Maybe hold BOOT0 high during reset, then connect over SWD with STM32CubeProgrammer.

If you feel a post has answered your question, please click "Accept as Solution".
Karl Yamashita
Lead III

Bad USB cable? 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

@Karl Yamashita wrote:

Bad USB cable? 


The screenshots suggest that it does initially make connection, but then loses it.

So could be a faulty USB cable with intermittent fault.

Maybe broken/loose USB connector on the Discovery Board - they are not the most robust things ...