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

Support of USB bind identification for iseq power supplies #235

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mjmucha
Copy link
Member

@mjmucha mjmucha commented Nov 13, 2024

The iseq SHQ 122M does not support the standard *IDN? query. Therefore this PR adds the functionality to query/read the identifier of the SHQ 122M via the # command. Additionally included is a small fix for an bug with memorized_binds.

Comment on lines +40 to +43
if read_after_query:
return inst.read()
else:
return reply
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the SHQ 122m returns as query response the command string as check if the command was executed successfully. To get the return value of an command (or in this case the identification string) one has to additionally perform a read operation.

@@ -9,7 +9,7 @@
import ruamel.yaml


def query_identification(rm, resource, baud_rate, read_termination=None, write_termination=None, timeout=1000 * 5):
def query_identification(rm, resource, baud_rate, read_termination=None, write_termination=None, timeout=1000 * 5, indentifer_cmd="*IDN?", read_after_query=False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in indentifier

@@ -105,7 +109,10 @@ def find_usb_binds(rm, log,
log.debug(f"Found memorized bind {res}")
result = memorized_binds[res]
else:
result = query_identification(rm, res, instrument['baud_rate'], instrument['read_termination'], instrument['write_termination'], timeout=timeout)
if instrument["type"].lower() == "iseg_hv":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make a global "devices_with_non_default_values" dict, so that it is easier to potentially add more devices there instead of blowing up an if clause?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, will do!

@@ -105,7 +109,10 @@ def find_usb_binds(rm, log,
log.debug(f"Found memorized bind {res}")
result = memorized_binds[res]
else:
result = query_identification(rm, res, instrument['baud_rate'], instrument['read_termination'], instrument['write_termination'], timeout=timeout)
if instrument["type"].lower() == "iseg_hv":
result = query_identification(rm, res, instrument['baud_rate'], instrument['read_termination'], instrument['write_termination'], timeout=timeout, indentifer_cmd="#", read_after_query=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same typo as above

Comment on lines 238 to 239
"name": tf["name"],
"type": "", # Standard instruments with *IQN? command
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is happening here exactly? Is this a way to define different devices with non-*IDN? identifier commands?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done to identify serial transfer layers which uses implemented non-*IDN? devices. Without the addition of "name" and "type" in this temporary instrument dictionary the linking in the code block below would not work and thus also not the logic which you commented in your third comment.

TL;DR: The serial transfer layer does not know if it is used for e.g. an SHQ 122M. Therefore this part is needed to identify an instrument correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants