2
\$\begingroup\$

I recently bought an STM32H7 chip, soldered onto a breakout board. I have been trying to program it using the ST-link/V2 using system workbench for STM32. I get the error: "Wrong device detected". The datasheets do not give me much information.

My question is: Is it possible to program the STM32H7 microcontroller directly, using the ST-link/V2?

\$\endgroup\$
  • 1
    \$\begingroup\$ What version of System Workbench are you using? The STM32H7 is a newer part, and might not be recognized by older software. \$\endgroup\$ – duskwuff Aug 6 '18 at 7:16
  • \$\begingroup\$ You should try STM32Cube Programmer. I've heard that it's more up-to-date than ST-Link utility. \$\endgroup\$ – Long Pham Aug 6 '18 at 9:54
  • \$\begingroup\$ @duskwuff Indeed I had to update my System workbench so that was part of the solution. I will post my entire fix below \$\endgroup\$ – Chippi_077 Aug 7 '18 at 11:51
  • \$\begingroup\$ @LongPham I am infact using STM32CubeMX \$\endgroup\$ – Chippi_077 Aug 7 '18 at 11:52
  • \$\begingroup\$ if you use openocd you can do such things so it is generally a software thing, right software will get you where you want to go. The software does need to know what the target is. \$\endgroup\$ – old_timer Aug 7 '18 at 16:57
7
\$\begingroup\$

All STM32 and STM8 chips can be debugged and programmed by an ST Link V2.
However, you might need to update the ST Link firmware.

See if it works with the ST Link Utility: STSW-LINK004.

If yours does not work, then your breakout board will be faulty.

\$\endgroup\$
  • \$\begingroup\$ Thanks, I managed program the chip with the ST Link V2, so this answered my specific question. However I will also add to the solution below \$\endgroup\$ – Chippi_077 Aug 7 '18 at 11:54
2
\$\begingroup\$

As this post may suggest, I am a bit of a newbie. Nonetheless, I managed to correct my mistake.

It turns out my problem was based mainly on my connection between the ST link and the STM32H7 chip, as well as the way I generated my code in STM32CubeMX.

These are the steps I followed to make it work

Software side

  • Created a project in STM32CubeMX for my chip.

  • Set the required pin setup, and chose SERIAL WIRE as my debug option(Sys)

  • Generated the code for system workbench

  • I set the debug mode to SWD in System workbench under Run configuration

Hardware side

  • The datasheet does not mention this, but the SWCLK pin has to be pulled down to VSS, and the SWDIO pin has to be pulled up to VDD.

  • Make sure Pin 19(If using the 20 pin ST link V2) is connected to the VDD of the MCU, together with Pins 1 and 2.

\$\endgroup\$
  • 1
    \$\begingroup\$ Both SWCLK and SWDIO do not require any pull resistors. \$\endgroup\$ – Jeroen3 Aug 7 '18 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.