Overflow status & duplicated channels

Post your Linux discussions here
Post Reply
nab_durham
Newbie
Posts: 0
Joined: Mon Oct 24, 2011 12:27 pm

Overflow status & duplicated channels

Post by nab_durham »

I am using a Picoscope 2205 under Linux (Fedora 10 I believe) and am having problems with the block mode readout. This is the mode I require for my application. I however have run into several issues,

1a. The overflow parameter from ps2000_get_times_and_values should only return a value of 0,1,2, or 3 as I understand it. However I frequently see larger values such as 40, 80, or 140 ('0b101000', '0b1010000', '0b10001100'). I don't understand the meaning of these values, because I thought overflow meant that the signal was being clipped (the ADC reached its range limits).

1b. I often get an overflow value that is non-zero (whatever it does mean) for very small block lengths, even 10 samples, if the sampling rate is smaller than ~320ns. I again don't understand this limitation as using even smaller block lengths does let my software work.

2. The example source code doesn't work for block mode, I can't get samples on the second 'B' channel. With my own code, I still can't readout from the 'B' channel. I either get zero values if I only readout from this channel, or I get a duplicate of the 'A' channel if I read both out. The 'scope works correctly under Windows.

many thanks for any help,
Nazim Bharmal

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Overflow status & duplicated channels

Post by Martyn »

Please ensure that overflow is set to zero before calling ps2000_get_times_and_values as the driver will only clear/set data in the lowest two bits, other bits will remain as originally passed.

For the issue with the B channel, can you post your code so that I can take a look at what is happening.
Martyn
Technical Support Manager

nab_durham
Newbie
Posts: 0
Joined: Mon Oct 24, 2011 12:27 pm

Re: Overflow status & duplicated channels

Post by nab_durham »

