I've been trying to get pyvisa going with my UTG962E. It's mostly working, except for grabbing a screenshot with
Display:Data?. The scripit hangs when trying to read the bitmap.
I'd love some help troubleshooting this. This is on Ubuntu 24.04, python 3.12.3, pyvisa 1.14.1 with the pyvisa_py backend (0.7.2).
Here's the code:
import pyvisa
pyvisa.log_to_screen()
ADDR = "USB0::26198::2100::AWG1523500244::0::INSTR"
rm = pyvisa.ResourceManager()
sgen = rm.open_resource(ADDR)
sgen.write("*IDN?")
print(sgen.read())
sgen.write("Display:Data?")
disp = sgen.read_raw()[15:] # <<< HANGS HERE
There's nothing especially interesting in the pyvisa logs:
2024-10-03 12:50:28,848 - pyvisa - DEBUG - No visa library specified, trying to find alternatives.
2024-10-03 12:50:28,848 - pyvisa - DEBUG - Environment variable PYVISA_LIBRARY is unset.
2024-10-03 12:50:28,869 - pyvisa - DEBUG - Not loading dll_extra_paths because we are not on Windows or Python < 3.8
2024-10-03 12:50:29,440 - pyvisa - DEBUG - Automatically found library files: [None, None, None, None, None]
2024-10-03 12:50:29,441 - pyvisa - DEBUG - No user defined library files
2024-10-03 12:50:29,441 - pyvisa - DEBUG - Did not find IVI binary
2024-10-03 12:50:29,453 - pyvisa - DEBUG - SerialSession was not imported No module named 'serial'.
2024-10-03 12:50:29,522 - pyvisa - DEBUG - USBSession and USBRawSession were correctly imported.
2024-10-03 12:50:29,538 - pyvisa - DEBUG - TCPIPSession was correctly imported.
2024-10-03 12:50:29,541 - pyvisa - DEBUG - GPIBSession was not imported No module named 'gpib'.
2024-10-03 12:50:29,541 - pyvisa - DEBUG - pyvisa-py is available.
2024-10-03 12:50:29,541 - pyvisa - DEBUG - Created library wrapper for py
2024-10-03 12:50:29,542 - pyvisa - DEBUG - Created ResourceManager with session 8035761
2024-10-03 12:36:55,882 - pyvisa - DEBUG - USB0::26198::2100::AWG1523500244::0::INSTR - opening ...
2024-10-03 12:36:55,906 - pyvisa - DEBUG - USB0::26198::2100::AWG1523500244::0::INSTR - is open with session 8719109
2024-10-03 12:36:55,908 - pyvisa - DEBUG - USB0::26198::2100::AWG1523500244::0::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
UNI-T Technologies,UTG900E,AWG1523500244,3.06
2024-10-03 12:36:55,911 - pyvisa - DEBUG - USB0::26198::2100::AWG1523500244::0::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
Given that some of you got this working earlier in the thread, I'd love to understand the diff between your environment and mine.
Edit 1: forgot to mention that this is on aarch64 (Raspberry Pi).
Edit 2: I've been playing with other SCPI commands. It appears that some commands consistently work while other consistently fail, and this seems to correlate with the length of the response. I wonder if exceeding the USB device's wMaxPacketSize (64 bytes) might be what's triggering the issue. Or something along those lines. Thoughts?
Edit 3: I saw
this commit from two days, but it didn't help. I also added a bunch of logging throughout the stack, which suggested it's not a packet reconstruction isssue: for a broken command, the very first read from the libusb1 endpoint seems to block forever.