pavelrevak / pystlink

Python tool for flashing and debugging STM32 devices using ST-LINK/V2
MIT License
218 stars 59 forks source link

*** ST-Link/V2 is not connected *** #5

Open mirzafahad opened 7 years ago

mirzafahad commented 7 years ago

I think I am missing something obvious. My ST-Link/V2-1 can be detected by the ST-Link Utility. What are the possible reasons I am having this issue?

pavelrevak commented 7 years ago

Hello Fahad, thanks for reporting, but please provide more informations like what OS do you have, version of python, if you have all drivers installed, some debug info -d and so. Thanks.

mirzafahad commented 7 years ago

I am using windows 10, python 3.6. I installed pyusb. Downloaded libusb from here (your link isn't working) and copied libusb-1.0.dll into Windows/System32 directory. -d doen't provide anything apart from the " ST-Link/V2 is not connected " error.

Hope this helps.

pavelrevak commented 7 years ago

You also need installed ST-Link utility this utility also contain driver for ST-Link and this is necessary for running under windows, I looking that I forgot to mention about this in README.

mirzafahad commented 7 years ago

I have that installed. I mentioned in my first post that ST-Link Utility can detect the ST-Link/V2.

ZhouChenghong commented 6 years ago

I meet the same issue.And I use Windows10 and Python3.5.I used to use ST-Link to program SM32.I cloned pystlink and libusb from github,and compiled libusb-1.0.dll with VS.I am confused ablout what I did wrong.

ZhouChenghong commented 6 years ago

I know why it is fail to connect to ST-Link/V2,because ST-Link/V2 use STM32 drive program instead of libusb drive program,we should change the drive program to libusb.I program flash successfully several times but failed many times with " Error unlocking FLASH ".I haven't figured out it.

ZhouChenghong commented 6 years ago

I have figured out the error. :-) I add a 100ms delay before unlock the flash,and try to unlock the flash again between eraseing and flashing.After that,it work well.

bilkosem commented 5 years ago

I know why it is fail to connect to ST-Link/V2,because ST-Link/V2 use STM32 drive program instead of libusb drive program,we should change the drive program to libusb.I program flash successfully several times but failed many times with " Error unlocking FLASH ".I haven't figured out it.

I am facing the same problem( ST-Link/V2 is not connected ). How did you handle this problem, can you explain it a little bir more detailed.

NickXia007 commented 5 years ago

You can try following steps: if your system is 64bit windows, need copy MS32\dll\libusb-1.0.dll to C:\Windows\SysWOW64. or just add MS32\dll to your %path% env.

ZhouChenghong commented 5 years ago

I am facing the same problem( ST-Link/V2 is not connected ). How did you handle this problem, can you explain it a little bir more detailed.

In fact,I almost forget what I did.Emmm,you can use Zadig to replace the driver of st-link easlly.

desowin commented 4 years ago

Apparently the ST-Link official driver (STSW-LINK009) is just WinUSB. There's no need to replace the driver with Zadig, as it is compatible with libusb (STSW-LINK009 version 2.0.1; libusb version 1.0.22). The libusb-1.0.dll does not need to be copied to Windows directory. Copying libusb-1.0.dll to the Python installation directory (same directory where python.exe is located) is enough.

pavelrevak commented 4 years ago

ST-Link driver is needed only to have right .inf file for USB Device. All what you need on Windows is libusb1.dll and pyusb (I prefer 64bit python and also libusb1)

hagibr commented 4 years ago

Using 32bit Python solved my problem. Initially I thought it was something related to the python version, but doing some experiments here I saw that it was the architecture. Now I need only to have libusb-1.0.dll in the same folder of the program and it works without this error.

fbvasconcelos commented 1 year ago

In 2022 the problems continue to happen. Does anyone have a solution for this?

jguembe commented 1 year ago

I had the same problem and I managed to solve it. In my case, I have

image

However, the programmer of the STM32CubeIDE does not work, you should go back to the previous version of the driver for it to work again. You can do this by reverting to the previous driver in Device Manager > select device > Driver. Or you can also do: Device Manager > select device (right click) > Update Driver > Browse my PC for drivers > Choose from a list of available drivers > Choose STMicroelectronics STLink dongle.

I think there is no way to use two programs twice without doing instalation of the proper driver for each program.

kRasul commented 1 month ago

@jguembe image I accidently found the way to make it work. It was working on my latop (with both pystlink and cubemxprogrammer) and didn't work on my PC. Then I installed libusb-win32 on my and got it working with pystlink but cubemxprogrammer stoopped to work. I found that on my laptop was older ST-link driver then on PC. Its properties on image above. Too lazy to continue hastle though since working only with pystlink is enough for me for now.