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

unable to communicate with device #7

Open
gadamc opened this issue Aug 31, 2023 · 4 comments
Open

unable to communicate with device #7

gadamc opened this issue Aug 31, 2023 · 4 comments

Comments

@gadamc
Copy link
Collaborator

gadamc commented Aug 31, 2023

From @palnitishh


hi, I am trying to communicate to the COM4 in my case using
pulser = qcsapphire.Pulser('COM4')

but end up with error

IndexError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_8180\1879743324.py in
----> 1 pulser = qcsapphire.Pulser('COM4')

~\AppData\Roaming\Python\Python39\site-packages\qcsapphire\pulser.py in init(self, port, timeout)
88 self.open()
89 self._command_history = collections.deque(maxlen=1000)
---> 90 self._read_hardware_versions()
91
92 ## PRIVATE

~\AppData\Roaming\Python\Python39\site-packages\qcsapphire\pulser.py in _read_hardware_versions(self)
175
176 def _read_hardware_versions(self):
--> 177 res_str = self.query('*IDN?')
178 _, model_number, serial_number, firm_fpga = res_str.split(',')
179 self.model_number = model_number

~\AppData\Roaming\Python\Python39\site-packages\qcsapphire\pulser.py in query(self, data)
223 return_val = self._readlines()
224 else:
--> 225 return_val = self._readline()
226
227 return return_val

~\AppData\Roaming\Python\Python39\site-packages\qcsapphire\pulser.py in _readline(self)
162 '''
163 rdata = self._inst.readline()
--> 164 return self._check_error(rdata.decode('utf-8').strip())
165
166 def _readlines(self):

~\AppData\Roaming\Python\Python39\site-packages\qcsapphire\pulser.py in _check_error(self, string)
128 except Exception as e:
129 self._readlines() #flush out the read return on error to be ready for next query
--> 130 raise e
131
132 return string

~\AppData\Roaming\Python\Python39\site-packages\qcsapphire\pulser.py in _check_error(self, string)
107
108 try:
--> 109 if string[0] == '?':
110 if string[1] == '1':
111 raise Exception(f'Incorrect prefix, i.e. no colon or * to start command. Last write command == {self.last_write_command}')

IndexError: string index out of range

what do you think, am I mising some prequisites or something else is wrong?

@gadamc
Copy link
Collaborator Author

gadamc commented Aug 31, 2023

Hi @palnitishh. What is the output of

import qcsapphire
qcsapphire.discover_devices()

Actually, @palnitishh -- can you move this to a new issue?

And can you tell me details of the device you're using? Based on the error message, It looks like the *IDN command didn't work and the returned value from the device is an empty string.

@gadamc
Copy link
Collaborator Author

gadamc commented Aug 31, 2023

From @palnitishh

Hi @gadamc
thank you for your reply here is the screenshot.
COM4 is connected to Quantum Composer.

264759883-1be8991f-d5fa-4dd8-bc15-1a41c32f5f64

@gadamc
Copy link
Collaborator Author

gadamc commented Aug 31, 2023

From @palnitishh

the QC terminal is able to do *IDN command

264760547-6d0bd6cc-2be4-4b58-a451-953a5dd0d79a

@gadamc
Copy link
Collaborator Author

gadamc commented Aug 31, 2023

@palnitishh -- I'm not 100% sure, but the output from the QC terminal seems to suggest that your device is QC 9528. https://www.quantumcomposers.com/pulse-delay-generator-9520. This python package (qt3uw/qcsapphire) was only ever tested with QC 9200 devices. A quick review of the manual for the 9520 and the 9200 reveals some differences in USB communication. The 9520 uses USB 1 specs and the 9200 uses USB 2 specs. Relatedly, they use different default BAUD rates.
If you manage to find a way to update this package to support the 9520, let me know and perhaps a PR makes sense if it's not too much of a change and there don't seem to be any side effects.

@gadamc gadamc closed this as completed Aug 31, 2023
@gadamc gadamc reopened this Aug 31, 2023
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

1 participant