Reputation: 111
I have a NUCLEO-F401RE board (with STM32F401RE) and it has been working fine for the most part. Here recently, I followed a tutorial in the book "Mastering STM32" where it says to install OpenOCD.
I had been following along before this as well, and I had been able to connect to my board and flashing it without any problem.
After attempting to get OpenOCD to work though, this is no longer possible. Every time I try to connect to my board, I simply get the following error message:
No ST-LINK detected
I have tried updating the drivers multiple times, rebooting the board, reinstalling the ST-LINK utility, switching the USB cable, resetting the board and reinstalling everything and I have also tried the trick where you hold down the reset button and try to erase the chip. So far, none of this has worked for me unfortunately.
Here is a picture of my board:
On my desktop, I am using Windows 10. On my board, and I am using FreeRTOS.
Here is an image of my Windows Device Manager:
[
I have also tried to update the firmware on my board using the ST-LINK upgrade, but without any luck. When attempting this, I either do not have the option to select my device (when using the .jar application) or when using the .exe application, I just get the following error messages:
No ST-Link device detected
Please connect it and then retry
Is there a solution for this?
Upvotes: 11
Views: 116119
Reputation: 423
I just ran into this. The problem boiled down to using Nucleo boards and trying to interface with them using older versions of ST-LINK (ST's search for ST-LINK's first hit led me to stsw-link0004, which was not installing the right drivers). Why they don't point you to the latest greatest first, who knows.
Whenever I tried to install drivers, I could only select USB Composite device as a compatible driver, despite repeatedly uninstalling/reinstalling stlink0004.
You need to install the newest ST-LINK, e.g., stsw-link0009 (or newer).
Upvotes: 1
Reputation: 517
From what I have learned and understood (but everyone can correct me :)), your board is divided in two parts:
The ST-LINK part is used to flash the microcontroller and can be used to flash any other STM32F4 device through SWD. With your picture:
The STM32 ST-LINK Utility uses the ST-LINK part of your board to flash it. My point is that if you have the "No ST-Link detected", the issue, I am quite sure, doesn't come from the microcontroller part, but comes from the ST-LINK part. And since you did say that it worked before you install OpenOCD, I would suggest the driver part in Windows 10 that may be the root of your problems.
Try to uninstall everything (and I mean everything) related to the STM32 (OpenOCD, STM32 ST-Link Utility and its driver through Device Manager).
Reinstall only the STM32 ST-Link utility (if you did uninstall the drivers correctly, it should ask you the permission to install the drivers during set up) and try to connect your board.
You can also try to remove the SWD jumpers (connector CN2) on your board to detach the ST-LINK from the built-in microcontroller part. Since the ST-LINK part is independent it will still be detected by the STM32 ST-LINK Utility (but you will have to put the jumpers back if you want to actually program your microcontroller).
Upvotes: 1
Reputation: 11420
As mentioned in other answers, the problem is almost certainly due to a competing driver (something like libusb) taking control of the device.
However, you do not need to "uninstall and reinstall everything" to select the correct driver, assuming that you have already installed it once before. Moreover, the reinstallation procedure most likely won't help, because the uninstallers usually do not uninstall the drivers anyway, and Windows will keep prefering the same wrong driver.
Instead, open Device Manager, find your STM32 STLink device, double-click to open the Properties dialog. Then click "Update Driver", then "Browse my computer for driver software", then "Let me pick from a list of available drivers on my computer", and you should see something like that:
You see that in this example, at least four different drivers available on the system are happy to service the device. The first two are generic libusb drivers, not specific to the dongle (OpenOCD is happy to use either of those, if I remember correctly). The ST-Link utility, however, wants a dedicated driver, developed by STM - those are the two entries below on my picture. If you do not see those, try installing the ST-Link utility again (no need to uninstall anything) or download just the driver from the STM website.
You can now click on the preferred driver in this list and have it replace whatever driver was assigned to the device before.
Upvotes: 5
Reputation: 99
From my poor experience the "No ST-LINK detected" message in the STM32 Utility shows when you are disconnected or when other program is using a ST-LINK. So, if this start happens after installing OpenOCD try to uninstall this and try again (maybe with option "Connect under reset"?).
For your information. When you plug the cable to the PC and the board is power on then in the settings (STM32 Utility) you can see available ST-Links (even blocked). Here is example when ST-Link is blocked
Upvotes: 2