-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
ADC1000 error with external interrupt #193
Comments
Hi @drmcnelson Thank you for reporting the issue. I believe this is related to and should be addressed via #190 import json
import seabreeze
seabreeze.use("pyseabreeze")
from seabreeze.spectrometers import Spectrometer
spec = Spectrometer.from_first_available()
def endpoint_sizes(s):
sbtp = s._dev._transport
usbdev = s._dev._raw_device.pyusb_device
ep = {}
for i in usbdev.get_active_configuration():
for e in i.endpoints():
ep[repr((i, e))] = e.wMaxPacketSize
return {
"model": s.model,
"default_read_size": sbtp._default_read_size,
"default_read_endpoint": sbtp._default_read_endpoint,
"default_read_spectrum_endpoint": sbtp._default_read_spectrum_endpoint,
"read_endpoints": sbtp._read_endpoints,
"endpoint_map": {
k: f"0x{v:02x}"
for k, v in vars(sbtp._endpoint_map).items()
},
"usb_endpoints": ep
}
print(json.dumps(endpoint_sizes(spec), indent=2)) Please run the above script with your spectrometer connected, and report the output here. Cheers, |
Hi Andreas, I'm not sure if it is the same issue, but I have an overflow as well when trying to use an ADC1000 connected to a dual channel SD2000 spectrometer. Output of the endpoint map:
Hope this helps; let me know if I should open a separate issue for this. This is on a Mac using manually-forced pyseabreeze backend. |
Hi @pbeaucage Thank you so much for reporting! Could you try running the script that you normally use for measuring, but with the following modification: import seabreeze
seabreeze.use("pyseabreeze")
from seabreeze.spectrometers import Spectrometer
def _update_default_endpoint_sizes(s):
# haven't tested this code yet...
t = s._dev._transport
rs = t._default_read_size
re = t._read_endpoints
em = vars(t._endpoint_map)
ud = s._dev._raw_device.pyusb_device
pm = {
e.bEndpointAddress: e.wMaxPacketSize
for i in ud.get_active_configuration()
for e in i.endpoints()
}
for e in rs:
rs[e] = pm[em[re[e]]]
spec = Spectrometer.from_first_available()
_update_default_endpoint_sizes(spec) Basically for your spectrometer this should set all values in let me know if this prevents the overflow errors. If yes, I'll prepare a fix. |
Hey @ap--,
|
Why does the first call to intensities produce an overflow? Are we sure which spectrum is returned in the second call to "intensities"> I gave up on the device when I saw this happening. I am triggering to get detailed time dependence, and I need some certainty in what I am reading from the instrument. The one that I have is nice for the work I am doing because it has no slit, lots of signal at low excitation. But it has to be rock solid reliable. |
P/S I am going to try the patches now. if it works great. But I am thinking about designing a board, probably using an ARM7, to interface to the SD2000 directly, even both units, and connect to the host over USB. Simultaneous triggering could be pretty useful for example. If someone wants to sponsor the effort, it can probably happen quickly. |
Thanks for posting the results! The first overflow likely occurs because the hot fix I posted only fixes the endpoint size mismatch after the Spectrometer.init is executed. I'll work on a PR and then the issue should be fixed. Cheers, |
Traceback (most recent call last): |
Okay, got it working, patch the line The output is: { |
The patch also has an error, at
So, we modify that to
And then the output before and after running the patch is
In other words, the patch reduced the high_speed setting, whatever it is, from 512 to 64. Is that what was intended? |
spectrometer and system information
python --version
) Python 3.11.2After setting interrupt mode 3, the call to self.dev.intensities() sometimes produces the following error. Other times it requires two pulses on the input before it will return one spectrum.
current problem
detailed description of what doesn't work
steps to reproduce
Step by step instructions to reproduce the error. The more detailed the better, but please use some common sense:
minimal code example and error (very helpful if available)
The text was updated successfully, but these errors were encountered: