-
-
Notifications
You must be signed in to change notification settings - Fork 123
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
[COM] Thorlabs CCS200 spectrometer on Linux? #296
Comments
I gave a quick look at the Thorlabs page and did not see anything related to VISA support. The software tab suggests that there is a Communications Protocol manual that you could use to figure out how to communicate with the instrument over USB without going through Thorlabs software. If you can get this manual, you could try to directly use pyusb to communicate, however I do not think that pyvisa will help you since the instrument does not seem to rely on VISA. |
@MatthieuDartiailh , thank you for your fast response. Focusing on physics, I am rather a newbie to instrumentation.
Maybe |
Interesting I missed those comments. I would be curious to see the C example Thorlabs is referring at, could you share them with me by email ? The USB interface is not the most stable part of PyVISA-py. So to avoid wasting time I would try to go through a more battle tested VISA implementation first. If you have a Windows machine it should be easy, otherwise you can install for example Keysight VISA on Linux (it is restricted to some kernels though). If you manage to communicate through those but PyVISA-py fails we will be able to try to fix it. |
Dear Matthieu, under the following link you find the zipped folder
pertinent to the Thorlabs' spectrometer VISA interface.
http://fzu.cz/~dominecf/IVI.zip
Filip
…On Fri, 12 Feb 2021 at 11:19, Matthieu Dartiailh ***@***.***> wrote:
Interesting I missed those comments. I would be curious to see the C
example Thorlabs is referring at, could you share them with me by email ?
The USB interface is not the most stable part of PyVISA-py. So to avoid
wasting time I would try to go through a more battle tested VISA
implementation first. If you have a Windows machine it should be easy,
otherwise you can install for example Keysight VISA on Linux (it is
restricted to some kernels though). If you manage to communicate through
those but PyVISA-py fails we will be able to try to fix it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#296 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD47TWSRHWOKW6Q5SDMO4TS6T6DVANCNFSM4XQLHREQ>
.
|
Further I observe that the RAW interface to VISA is the recommended one in
the officially supplied documentation.
In particular, *IVI Foundation/VISA/Win64/TLCCS/Manual/TLCCS_files/Functtlccs_init.html*
gives example VISA resource name as "USB0::0x1313::0x8080::DEVICE-SERIAL-NUMBER::RAW"
|
And this is how the spectrometer reports in lsusb. |
It will take me some time to go through that. I will try to to come back to you before next Wednesday. Going quickly over the TLCCS.c file it looks like communication is going mostly through usb_bulk_in and usb_bulk_out so VISA may help but not much. Also note that RAW USB resources are not part of the VISA standard only of the NI implementation, so using Keysight may not work. From pyvisa-py side it seems the first things to figure out is why we do not read the serial number. |
I will be here to give you information regarding the hardware. Meanwhile I am downloading Keysight VISA right now, but installing it might take a lot of prior learning for me, so let's wait until you get some suggestions. Thank you a lot for your fast reaction! |
You may want yo have a look at the following resources about configuration of USB RAW resources from NI (https://zone.ni.com/reference/en-XX/help/370131S-01/ni-visa/configuringni-visarecognizerawusbdevice/). Ideally I would like to get the serial number read properly since without that we are unlikely to go anywhere. If you are on an Arch system you could also try https://aur.archlinux.org/packages/ni-visa/. Note however that this thread suggests that the way NI handles RAW resources is old and may not be well supported on modern distros. |
Matthieu, do you think then it would be cleaner to write a pyUSB driver from scratch? It could be integrated e.g. into https://github.com/ap--/python-seabreeze, which also contain an example of similar code. But I would have to find or wiretap the binary commands over USB, which is not going to be easy even for such a simple instrument. |
Honestly I have no idea at this point. I find the idea that the NI protocol may not be properly supported on modern distros a bit worrying. For wiretrapping you may want to have a look at WireShark. |
Hi Filip, couple of suggestions. I might not be able to help much as it is over a year since I worked with VISA with Linux and Python. |
@CompThing 1. Yes, to make sure, I ran all tests also as root. And I tested the usual tricks with /etc/udev/rules.d/...
@MatthieuDartiailh If all of the above fails, and if I found enought free time, Wireshark+USBPcap will be the last resort. But this can be really tedious. |
Thorlabs support dpt. is friendly, but their answer was discouraging. In short, what I understood so far:
I will have to think about it. If I was to develop a proof-of-concept Linux driver for CCS200, I would have to learn a lot. Currently there are more urgent tasks at my work to be done. |
@FilipDominec I realize this topic is over a year old.. did you ever get any more information on this or make anymore attempts at this? I am a Thorlabs employee, currently developing a QC system in which we need the CCS200 on a Raspberry Pi. I think a Linux implementation of the CCS200 would be a great help to many others and I would be happy to work with you towards a solution. I have already reached out to some key folks in tech support to obtain any current info on this topic as well as the Communication Protocol manual. |
@heath-smith Unfortunately, I did not find enough time to proceed with CCS200, which is ocassionally used as handheld device by our PhD student and instead I am currently constructing a new high-performance spectrometer with echelle configuration already tested on my early prototype. Also the rp2daq project will hopefully soon get a TCD1304 CCD interface for simple grating spectrometers. In fact, on my workbench I have several spectrometer designs in different stages of development; still it would be certainly very interesting to access the CCS200 from Python. If Thorlabs changes their mind and release some docs on communication with CCS200, I will be happy to become a beta-tester! |
Instrument details
Output of
pyvisa-info
What I tried first
And this fails with the following message, as if the spectrometer returned no information about its serial number, in/out endpoints etc.:
What I tried second
I experimentally edited the
pyvisa_py/protocols/usbutil.py
so that it does not crash trying to lowercaseNone
. Then the initialization continued further, until it failed with "USBRAW device must have both Bulk-In and Bulk-out endpoints". So the error is deeper than just missing serial number.What I would like to do when we get VISA communication working
A somewhat bulky bundle of different GUIs and interfaces can be downloaded free from Thorlabs (select "Software -> Full Installer")
The ThorlabsOSASW_Full_setup.exe installer can be run under Linux+Wine and before it fails with some error, it unpacks useful files, e.g.:
which seem to contain C++implementation of communication.
But without VISA initialization, I cannot start trying to implement any pythonic interface.
The text was updated successfully, but these errors were encountered: