This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[ST-Link STM32F4] Random Internal Command Errors

I have been using Keil u5, ST-Link/V2's, and STM32F405's for various projects for a few years, but roughly two months ago I started getting "Internal Command Error" popups when trying to flash boards which otherwise work fine.

These errors are extremely fickle, and seem to have a mind of their own. They occur out of nowhere, and are not fixed by my usual methods of pulling the boot pin high or attempting to connect under reset. Likewise, swapping to different ST-Links, different code, or even different computers doesn't fix these errors.

Well, to say they aren't fixed by any of the above would be a lie - in general, some combination of the above generally lets me program a board. After enough tries of various setups, I can usually get a flash off (my favorite thus far has been swapping from one ST-Link to another, having both fail, then swapoing back and getting a successful flash). However, taking hours to unreliably flash a board is just not acceptable, and it's high time I find a fix for this error.

I have absolutely no idea what could be causing these errors, and have tried updating the firmware of pretty much everything involved to no success. Unless the only way out is to downgrade my ST-Link firmware (in which case I wouldn't mind a link, although I doubt that's it as ones I never updated have been doing this as well), I'm completely out of ideas.

If anyone has seen anything like this before, or has any suggestions to help fix this issue, I'd really appreciate the help.

Thanks.

  • Have you got a screenshot of that pop-up?

    Is it a uVision pop-up, or from elsewhere?

    When you're having the problem, can you program successfully using the ST-Link Utility or command-line ?

    Have you contacted ST ?

  • I'll grab a screenshot next time I get this error - it just magically stopped appearing with no changes except giving it a few hours, and I now can flash correctly without issue. I don't expect this will last.

    It's definitely a uVision popup, do doubt there. I've done some searching and other reports of internal command errors do exist on these forums, but I have yet to find any as wonky, inconsistent, and all-consuming as those I have been experiencing.

    I have never once in my life used either of these two methods to program the board, so no.

    I have also not contacted ST, although I would not be against doing that if this post is unsuccessful.

  • You should definitely get the ST-Link Utility!

    It's ST's own - so it helps to narrow-down whether this is a fundamental issue with the ST-Link, or a Keil problem

    It's also generally useful if you just want to quickly program or read a chip - without having to open the full development Project.

    https://www.st.com/en/development-tools/stsw-link004.html

    Also worth contacting ST to see if they're aware of anything ...

    See also https://community.st.com/s/ - remember to give links if cross-posting ...

  • If you have a licence, you could report direct to Keil/ARM support - they will have a better idea of what "internals" could cause this ...

  • Check cables (USB/JTAG), avoid hubs and docking stations.

    Reduce the connection speed, might be too aggressive. Use 1 or 2 MHz options.

    For stand-alone ST-LINK make sure VTarget pin is suitably powered.

    Older version of ST-LINK Utilities had prior firmware versions and can upgrade/downgrade.

    If the micro-controller goes into a low power mode, ie WFI in idle loop, it can drop debug connectivity. Watch also PA13/PA14 pin configuration.