Author Topic: Rigol DS1045Z and pyvisa bug ?  (Read 208 times)

0 Members and 1 Guest are viewing this topic.

Offline JohnPi

  • Regular Contributor
  • *
  • Posts: 73
  • Country: us
Rigol DS1045Z and pyvisa bug ?
« on: September 02, 2018, 03:09:50 am »
I am trying to read binary waveforms from my 1045Z using pyvisa over USB. Using sockets over LAN (no pyvisa) works. I have a problem when reading certain specific lengths of data from the instrument -- specifically lengths of 8244 and increments of 64 beyond; using MDEPTH of 30000. I don't know if the issue is in the instrument or pyvisa. I have filed a ticket at https://github.com/pyvisa/pyvisa/issues/354 also. I have tried pyvisa 1.9.1, 1.9.0 & 1.8. My 1054Z is unlocked to 1104Z. This is the *IDN? RIGOL TECHNOLOGIES,DS1104Z,DS1ZA20100****,00.04.04.SP3

If anyone has the same setup, perhaps with different software/firmware versions, I would appreciate if you could run this example and report:
Code: [Select]
import visa
import numpy as np
import sys

print(sys.version)
print("visa", visa.__version__)
#visa.log_to_screen()

GPIB = visa.ResourceManager()
for resource in GPIB.list_resources(): print(resource) # list instruments -- use the 1054Z in the next line
DS1054Z = GPIB.open_resource('USB0::0x1AB1::0x04CE::DS1ZA20100xxxx::INSTR', chunk_size=40000) # You'll have to change this line
print("DS1054Z:", DS1054Z.query("*IDN?"))

DS1054Z.write(":WAV:FORMAT BYTE;:WAV:MODE RAW;:SYSTEM:BEEPER OFF")
DS1054Z.write(":ACQUIRE:MDEPTH 30000")
DS1054Z.write(":STOP")
err=0

#for NPOINTS in range(20010,30100):
for NPOINTS in range(8200,30100):# fails at 8244 and increments of 64 beyond
  print(NPOINTS, end='')
  err+=1 
  DS1054Z.write(":WAV:START 1;:WAV:STOP %i;:WAV:DATA?" % NPOINTS)
  print(">",DS1054Z.read_bytes(11),"<", end='') # Contains '#90000ddddd'
  try:
    CURVE1 = np.frombuffer(DS1054Z.read_bytes(NPOINTS), dtype='b')
  except:
    print("\nError at", NPOINTS, " after ", err)
    err=0
  print(len(CURVE1), "chars")
  DS1054Z.read_bytes(1) # trailing '\n'

This tests reading lengths from 8200 on in increments of 1. I see fails like this:
Code: [Select]
8241> b'#9000008241' <8241 chars
8242> b'#9000008242' <8242 chars
8243> b'#9000008243' <8243 chars
8244> b'#9000008244' <
Error at 8244  after  8243
8243 chars
8245> b'#9000008245' <8245 chars
8246> b'#9000008246' <8246 chars
8247> b'#9000008247' <8247 chars

and filtered, the patterns looks like:

Code: [Select]
Error at 8244  after  8243
Error at 8308  after  64
Error at 8372  after  64
Error at 8436  after  64
Error at 8500  after  64
Error at 8564  after  64
Error at 8628  after  64
Error at 8756  after  128
Error at 8820  after  64
Error at 8884  after  64
Error at 8948  after  64
Error at 9012  after  64
Error at 9076  after  64
Error at 9140  after  64
Error at 9268  after  128
Error at 9332  after  64
Error at 9396  after  64

Has anyone seen anything similar to this ?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf