Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stbridge setup.py #10

Closed
mcwoo888 opened this issue Aug 30, 2023 · 5 comments
Closed

stbridge setup.py #10

mcwoo888 opened this issue Aug 30, 2023 · 5 comments

Comments

@mcwoo888
Copy link

Noticed two issues:
1.) Setup.py not working due to missing LIBUSB path.
2.) While trying to run alltest.py, it was unable to go pass line 5. Found this error due to BRG_USB_COMM_ERR. Totally clueless on what went wrong as I checked the COMPORT is okay.

cmake_args = [
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}",
f"-DPYTHON_EXECUTABLE={sys.executable}",
f"-DCMAKE_BUILD_TYPE={cfg}",
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{cfg.upper()}={extdir}",
f"-DLIBUSB_INCLUDE_DIRS=C:\DEV\vcpkg\installed\x64-windows\include\libusb-1.0",
f"-DLIBUSB_LIBRARIES=C:\DEV\vcpkg\installed\x64-windows\lib",
]

dev = st.USBInterface.list_devices()[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: BRG_ERROR: 3

@dragonlock2
Copy link
Owner

Are you setting CMAKE_TOOLCHAIN_FILE when building? With correct installation of vcpkg, libusb should be on the path.

The error you're seeing indicates a USB communication error https://github.com/dragonlock2/STLINK-V3-BRIDGE_libusb/blob/1e1a1ae15b70f06cd16b36170b1296bee6520b58/src/bridge/bridge.h. It's possible the libusb DLL isn't being picked up.

@mcwoo888
Copy link
Author

mcwoo888 commented Sep 8, 2023

I see. I tried to hardcode the CMAKE_TOOLCHAIN_FILE path, and now the error is BRG_ERROR:1 which translates to 'USB Connection Error'. Could it be due to the os that I am using is Windows?

    if "CMAKE_TOOLCHAIN_FILE" in os.environ:
        cmake_args.append(f"-DCMAKE_TOOLCHAIN_FILE=C:\DEV\vcpkg\scripts\buildsystems\vcpkg.cmake")
        #cmake_args.append(f"-DCMAKE_TOOLCHAIN_FILE={os.environ['CMAKE_TOOLCHAIN_FILE']}")

@dragonlock2
Copy link
Owner

No it's working on my Windows computer. Did you use Zadig to change the driver for the device to WinUSB?

@mcwoo888
Copy link
Author

Yes, I have tried to reinstall the ST-Link Bridge interface to latest WinUSB (v6.1.7600.16385).
I am actually using STLink-V3Set programmer and my main intention is to try to toggle the GPIO pin on V3Set programmer High/Low. Below are the logs that I printed out. Noticed it is able to read SN, PID, VID information on V3Set programmer, means communication is there. Just unsure, why it always failed to go pass the initialization step.

Attempting to open ST-Link...
fail! Some error occured (1)
Attempting to open ST-Link....
BRIDGE device found 1
Serial Number: 003800463331511134333834
VID: 1155
PID: 14159
libusb: warning [libusb_exit] device 3.0 still referenced
libusb: warning [libusb_exit] device 1.0 still referenced
libusb: warning [libusb_exit] device 2.2 still referenced
libusb: warning [libusb_exit] device 2.0 still referenced
libusb: warning [libusb_exit] device 3.0 still referenced
libusb: warning [libusb_exit] device 1.0 still referenced
libusb: warning [libusb_exit] device 2.2 still referenced
libusb: warning [libusb_exit] device 2.0 still referenced
Traceback (most recent call last):
File "C:\DEV\stbridge\tests\all.py", line 5, in
dev = st.USBInterface.list_devices()[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: BRG_ERROR: 1

@dragonlock2
Copy link
Owner

I've tried a V3SET on my end and also updated to the latest firmware and they all seem to work. Can you try installing WSL or rebooting into Linux and trying that?

@dragonlock2 dragonlock2 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants