New User, Using 4224 to work a sequence using SDK

Having problems ? let us know the details here
Post Reply
sMac
User
User
Posts: 3
Joined: Tue Jun 29, 2021 7:42 pm

New User, Using 4224 to work a sequence using SDK

Post by sMac »

Using the 4224 SDK for Win10, I want to use gather data from a single channel A in a repetitive sequence consisting of operations X,Y,Z,X,Y,Z,X...

Each Operation X sets the channel A to 80Meg samples/sec, for 1500 samples, triggered by channel B. Resulting data is placed into a defined block A for averaging.
Each Operation Y sets the channel A to 40Meg samples/sec, for 770 samples, triggered by channel B. Resulting data is placed into a defined block B for averaging.
Each Operation Z sets the channel A to 20Meg samples/sec, for 350 samples, triggered by channel B. Resulting data is placed into a defined block C for averaging.

Channel B triggering is done at 1 millisecond interval. An event to alert me when each Operation is completed would be good even though it introduces latency.

At the end of 100 X,Y,Z iterations of the sequence, the results of block A, Block B, and Block C are transferred.

I would appreciate your thoughts on best approaches and trade-off's. Thanks,

bennog
Advanced User
Advanced User
Posts: 206
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: New User, Using 4224 to work a sequence using SDK

Post by bennog »

I think you would have a hard time to.
1. get data from scope
2. switch to new config
3. arm triggers
4. start acquisition.
And do al this within a 1 ms time period would be impossible. (so 1000 times a second)

I have never tried this but starting from GitHub is a good start, and use C or C++ because all the other languages create extra overhead so increase the time between config switches.

Benno

Gerry
PICO STAFF
PICO STAFF
Posts: 1145
Joined: Mon Aug 11, 2014 11:14 am

Re: New User, Using 4224 to work a sequence using SDK

Post by Gerry »

Hi sMac,

Unfortunately, every time you change settings after a capture, or initiate a capture, after changing the settings, the communication between the PicoScope and computer needs to be re-established. The time to establish communication just once would be 10s of milliseconds (you couldn't even reduce the demands on the switched setups you want to have by using a 4 Channel 4424, because you want to use different sample rates). The only way to do this, exactly in the way you describe would be to use 3 different PicoScope 4224's, all using the same Trigger.

So, the 1st question that needs to be asked is "Why are you attempting to capture data this way?". It looks like you're trying to establish which method is going to give you the best result, which (depending on what you're actual measurement goal is) may not be the way to approach this (especially given the limitations that I mentioned regarding USB communication) or may not even need to be done at all (as we may already be able to suggest which method would be best for what you are hoping to achieve). So, the other questions that, when answered, would help us to help you would be "What are your measurement goals?", and "What are your constraints?".

