Thread Tools
Sep 08, 2008, 03:59 PM
Registered User
Quote:
Originally Posted by davidgrm
Last point first - yes the waveform file does seem to contain the LA data but at a much higher resolution - more samples
Oh, cool. So there's even a way to get that data without a PC.

Quote:
I dont seem to get the junk data - First two bytes is 00 08 which is hex 2048 the number of bytes to follow. The rest all seem to contain valid data.
Hmm, there's no 2048 in my :WAV:DATA? DIG, nor or there a 1024 in
:WAV:DATA? CHANx. In fact, an LA dump I just took began with a lot
of boring zeroes. I wonder if the 2048 may be actually part of the
header USBTMC puts before the 2048 bytes block

Quote:
If you change the time scale on the Rigol for the same data then the data is changed when you read to the PC.
That's correct. You always get what's shown on the scope's screen.
So if you want to retrieve the full recording, you have to zoom in with
:TIM:SCAL to the point where one recorded sample equals one retrieved
sample, and then step through the buffer with :TIM:OFFS and :WAV:DATA
what's there.

This is what I do in the function rigol_wave in lib/scope.py

Unfortunately, this means that, if your download gets interrupted, you'll
leave the scope in a state different from the acquisition, and you aren't
able to revert to that state using just information contained in the scope.
That's why, say, Agilent also let you retrieve the settings at acquisition
time.

Quote:
I have also seen that at some slower speeds there is the junk that you mentioned even if you dont adjust things but at other speed the whole buffer seems to contain valid data
That could be linked to the scope sometimes recording data outside
the display area. Unfortunately, this isn't entirely under user control:
if you set long memory, you'll find that it uses 100MSa/s for a wide
range of horizontal speeds, and you see the "window" on top of the
screen change. (Disable the LA for this.)

Might be that some of that data ends up in the "junk", but I wouldn't
even trust this to be correct. One problem of the junk is that it is
visibly some data that has once been acquired, so it may look
deceptively like real data of the current acquisition.

- Werner
Sign up now
to remove ads between posts
Sep 08, 2008, 04:35 PM
Registered User
Quote:
Originally Posted by davidgrm
I read on one of those other forums that you gave links for that the LA module uses an Altera Cyclone2 FPGA.
This makes it a notch more complicated :-( The DA theory sounds
solid. It probably also means that just a firmware update won't do.

Quote:
Take a look here : http://minila.sourceforge.net/ this is a DIY LA.
That looks like a very nice project :-) Thanks !

- Werner
Sep 08, 2008, 08:02 PM
Hi Werner,

OK, I've done that lot. Ubuntu all installed, updated, and as far as the gnuplots on screen.

Admittedly I'm a bit dim. Where to now please?

I think next the objective would be to start issuing commands to the Rigol via the USB port and to export some data from the device. I don't really know too much about UNIX (short of following set procedures) so please post back and I'll play from there.

Alison
Sep 08, 2008, 09:21 PM
Registered User
Quote:
Originally Posted by Alison F
Ubuntu all installed, updated, and as far as the gnuplots on screen. :)
Excellent ! How about a screenshot now ?

Go to demo/, then run:
% ./screen.py foo.png

View it with
% display foo.png

What you're really looking for is of course this:
% ./rigoldump.py out

Now you can see channel 1 with
gnuplot> plot "out" using 1:2 with lines

Channel 2 is
gnuplot> plot "out" using 1:3 with lines

Digital channel 0:
gnuplot> set yrange [-0.2:1.2]
gnuplot> plot "out" using 1:4 with lines

(Set the range to keep autoscaling from making 0 and 1 get overlaid
with the frame.)

You can of course mix things as well:
gnuplot> set style data lines
gnuplot> set autoscale y
gnuplot> plot "out" using 1:3, "out" using 1:6

Instrument control is still a bit rough at the moment. I'll fix a few bugs
and then post an update.

- Werner
Sep 09, 2008, 02:55 AM
Registered User
Werner I noticed that many times the Rigol gets stuck in a mode where it accepts commands but I cannot unlock the keyboard. The only way out is to switch off. Have you had this issue?
Sep 09, 2008, 05:42 AM
Registered User
Quote:
Originally Posted by davidgrm
Werner I noticed that many times the Rigol gets stuck in a mode where it accepts commands but I cannot unlock the keyboard. The only way out is to switch off. Have you had this issue?
Does pressing "FORCE" not help ? Or try sending :KEY:LOCK DIS
(I should actually send that as well. Not nice to require people to
always manually unlock.)

I've only seen one lock-up so far, and that was by entering the system
settings screen, and then issuing a remote command. :KEY:LOCK DIS
would probably have gotten me out of this as well, though.

- Werner
Sep 09, 2008, 03:10 PM
Registered User
Tried all that - does nothing - can still send data to it via serial port and get reply but keyboard stays dead - even tried :KEY:FORCE - did nothing
Sep 09, 2008, 06:09 PM
Registered User
Quote:
Originally Posted by davidgrm
Tried all that - does nothing
Funny. Either you're sending something it really doesn't like,
e.g., a mal-formed USB TMC protocol message, or it's a bug I
dodged so far.

Oh, one detail: you may need to add a little delay (~100ms)
between messages or some of them may get lost.

For reference, my firmware is still 02.03.17. I should get 03.xx
soonish.

- Werner
Sep 09, 2008, 06:32 PM
Registered User
Quote:
Originally Posted by wpwrak
Instrument control is still a bit rough at the moment.
It's a bit better now but still not perfect. To update, run this:

Code:
% cd tmc
% svn update
% make
% sudo make install
Here's a brief example how the scope can now be used:

Code:
#!/usr/bin/python

import time
from pylab import *
from tmc.scope import *
from tmc.trigger import *

s = rigol_ds1000c()

s.hor.pos = 0
s.hor.scale = 100e-6

ch = s.ch[1]
ch.pos = 1.5
ch.scale = 1

t = edge(slope = slope.Rising, level = 1.65)

t.source(ch)

s.hor.sweep = sweep.Single
s.hor.stop()
s.hor.run()

while s.hor.state() != state.Stop:
    time.sleep(0.1)
Note that "pos" is the position of the center of the screen, so it's
the negative channel offset but the positive trigger offset.
s.ch[0] is CH1, s.ch[1] is CH2.

There are still problems when acquiring with a narrow window and
then zooming out. E.g., this eye diagram taken with a scale of
100us/div looks reasonably healthy (besides the low resolution and
the lone glitch that's probably a bug in my synchronization function):
http://people.openmoko.org/werner/rigol/eye-in.png

But this one, taken with 10ns/div, has too many transients that
don't happen in real life: http://people.openmoko.org/werner/rigol/eye-out.png

- Werner
Last edited by wpwrak; Sep 09, 2008 at 06:33 PM. Reason: scale is time per div, not just time ...
Sep 09, 2008, 07:27 PM
Hi Werner,

Here's where I am. Ubuntu install, packages suggested installed, network configured (after some fun with this Sony Vaio's RTL8139 etho), Rigol DS1022CD connected via USB.

1. CH1 probe connected to 1Khz test point
2.) Rigol set to Run/Stop : Green. Running

And now the fun begins. I'm of course missing something. Here's the output from my terminal window.

Code:
[email protected]:~$ cd /
[email protected]:/$ ls
bin   cdrom  etc   initrd      lib         media  opt   root  srv  tmp  var
boot  dev    home  initrd.img  lost+found  mnt    proc  sbin  sys  usr  vmlinuz
[email protected]:/$ cd home
[email protected]:/home$ ls
alison
[email protected]:/home$ cd alison
[email protected]:~$ ls
Desktop  Documents  Examples  Music  Pictures  Public  Templates  tmc  Videos
[email protected]:~$ cd tmc
[email protected]:~/tmc$ ls
build  examples  io.h  Makefile  README    telnet.c  tmc.h  usbtmc.c
demo   io.c      lib   python.c  setup.py  tmc.c     tty.c
[email protected]:~/tmc$ cd demo
[email protected]:~/tmc/demo$ ls
clean        digitize.py  input  rigoldump.py  set     wavemath.py
deglitch.py  fft.py       noisy  screen.py     spi.py
[email protected]:~/tmc/demo$ ./screen.py foo.png
cannot set configuration (error -1)
ERROR 100
Traceback (most recent call last):
  File "./screen.py", line 14, in <module>
    scope = tmc.scope.rigol_ds1000c()
  File "/usr/lib/python2.5/site-packages/tmc/scope.py", line 304, in __init__
    "vendor=0x0400", "product=0x05dc")
  File "/usr/lib/python2.5/site-packages/tmc/instrument.py", line 111, in __init__
    self.__tmc = _tmc.Instr(*args)
SystemError: NULL result without error in PyObject_Call
[email protected]:~/tmc/demo$
So that's where I am?

I'm wondering, do I need to connect via a serial port? Unfortunately this laptop doesn't have one, but I do have one of those USB/RS232 adapters. Just dependent on Linux drivers for it.

Help!!

I do like this Ubuntu btw though. It bridges the gap between terminal UNIX and a regular GUI rather well. This is being written right now in Firefox.
Last edited by Alison F; Sep 10, 2008 at 01:28 PM.
Sep 10, 2008, 03:39 PM
Registered User
Quote:
Originally Posted by Alison F
cannot set configuration (error -1)
Ah, that happens when it doesn't find the device. Chances are
that yours has a different product ID. The nice way to find out
would be

Code:
% sudo mount -t usbfs none /proc/bus/usb
% sudo apt-get install usbview
% usbview
If usbview fails, try
Code:
% sudo usbview
Then you should see it listed as "DS100 SERIES" or similar,
Double-clicking shows (among a lot of other parameters) the
"Vendor Id" and the "Product Id". When you put these numbers
into lib/scope.py, about line 316, then return to the tmc/ directory
and

Code:
% make
% sudo make install
it should recognize your scope.

If sudo mount -t usbfs none /proc/bus/usb
doesn't work, try
sudo mount -t usbdevfs none /proc/bus/usb

If this also fails, there's still the time-proven hard way to do it,
with lsusb. Look for an ID (vendor:product) that is similar to the
0400:05dc of the DS1102CD. If none is similar, you can get more
details with sudo lsusb -v and search for the entry that says
"Rigol".

Oh, and when you find the right IDs, please post them, so that I
can make this mechanism a little smarter. If anyone else feel like
posting the IDs of their devices, please feel free to do so. The more
the merrier :)

Quote:
I'm wondering, do I need to connect via a serial port? Unfortunately this laptop doesn't have one, but I do have one of those USB/RS232 adapters. Just dependent on Linux drivers for it.
After the above change, USB should be fine. I haven't added support
for accessing the Rigol via RS232 to TMC yet (although it should be
simple to do this), but as far as Linux drivers are concerned, it's
pretty much plug and play.

Quote:
I do like this Ubuntu btw though. It bridges the gap between terminal UNIX and a regular GUI rather well. This is being written right now in Firefox.
Hurray, we have another convert ! :-)

- Werner
Sep 10, 2008, 04:36 PM
Right here goes.

Code:
[email protected]:~/tmc/demo$ 
[email protected]:~/tmc/demo$ sudo mount -t usbfs none /proc/bus/usb
[sudo] password for alison: 
[email protected]:~/tmc/demo$ sudo apt-get install usbview
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed
  usbview
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 203kB of archives.
After this operation, 651kB of additional disk space will be used.
Get: 1 http://gb.archive.ubuntu.com hardy/universe usbview 1.0-11 [203kB]
Fetched 203kB in 0s (226kB/s)   
Selecting previously deselected package usbview.
(Reading database ... 98624 files and directories currently installed.)
Unpacking usbview (from .../usbview_1.0-11_i386.deb) ...
Setting up usbview (1.0-11) ...

[email protected]:~/tmc/demo$ usbview
Now it lauches a GUI application, and I'm cutting and pasting it's output below.

Code:
DS1000 SERIES 
Manufacturer: Rigol Technologies
Speed: 12Mb/s (full)
USB Version:  1.10
Device Class: ff(vend.)
Device Subclass: ff
Device Protocol: ff
Maximum Default Endpoint Size: 64
Number of Configurations: 1
Vendor Id: 0400
Product Id: 05dc
Revision Number:  1.00

Config Number: 1
	Number of Interfaces: 1
	Attributes: c0
	MaxPower Needed:   2mA

	Interface Number: 0
		Name: (none)
		Alternate Number: 0
		Class: fe(app. ) 
		Sub Class: 03
		Protocol: 01
		Number of Endpoints: 2

			Endpoint Address: 01
			Direction: out
			Attribute: 2
			Type: Bulk
			Max Packet Size: 64
			Interval: 0ms

			Endpoint Address: 82
			Direction: in
			Attribute: 2
			Type: Bulk
			Max Packet Size: 64
			Interval: 0ms
Yes. I see 'DS1000 SERIES'. OK. we're after the 'Vendor' and 'Product' IDs. Let's grab those. 0400 and 05dc .

Let's have a look in lib/scopy.py around line 316.

Code:
[email protected]:~/tmc/lib$ cat scope.py | grep vendor
          "vendor=0x0400", "product=0x05dc")
[email protected]:~/tmc/lib$
OK so they're the same. We're getting clever now, notice the use of GREP.

Next.

Code:
[email protected]:~/tmc/demo$ 
[email protected]:~/tmc/demo$ cd ..
[email protected]:~/tmc$ ls
build  demo  examples  io.c  io.h  lib  Makefile  python.c  README  setup.py  telnet.c  tmc.c  tmc.h  tty.c  usbtmc.c
[email protected]:~/tmc$ make
python setup.py build
running build
running build_py
running build_ext
find build -name tmc.so -exec mv '{}' . \;
[email protected]:~/tmc$ sudo make install
[sudo] password for alison: 
python setup.py install
running install
running build
running build_py
running build_ext
running install_lib
running install_egg_info
Removing /usr/lib/python2.5/site-packages/tmc-0.0.egg-info
Writing /usr/lib/python2.5/site-packages/tmc-0.0.egg-info
[email protected]:~/tmc$
Code:
[email protected]:~/tmc$ 
[email protected]:~/tmc$ sudo mount -t usbfs none /proc/bus/usb
mount: none already mounted or /proc/bus/usb busy
mount: according to mtab, none is already mounted on /proc/bus/usb
[email protected]:~/tmc$ 
[email protected]:~/tmc$ sudo mount -t usbdevfs none /proc/bus/usb
mount: unknown filesystem type 'usbdevfs'
[email protected]:~/tmc$
Erm......?????

Oh, and what's the equiv of 'prompt $p $g' in the terminal shell? Which config file do I edit please? I'd just like the entire path where I am.

Sorry about the questions. And yeeep, you have a convert. Let's just put it this way... I have two laptops here side by side, this one running Ubuntu, and another running XP. The XP has just picked up that 'XP 2008 AntiVirus' virus. So just formatted the HDD and reinstalling... It locked out the restore points too. That was while searching for help with unix commands.

Okies, where to next please?
Sep 10, 2008, 06:03 PM
Registered User
Quote:
Originally Posted by Alison F
Now it lauches a GUI application, and I'm cutting and pasting it's output below.
Looks perfect. I realized that it's actually something else: you need
privileges to select the configuration. Quick and dirty solution: just
work as "root":

Code:
% sudo /bin/bash
# cd tmc/demo
# ./screen.py foo.png
That's what I do all the time as well, even though it's considered bad
style for security reasons. I have to think a bit how to make it possible
to use this without the user requiring privileges.

Quote:
OK so they're the same. We're getting clever now, notice the use of GREP.
Yeah ! :-)

Quote:
[email protected]:~/tmc$ sudo mount -t usbfs none /proc/bus/usb
mount: none already mounted or /proc/bus/usb busy
mount: according to mtab, none is already mounted on /proc/bus/usb
That's just because you already did this.

Quote:
Oh, and what's the equiv of 'prompt $p $g' in the terminal shell? Which config file do I edit please? I'd just like the entire path where I am.
Isn't this the entire path, just abbreviated ? ~ is equivalent on your
home directory, so you can, say, cd ~/tmc
You should get the full path if you go somewhere that isn't under your
home directory, e.g., cd /usr/lib

The config file would be the script that gets executed when you log on,
~/.profile or ~/.bash_profile, or the script that gets executed when a
new shell is started, ~/.bashrc

A common setting would be:
PS1='\h:\w\$ '
export PS1

This prints the host name, the directory, and an indicator whether
you're root. E.g., lab:~# for root on machine "lab" or lab:~$ if
you're not root. Note that PS1 usually gets overridden when you
change users, so you'd have to put this setting into the rc files of
all your accounts.

- Werner
Sep 10, 2008, 06:20 PM
Ok. Here goes.

Ooooh

Code:
[email protected]:~/tmc$ sudo /bin/bash
[sudo] password for alison: 
[email protected]:~/tmc# cd tmc/demo
bash: cd: tmc/demo: No such file or directory
[email protected]:~/tmc# cd demo
[email protected]:~/tmc/demo# ./screen.py foo.png
SEND :HARDCOPY
SEND :LCD:DATA?
[email protected]:~/tmc/demo#
Ahhhhh.

Erm erm. It worked!! Now for the next bit. To product the image. Erm.

Code:
[email protected]:~/tmc/demo# 
[email protected]:~/tmc/demo# ls
clean  deglitch.py  digitize.py  fft.py  foo.png  input  noisy  rigoldump.py  screen.py  set  spi.py  wavemath.py
[email protected]:~/tmc/demo# display foo.png
EXCELLENT!!!!!!!

Now for the fun bit. Attaching it to this window. Oh wow this is so cool. Brilliant Werner!!

The prompt bit will have to wait until tomorrow now. I'm up in 7-hours. So until tomorrow's posts, thank you so much for your help. Very much looking forward to what happens next.
Sep 11, 2008, 04:49 AM
Registered User
Werner, you wrote:
> Here's a similar experiment, using a DIY 1:10 resistive probe. Note that the bandwidth limiter is off: http://people.openmoko.org/werner/r...-noise-500R.png <

I'm scratching my head, because I thought resistive probes required a 50-ohm input. While my LeCroy and Tek scopes have those settings, I didn't think the Rigols did? I.e., strictly 1M-ohm inputs. I assume you must add a 50-ohm terminator at the scope inputs?


Quick Reply
Message:

Thread Tools