1
\$\begingroup\$

I have a nucleo board but no mini-USB B so I hooked it up to an external STLink V2 programmer(related post).

The problems:

  1. At first it was working as expected but after a while STM32CubeProgrammer gives an error while trying to connect:enter image description here
  2. It works 1 out of ~20 tries, sometimes even more. When it works, it works fine. But the problem with plugging in again and again is, my laptop's USB port is becoming loose. I can already tell one of them is pretty loose already.
  3. I also tried holding the reset button and then trying to connect it, but same result(I have the reset pin connected, I don't think I needed to do that manually).
  4. I tried different modes, frequencies etc., to no avail.

What can cause this and how can I go about fixing it?

\$\endgroup\$
4
  • \$\begingroup\$ Have you tried changing your USB data cable? \$\endgroup\$
    – Dharmik
    Commented May 25, 2021 at 3:13
  • \$\begingroup\$ @dharmik There's no data cable. The STLink programmer connects directly to the female USB port. \$\endgroup\$ Commented May 25, 2021 at 3:34
  • \$\begingroup\$ Upgrade the St link firmware and USB drivers \$\endgroup\$
    – Sorenp
    Commented Jun 11, 2021 at 17:34
  • 1
    \$\begingroup\$ @Sorenp I tried that already, didn't work. The actual problem turned out to be loose jumper wires. The STLink-jumper wire solution seems to be very finicky. I wish there was a big connector that attaches to the STLink end, that's always the problem. I have to hold the jumper wires firmly on the STLink and then it connects. \$\endgroup\$ Commented Jun 13, 2021 at 3:18

2 Answers 2

2
\$\begingroup\$

I had solved the problem within a few days of posting this question (before the very expensive usb cable I ordered online arrived) by shortening the jumper wires and soldering the ends of the wires to the connectors.

It seems that the cube programmer (and also the mbed studio I tried later on with bluepill and blackpill boards) fails to connect to the board using STLink devices if the jumper wires are even a tiny bit loose or are lengthy.

I know that the programming is probably done via UART and the corresponding UART baud rate doesn't seem to be too much for regular jumper wires to fail, still I have no idea why it doesn't work.

I would also like to add that I have used SPI and UART protocol faster than the mentioned baud rate reliably with the same jumper wires and a breadboard. It seems to be a STLink only issue.

\$\endgroup\$
0
1
\$\begingroup\$

Change "Reset mode" in STM32CubeProgrammer to different modes like:

enter image description here

I was getting the same error and I changed 'hardware reset' to 'software reset' and create "new project".

..my problem was solved

\$\endgroup\$
1
  • \$\begingroup\$ I had already tried that. Worked intermittently. The problem turned out to be the jumper wires. Using shorter wires and soldering them on both ends solved the problem permanently. \$\endgroup\$ Commented Mar 2, 2023 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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