Hello. I've attached a small piece of source code that doesn't work in reading out the B channel using block mode. I use the latest version of the Linux driver and the code outputs the following from the ps2000_get_unit_info( function:

Code: Select all

Driver Version: 3.6.2.0 Linux
USB Version: 2.0
Hardware Version: 16
Variant Info: 2205
Serial: AU333/360
and it is running on a laptop with the following uname -a output:

Code: Select all

Linux localhost.localdomain 2.6.32.26-175.fc12.i686 #1 SMP Wed Dec 1 21:52:04 UTC 2010 i686 i686 i386 GNU/Linux
The code must be recompiled to change which channel is enabled (lines 72 & 77), with the 3rd parameter controlling the enablement. (This is just for general reference.)
If channel A is enabled, then with no input attached to the 'scope, I get sampling noise as output. If channel B is enabled, then I get output of zeros (not noise) unless channel A is also enabled in which case I get the same noise from channels A and B.
I have, independently, written code which displays identical behaviour from my 'scope. If I connect signals then again the duplicated/zero behaviour from channel B is shown.
Attachments
picotest.cpp
C++ source code. Requires libps2000 to compile, formally defined as C++ but ought to be written principally in C.
(2.36 KiB) Downloaded 783 times

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Overflow status & duplicated channels

Post by Martyn »

I have tried your code and couldn't find a problem when using a 2204 here

Code: Select all

martyn@ubuntu:~/pico/ps2000$ ./picotest
Handle: 1
Device opened successfully
Driver Version: 3.6.2.0 Linux
USB Version: 2.0
Hardware Version: 16
Variant Info: 2204
Serial: AY149/118
Model 2205 supported
count=50
  0 : 42 0
  1 : 42 0
  2 : 42 0
  3 : 42 0
  4 : 42 0
  5 : 42 0
  6 : 42 0
  7 : 42 0
  8 : 42 0
  9 : 42 0
 10 : 42 0
 11 : 42 0
 12 : 42 0
 13 : 42 0
 14 : 42 0
 15 : 42 0
 16 : 42 0
 17 : 42 0
 18 : 42 0
 19 : -261 0
 20 : -261 0
 21 : -261 0
 22 : 42 0
 23 : 42 0
 24 : 42 0
 25 : 42 0
 26 : 42 0
 27 : -261 0
 28 : 42 0
 29 : -261 0
 30 : 42 0
 31 : 42 0
 32 : 42 0
 33 : 42 0
 34 : 42 0
 35 : 42 0
 36 : -261 0
 37 : -261 0
 38 : 42 0
 39 : 42 0
 40 : 42 0
 41 : 42 0
 42 : 42 0
 43 : 42 0
 44 : 42 0
 45 : 42 0
 46 : -261 0
 47 : 42 0
 48 : -261 0
 49 : -261 0
martyn@ubuntu:~/pico/ps2000$ ./picotest
Handle: 1
Device opened successfully
Driver Version: 3.6.2.0 Linux
USB Version: 2.0
Hardware Version: 16
Variant Info: 2204
Serial: AY149/118
Model 2205 supported
count=50
  0 : 0 -165
  1 : 0 137
  2 : 0 137
  3 : 0 -165
  4 : 0 -165
  5 : 0 137
  6 : 0 137
  7 : 0 -165
  8 : 0 -165
  9 : 0 137
 10 : 0 -165
 11 : 0 137
 12 : 0 137
 13 : 0 137
 14 : 0 137
 15 : 0 137
 16 : 0 137
 17 : 0 -165
 18 : 0 -165
 19 : 0 -165
 20 : 0 -165
 21 : 0 137
 22 : 0 -165
 23 : 0 137
 24 : 0 -165
 25 : 0 137
 26 : 0 137
 27 : 0 137
 28 : 0 137
 29 : 0 137
 30 : 0 137
 31 : 0 137
 32 : 0 -165
 33 : 0 137
 34 : 0 137
 35 : 0 137
 36 : 0 -165
 37 : 0 137
 38 : 0 137
 39 : 0 137
 40 : 0 -165
 41 : 0 -165
 42 : 0 -165
 43 : 0 137
 44 : 0 -165
 45 : 0 137
 46 : 0 137
 47 : 0 137
 48 : 0 -165
 49 : 0 137
martyn@ubuntu:~/pico/ps2000$ ./picotest
Handle: 1
Device opened successfully
Driver Version: 3.6.2.0 Linux
USB Version: 2.0
Hardware Version: 16
Variant Info: 2204
Serial: AY149/118
Model 2205 supported
count=50
  0 : 42 137
  1 : 42 137
  2 : 42 137
  3 : 42 137
  4 : 42 137
  5 : 42 137
  6 : 345 137
  7 : 42 137
  8 : 345 137
  9 : 42 137
 10 : 42 -165
 11 : 42 137
 12 : 42 137
 13 : 42 137
 14 : 42 137
 15 : 42 137
 16 : 42 137
 17 : 42 137
 18 : 42 137
 19 : 42 137
 20 : 42 137
 21 : 42 137
 22 : 42 137
 23 : 42 137
 24 : 42 137
 25 : 42 137
 26 : 42 137
 27 : 42 137
 28 : 42 137
 29 : 42 137
 30 : 42 137
 31 : 42 137
 32 : 42 137
 33 : 42 137
 34 : 42 137
 35 : 42 137
 36 : 42 137
 37 : 42 137
 38 : 42 137
 39 : 42 137
 40 : 42 137
 41 : 42 137
 42 : 42 137
 43 : 42 137
 44 : 42 137
 45 : 42 137
 46 : 42 137
 47 : 42 137
 48 : 42 137
 49 : 42 137
martyn@ubuntu:~/pico/ps2000$
Are you using the Pico Blue USB lead and is the laptop plugged into the mains ?
Martyn
Technical Support Manager

nab_durham
Newbie
Posts: 0
Joined: Mon Oct 24, 2011 12:27 pm

Re: Overflow status & duplicated channels

Post by nab_durham »

Hello. Many thanks for checking so quickly with my code---I was fairly convinced that it was correctly written; even though I didn't structure picotest.cpp, it is so straightforward that it is hard to go amiss.

I am using the supplied USB lead (tried another with the same result) and the computer is plugged into the mains.

Using the picotest.cpp code, I have tried today using a different Linux PC (64-bit this time) in a desktop configuration, so quite different hardware. I get the same behaviour as with the first computer, which is a laptop.

I then tried compiling the same code under Windows using a virtual PC application (VirtualBox 4 in Windows XP on my Macintosh and VC++ Express) and the 'scope now does work as expected: independent behaviour of channels A and B, with the expected noise when there is no input.

So I have to conclude that there is an issue with the Linux library and our Picoscope. My application requires Linux, so I can't realistically use Windows. I can manage with just channel A working but this means I don't get a timestamp nor can I trigger from channel B. I am flying on Saturday with the 'scope so there is little time to accomodate a 'fixed'/working solution.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Overflow status & duplicated channels

Post by Martyn »

I would consider giving it a test with a delay in the run_block for loop so that you don't overpoll the driver for the ready condition

Code: Select all

   ps2000_run_block(handle, 50, 2, 1, &runtime);
   for(; ; ) 
      if(ps2000_ready(handle) == 1)
	 break;
Martyn
Technical Support Manager

nab_durham
Newbie
Posts: 0
Joined: Mon Oct 24, 2011 12:27 pm

Re: Overflow status & duplicated channels

Post by nab_durham »

My other code does have the delay. Adding a one second poll delay to picotest.cpp makes no difference to the behviour of the buffer contents for the two channels. I've also tried putting in non-physical ADC values into the buffer (1) and this shows the buffer for channel B is being erroneously overwritten by zero when it alone is the activated channel. This over-writing behaviour doesn't happen for channel A.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Overflow status & duplicated channels

Post by Martyn »

When you tried a different Linux machine was this with the same Linux distro or a different one ?
Martyn
Technical Support Manager

nab_durham
Newbie
Posts: 0
Joined: Mon Oct 24, 2011 12:27 pm

Re: Overflow status & duplicated channels

Post by nab_durham »

(I'm not sure if the reply I sent from on-site reached the forum, I can't see it but I was very tired having worked till early morning.)

A small update on the situation that partially resolves matters.

On site, I found a Picoscope 3424 and after the straightforward modication of my code to incorporate Picoscope 3k compatibility, I found that I could read out independently any pair of channels from that 4-input 'scope. Using the provided library for 64bit Linux, all was well. That library was supplied in a RPM which also contained a Picoscope 2k library.

Upon closer examination this morning, it does seem that this latter 2k library is more up-to-date: different version numbers in the filename, physically longer.

More importantly, using the 3k-provided 2k library meant I could successfully readout from the A and B channels with the PS 2205. Simple triggering also worked.

However, the intial issue regarding the overflow parameter from get_times_and_values or get_values and the non-documented output values for various sampling times remains. Note that I had to use get_values rather than get_times_and_values to avoid non-zero overflow so I could get my data, using the PS 3424. I've made a table regarding the overflow values from the PS 2205 for various sampling times:
rate/ns | 32| 64|128|256|512|
10| 0| 0| 0| 0|139|
20| 0| 0|139|139|139|
40| 0|139|139| 0|139|
80|139|139| 0|139|139|
160|139|139|139|139|139|
320| 0| 0| 0| 0| 0|
640| 0| 0| 0| 0| 0|
1280| 0| 0| 0| 0| 0|
2560| 0| 0| 0| 0| 0|
5120| 0| 0| 0| 0|139|
10240| 0| 0| 0|139| 0|
20480| 0| 0| 0|139|139|
40960| 0|139|139|139|139|
81920|139|139| 0|139|139|
163840|139|139|139|139|139|
327680| 0| 0| 0| 0| 0|
655360| 0| 0| 0| 0| 0|
1310720| 0| 0| 0| 0| 0|
2621440| 0| 0| 0| 0| 0|
5242880| 0| 0| 0| 0|139|
10485760| 0| 0| 0|139|139|
20971520| 0| 0|139|139| 0|
41943040| 0|139|139|139|139|
(The table should be viewed in a proportional font.) For 320ns sampling rate, I can obtain about 6000 samples, not the 8000-odd that the code report ought to be available from get_timebase.

I hope this information proves useful to someone, I'm now away from this topic.

quasar
Newbie
Posts: 0
Joined: Wed Dec 07, 2011 9:32 pm

Re: Overflow status & duplicated channels

Post by quasar »

I had the EXACT same problem with the 2204. I could not get Chan B to read values by itself. When both channels are activated channel B just gave me a copy of Chan A. I did as the previous poster did and downloaded the 3204 drivers 64-bit and saw a more recent library for the 2000 series. This fixed my problem. I hope someone at Pico can look into this. If the previous poster did not share his findings, I would be pulling my hair out (thanks nab_durham, I owe you!!!!)

Anyways I am otherwise very pleased with the PicoScope and the Linux drivers(after the learning curve). Thanks PicoTech for the Linux support.

Post Reply