mabuchilab / Instrumental

Python-based instrumentation library from the Mabuchi Lab.
http://instrumental-lib.readthedocs.org/
GNU General Public License v3.0
120 stars 80 forks source link

Cannot connect to Bristol 721 Spectrometer #48

Open fsponciano opened 6 years ago

fsponciano commented 6 years ago

I've tried to connect to a Bristol 721 spectrometer (NIR model), but there appears to be an error in the initial communication to initialise the device. It appears to be a checksum error, and the command line continues displaying this message until a keyboard interrupt is sent. Any ideas as to why this is happening?

natezb commented 6 years ago

Thanks for the report. Could you copy the output that you're seeing and provide it here?

fsponciano commented 6 years ago

Instrumental_bristolError.txt

natezb commented 6 years ago

There have been some changes to instrumental since the last time this driver was used/tested, so it was possible that these changes were the problem. However, from the output you provide it seems like a lower-level issue. The first error is:

20180313-16:03:37.033:  SERCAM: ERR:tcCLDevice_Serial::Initialize could not open serial port

Is it possible that you have another program running that has already opened this serial port? Also, when you check the Windows Device Manager, does the bristol show up under serial port COM2?

If these seem OK, you might try importing instrumental.drivers.spectrometers.bristol directly, and playing around with the low-level DLL functions that are accessed via ctypes (e.g. find_comm_port and open_device) to help debug the issue. There's some (minimal) information about these functions in the 721's user manual, Appendix E. The code for this driver is pretty short, so it may help to read that to see what's going on.

fsponciano commented 6 years ago

I did have another program running, just as a sanity check to see the Bristol was actually recognized by the computer. I've checked in the Windows Device Manager and NI-Max to see the Bristol comes up under serial port COM2. This doesn't seem to be the issue.

I'll go ahead an try using the driver from instrumental directly, see if I can pinpoint the problem down.