In the meantime, as a suggestion for a better method (although, I don't know what form of averaging you would be doing on the buffers of data, or what your goals or limitations may be) if the averaging you want to implement on the complete buffers of data is something like a moving average filter for Resolution Enhancement, it would be better to just repeat operation X three times (with 1540 samples) and when you post process the data, for the 2nd of the three captures, which would be Y, first average every 2 samples for the whole 1540 samples (to get the equivalent of 770 samples at 40MS/s), and for the 3rd of the 3 captures, which would be Z, first average every 4 samples for 1400 total samples (to get the equivalent of 350 samples at 20MS/s).
With this method, you wouldn't need to do any config changes, so the only limitation would be having to repeat the captures each time in Block Mode with the time to connect and transfer over USB, and this can be eliminated by using Rapid Block Mode (which would only need microseconds in between captures, in order to re-arm the Trigger). As an example of how we may be able to save you time performing a test that may not be necessary, if your intention was performing half as much averaging for Z versus Y, and then also for Y versus X, then I can tell you that X should give you the best result, as you would have the finest granularity for your moving average filter, while Z would have the smallest moving average filter, mixed with a 4 sample wide stepped filter (which would also be true if you could have used the different sample rates, in the way you first asked). This is because a stepped filter is inferior to a same width moving average filter because it moves across the data with less precision.

Regards,

Gerry
Gerry
Technical Specialist

sMac
User
User
Posts: 3
Joined: Tue Jun 29, 2021 7:42 pm

Re: New User, Using 4224 to work a sequence using SDK

Post by sMac »

OK, so let me attempt another approach with the 4224 using a repetitive sequence process. Bear with me as I will try to be precise in my wordage:

Using the 4224 SDK for Win10, we want to gather waveform data from channel A in a repetitive sequence consisting of operations X, Y, and Z. Operation X, Y, and Z each impose a different stimulus to the device to be tested. The sequence continues for 100 iterations in the pattern X,Y,Z,X,Y,Z,X,Y,Z,X…..

Prior to Capture Start
• For all iterative X, Y and Z operations, channel A is set to 80 Meg samples/sec and will perform a single waveform capture of 1500 samples upon each channel B trigger.
• The single waveform capture of each Operation X will be assigned to a single block X memory within the 4224 for sample-by-sample ratio averaging of previous Operation X waveforms.
• Similarly, the single waveform capture of each Operation Y will be assigned to a single block Y memory within the 4224 for sample-by-sample ratio averaging of previous operation Y waveforms.
• And similarly for Operation Z with its own assigned single block Z memory

Capture Start
• The process begins operation X with a Channel B trigger pulse, followed by a trigger pulse for operation Y, followed by a trigger pulse for operation Z, and so on for 100 iterations. Channel B edge triggers occur 1 millisecond apart.

Capture End.
• At the end of iterations the block X memory of averaged data, the block Y memory of averaged data, and the block Z memory of averaged data are retrieved.

In Retrospect
If the X, Y, and Z block memory assignments are not possible as described above, then another way would to have each single wave capture be placed in a sequential segmented memory block, with each block of 1500 samples in length. This would result 300 memory blocks consuming an overall 450K samples of data. Then the big question is can we instruct the 4224 to correlate every third memory block into a corresponding ratio averaged result for corresponding X, Y, and Z averaged results, and how much time would that take?

sMac
User
User
Posts: 3
Joined: Tue Jun 29, 2021 7:42 pm

Re: New User, Using 4224 to work a sequence using SDK

Post by sMac »

Gerry,

Not seeing reaction to my attempt to further simplify a sequenced data gathering, I have surveyed the SDK, beginning to wonder if Picoscope is my solution.

I set up the scope channel A with sample rate, and number of samples to capture at each trigger. So I start a capture of 300 waveforms using channel B to trigger each capture at 1 msec rate. Where I see as challenge is in the interleaving of sequential captures into a round-robin of three memory segments where newly captured waveforms are sample-by-sample ratio averaged into the correlated memory segment. Hence using the sequence gathering as X, Y, Z, X, Y, X…. I need this because interleave sorting to correlated memory segments because X, Y, and Z present separate stimulus upon the unit under test. Only at the end, the three memory segments are retrieved.

I do not see anything in the SDK that allows me this. Is that correct or have I missed something? I appreciate your feedback.

bennog
Advanced User
Advanced User
Posts: 206
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: New User, Using 4224 to work a sequence using SDK

Post by bennog »

You need something to identify X, Y and Z in case you mis a trigger due some delay in the capturing.
So for example if you make the trigger for X 2V and for Y and Z 5V, or 3 different voltages and set the trigger to 1V.
Then the trigger gets fired on X, Y and Z and on the value measured on CH-B you can identify if the CH-A data is X , Y or Z.

Seems logical and simple to me.

Benno

Gerry
PICO STAFF
PICO STAFF
Posts: 1145
Joined: Mon Aug 11, 2014 11:14 am

Re: New User, Using 4224 to work a sequence using SDK

Post by Gerry »

Hi sMac,

Sorry for the delay in responding. We have had high numbers of support requests on the HelpDesk, so it has been difficult to get around to answering posts on the Forum.

If I understand you correctly then you have a device under test that is providing data to Channel A, while you are receiving a Trigger that is different to the data on Channel B, and the device under test is receiving different waveforms/signals to alter the data in 3 different ways. What you want to do is cycle through capturing a fixed amount of data for each of the 3 altered versions of the data continually, as waveform 1 data from X, waveform 2 data from Y, waveform 3 data from Z, waveform 4 data from X, waveform 5 data from Y, etc.

Benno, I don't see how, what you're suggesting ,would work, as you can only have one Trigger per channel, and there are only 2 channels available on a PicoScope 4224 (to be able to respond to 3 different Triggers you would need 3 Channels combined into a Logic Trigger with 3 different Trigger Direction and/or Threshold settings).

Getting back to the problem, you could certainly segment the waveform buffer and capture waveforms as described in a round robin fashion if they are cycling from the same output of the design under test, and if you are providing a Trigger at the start of each one. You can also set the Downsampling to RATIO_MODE_AVERAGE to average the data in a block and retrieve all of the averaged blocks. Unfortunately, The PicoScope will not combine the 3 separate sets of 100 blocks of data for each of X, Y and Z into one block for you and then average it. It would be the responsibility of your Application to perform any further sorting of the X Y and Z data into 3 overall sets of data and perform any further required processing. If you need the delay between captured blocks to be less than a few microseconds then you could use Rapid Block Mode to just capture all of the data and only send it once all of the captures are complete.

Regards,

Gerry
Gerry
Technical Specialist

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

Re: New User, Using 4224 to work a sequence using SDK

Post by Martyn »

Set the sampling to 80MS/s and collect 300 buffers in Rapid Block Mode, and then downsample the data as required when you retrieve it from the device. For 80MS/s blocks retrieve the raw data, for the 40MS/s blocks downsample by a factor of 2, and for 20MS/s blocks downsample by a factor of 4. If you use RATIO_MODE_DECIMATE rather than RATIO_MODE_AVERAGE you will return values as if they were sampled at the slower rate, the samples in between will be discarded.
Martyn
Technical Support Manager

Gerry
PICO STAFF
PICO STAFF
Posts: 1145
Joined: Mon Aug 11, 2014 11:14 am

Re: New User, Using 4224 to work a sequence using SDK

Post by Gerry »

Hi Benno,

OK, I see what you were suggesting now. You're saying that the captures on A should be distinguishable in case the data is out of sequence (as you say in case of missing 1 of the captures), so you're not attempting to use 3 channels. However, it may be easy to see if the data sets go out-of-sequence (and if it's all correctly setup, then they shouldn't). Good idea though, assuming that the data being sent can be changed between X, Y, and Z outcomes.

Regards,

Gerry
Gerry
Technical Specialist

Post Reply