Skip to content

Rigol DS1102Z-E USBTMC read regression #463

@ius

Description

@ius

Recent changes to the USBTMC read implementation break support for Rigol DS1102Z-E (and possibly other Rigol devices).

PR #449 changed the USBTMC response read implementation to assume a transfer is complete once a short packet (i.e. <= usb_recv_ep.wMaxPacketSize) is received based on the following excerpt from the USBTMC spec (§3.3):

The device must always terminate a Bulk-IN transfer by sending a short packet. The short packet
may be zero-length or non zero-length.

Unfortunately, it looks like Rigol does not adhere to this part of the spec - no such packets are sent by my Rigol DS1102Z-E. Which also implies pyvisa never manages to complete a transfer if the transfer is exactly usb_recv_ep.wMaxPacketSize bytes.

Trivial reproducer:

#!/usr/bin/env python3
import pyvisa

rm = pyvisa.ResourceManager('@py')
scope = rm.open_resource(rm.list_resources()[0])

scope.write('WAV:SOUR CH1')
scope.write('WAV:STAR 1')
scope.write('WAV:STOP 128')
data = scope.query_binary_values('WAV:DATA?', datatype='B', expect_termination=False)
print('received:', len(data))

Pyivsa should hang, not even responding to SIGINT.

(As it happens the *IDN? response for my device is also exactly usb_recv_ep.wMaxPacketSize (64) bytes, but that might not be the case for other models)

Note: looks to me @arr-ee might have been experiencing a similar issue on his Siglent device when testing the PR: #449 (comment) - alas, my device is a Rigol and it's on the latest firmware available (00.06.03.SP2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions