usbtmc assertion failure
See original GitHub issueLinux, Python3 - talking to a Rigol ds1102e scope. Most operations complete ok. Trying to get the channel data from the scope. ie: rawdata = inst.query_binary_values(“:WAV:DATA? CHAN1”)[10:] Which is on the order of 1024 n-bit values. (I think - not really sure)
usbtmc.py croaks.
File "./test.py", line 42, in <module>
main()
File "./test.py", line 29, in main
rawdata = inst.query_binary_values(":WAV:DATA? CHAN1")[10:]
File "/usr/local/lib/python3.4/dist-packages/pyvisa/resources/messagebased.py", line 458, in query_binary_values
block = self.read_raw()
File "/usr/local/lib/python3.4/dist-packages/pyvisa/resources/messagebased.py", line 283, in read_raw
chunk, status = self.visalib.read(self.session, size)
File "/usr/local/lib/python3.4/dist-packages/pyvisa-py/highlevel.py", line 297, in read
return self.sessions[session].read(count)
File "/usr/local/lib/python3.4/dist-packages/pyvisa-py/usb.py", line 107, in read
usb.USBError)
File "/usr/local/lib/python3.4/dist-packages/pyvisa-py/sessions.py", line 312, in _read
current = reader()
File "/usr/local/lib/python3.4/dist-packages/pyvisa-py/usb.py", line 101, in <lambda>
return self._read(lambda: self.interface.read(1),
File "/usr/local/lib/python3.4/dist-packages/pyvisa-py/protocols/usbtmc.py", line 327, in read
response = BulkInMessage.from_bytes(resp)
File "/usr/local/lib/python3.4/dist-packages/pyvisa-py/protocols/usbtmc.py", line 95, in from_bytes
assert msgid == MsgID.dev_dep_msg_in
AssertionError
Here are the setup details:
python3 -m visa info
Machine Details:
Platform ID: Linux-3.13.0-45-generic-i686-with-Ubuntu-14.04-trusty
Processor: i686
Python:
Implementation: CPython
Executable: /usr/bin/python3
Version: 3.4.0
Compiler: GCC 4.8.2
Bits: 32bit
Build: Apr 11 2014 13:05:18 (#default)
Unicode: UCS4
PyVISA Version: 1.6.3
Backends:
ni:
Version: 1.6.3 (bundled with PyVISA)
#1: /usr/lib/i386-linux-gnu/libvisa.so.0.0.0:
found by: auto
bitness: 32
Could not get more info:
VI_ERROR_NSUP_ATTR (-1073807331): The specified attribute is not defined or supported by the referenced object.
py:
Version: 0.1
TCPIP INSTR: Available
USB INSTR: Available via PyUSB (1.0.0b2). Backend: libusb1
ASRL INSTR: Available via PySerial (N/A)
Thanks for PyVisa-py - I’ve gotten further with it than with librevisa. Let me know if you need any more details.
Jason H.
Issue Analytics
- State:
- Created 9 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Universal Serial Bus Test and Measurement Class, Subclass ...
INTELLECTUAL PROPERTY DISCLAIMER. THIS SPECIFICATION IS PROVIDED “AS IS” WITH NO WARRANTIES WHATSOEVER INCLUDING.
Read more >757 – g_variant_unref assertion failed - sigrok
Apparently only occurs on Win* . Tested with last nightly sigrok-cli build: "$ sigrok-cli -i olimex_stm32-h103_usb_hid.sr -P ...
Read more >Migrate Harmony 1 project to Harmony 3
Hi, i have a project developed in harmony 1.06 that implements an USB device of the USBTMC instruments Class devices. For a disk...
Read more >PWS4205, PWS4305, PWS4323, PWS4602, and PWS4721 ...
In order for the PC to recognize the power supply, a USBTMC driver must be ... enables the power-on status clear and prevents...
Read more >Instruction Manual (Remote Control)
Includes the list of error messages replied by the DP-G Series in response ... To use a USB interface, USBTMC device driver software...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Linux, Python3 - talking to a Siglent SDG 805 Signal Generator. Identical issue. The SDG runs fine under Win10 with NI-VISA, that’s why i am necromancing this issue.
I can write to the device without problems. But reading from it, i run, as reported above, in an issue with the assertion. I can also confirm that this is linked to message partitioning by the device. The first message part is 64 Byte long. The second usually shorter, which appears to cause the assertion error. It seems
USBTMC.read()
is called twice bymessagebased.read_raw()
frompyvisa
, and this function would indeed concatenate partitioned messages.As NI-VISA as a backend works, and as
pyvisa
can concatenate partitioned messages, i therefore decided to tweakpyvisa-py
. I solved the issue (for my machine and device) by adding an additional quirky message class constructor forBulkInMessage
in usbtmc.py, and calling it whenever the assertion fails. In addition, my device added trailing zeros, which needed to be removed, even if the rest of the message would conform. My working expansion is below:I am uncertain, how this could conflict with other devices. I will likely be able to test it in February with a RIGOL DG 1062Z and a RIGOL 1052E
I see, thank you!
I also found that there were a bunch of extra b’\x00’ bytes in the data strings, that I removed with a
data = data.rstrip(b'\x00')
, for future reference.