Author Topic: Using a AWG and a Scope -> using stairs to get to 1 mV accuracy  (Read 12411 times)

0 Members and 1 Guest are viewing this topic.

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4618
  • Country: au
  • Question Everything... Except This Statement
Re: Using a AWG and a Scope -> ADC inaccuracy?
« Reply #100 on: April 21, 2019, 10:58:58 pm »
They work by directly piping the sample contents into the DAC, its at a fixed 125MHz sampling rate,

if you set the frequency faster than what is required to play at that rate, it will pick a value based on a division of the samples,
If you set a frequency slower than would play all the samples, they get doubled until the required number of clocks have been played

As such you will generally always have a jitter of about 125MHz unless you use a clean division of 125MHz,

The offset DAC is summed into the output op amp which is on a +-5V supply rail, this is why it tries to restrict you to +-4V, in reality the offset can be much higher if the op amp had a wider supply rail, but with only 5V it gets much less linear and begins clipping at about +-4.35V
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> ADC inaccuracy?
« Reply #101 on: April 21, 2019, 11:17:52 pm »
The offset DAC is summed into the output op amp which is on a +-5V supply rail, this is why it tries to restrict you to +-4V, in reality the offset can be much higher if the op amp had a wider supply rail, but with only 5V it gets much less linear and begins clipping at about +-4.35V
I have the AWG on its own power supply, not USB. Would it be safe to give it some more voltage then? (For all the sub circuits?)

So it does have a offset DAC.  :-+

But simply doubling the samples..that would be a nice test case for the ramp then.

Nice to know of the fixed sampling rate, will have to give that some thought to have it play nicely with the scope. And not measure in between values.

Some more questions that burn in my mind:
Any idea’s on why I can hear relais clicking? Is the DC mode just using the offset DAC?
« Last Edit: April 21, 2019, 11:21:56 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4618
  • Country: au
  • Question Everything... Except This Statement
Re: Using a AWG and a Scope -> ADC inaccuracy?
« Reply #102 on: April 21, 2019, 11:27:38 pm »
To be clear, I am only talking about the output op amp and not the rest of the board, I believe it all ends up down regulated. but i cannot say what the margins are for the rest of the rest of the board,

That op amp itself is also a limiting factor, but unless you wish to replace it, I would not fiddle with its supply rails (this is from when i had a look at reversing the output chain)

https://www.eevblog.com/forum/testgear/siglent-sds1204x-e-released-for-domestic-markets-in-china/msg2189021/#msg2189021
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> ADC inaccuracy?
« Reply #103 on: April 21, 2019, 11:40:05 pm »
The AWG is not ready to get fried so I won’t give it more juice.

I read about the square wave, one thing a saw repeatedly when looking at the ramps on the scope where square waves running over them.

At first I thought they where the issue, but they get averaged out, because they don’t repeat themselves at the same time. Maybe a frequency can be found where they stand still... causing another issue?

For now I won’t hunt at that one, but the beast has been seen lurking in the shadows.
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Exploring the wavedata
« Reply #104 on: April 27, 2019, 09:43:54 am »
I've started examining the possibilities to create my own wavedata.

First I downloaded EasyWave, I just took the most recent version I could find. But it might be that they're compiled model specific.

I created a Ramp, using a dedicated app. function for that. And did a fast first test (MeasuredWave).

It shows the same dips. After which I checked the Ramp I was feeding the AWG (InputWave).

For some reason it has 2 points of the same value in the middle of the ramp. Hence the dip. I don't think it should be there.

This and some other small bugs are a sign that it's better to completely create the WaveData ourselves. One thing I also do not like is that application works with comma separated value (CSV) files. With an XPos and a Y-Value. These are floating point values, which might contribute to rounding/truncate errors. Maybe it's good for editing, or to share wave data. It is not good in showing what is exactly uploaded to the AWG.

The uploading command for my wave was:
Code: [Select]
C1:WVDT WVNM,Ramp,TYPE,5,LENGTH,32KB,FREQ,324.674987793,AMPL,0.899999976,OFST,0.352999985,PHASE,0.000000000,WAVEDATA,
Where after the WAVEDATA 32KB of wave data is added. The wave data consists of 16 bit liitle-endian signed integers. Little-endian meaning that the least significant part of the integer is in front of the memory.
x86 processors are little endian, so while reading/writing values we shouldn't have any problems.
The full 16 bit range is used while transferring the data so from -32768 to 32767. So it is unscaled data, the scaling is done while "playing" the data. This is what one should expect.
« Last Edit: April 27, 2019, 09:47:55 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Exploring the wavedata
« Reply #105 on: April 27, 2019, 09:59:07 am »
Via SCPI I downloaded some internal wave data, and my own ramp.

Showing them in Excel is a good way to check the format assumptions I've made. The Y-values are the unscaled integer values.

As can be seen these also have some dips (except the M5). I think they also used the same EasyWave application to create those.

I don't think dips in the waves fully explain the glitches, but I'm not going to test and check with ramps having dips in them.
« Last Edit: April 27, 2019, 10:34:55 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Exploring the wavedata
« Reply #106 on: April 27, 2019, 10:34:37 am »
Choosing AMPL and FREQ values which should have no issues using even the most simple "scaling algorithms" would be a good starting point for further testing.
It is also important to know that the 16 bit integers will be scaled by /4 to 14 bit also in the most optimal situation. The question is than also whether this is done in one step or two.


Also with what accuracy can the AWG calculate / scale. If the intermediate value can be a 32 bit value, one could calculate the value the DAC more like this WaveValue * Factor div (Divider * 4) where I would go for (WaveValue * Factor + Divider * 2) div (Divider * 4) to do some proper rounding.
otherwise the division has to be done before the multiplication. Which leads to more rounding errors.

However I think rounding errors, should not lift the curve at a traject. It may create a local slope problem, but that would be counter balanced after that.

So I'm guessing it's a timing problem, maybe in combination with rounding errors.
« Last Edit: May 01, 2019, 08:02:33 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #107 on: April 27, 2019, 03:14:15 pm »
As for the question where the scaling of the Y-values is happening.

I'm almost certain it is digital.

1/4 amplitude 1/1 resolution waves, look similar in step size to 1/1 amplitude 1/4 resolution waves.

However the way they look is different.
The 1/4 resolution wave takes smaller steps (and uses only 1/4 of the digital "bandwidth"), but these steps are with 1 granularity and not 4. And also seem to have some glitches, which the other one does not seem to have.

I guess the extra bits in the 16bit samples are used for calculation. I know for certain that they are read back ok, after writing them.

Will think about the differences some more. (For now it's also good to remember that if we want a smaller amplitude, we can also create a new wave. Maybe with the benefit of more control)

« Last Edit: April 27, 2019, 08:00:38 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #108 on: April 27, 2019, 08:34:50 pm »
I've now zoomed in till 1mV/div.

Showing a scaled waveform and a normal output scaled one. Now they seem very similar.

No AWG DAC steps are visible in either case. Noise (and probably the sine on the ramp we've seen before) have an to huge impact on the signal to get more details by averaging.

Conclusion: the previous graphs cannot easily be explained by zooming in.

There're things that where different in this experiment:
* Scope channel offset
* AWG offset
* AWG amplitude

« Last Edit: April 27, 2019, 08:44:29 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4618
  • Country: au
  • Question Everything... Except This Statement
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #109 on: April 27, 2019, 09:25:27 pm »
The scaling is fixed per attenuator step, so the scaling is indeed digital, likely a hardware multiply / divide in the FPGA,
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #110 on: April 27, 2019, 10:03:39 pm »
Now I'm quite sure that rounding and/or imperfect wavedata should not be cause for the glitches. I can still see them and my ramps are simple and flawless. And we also examined different kinds of scaling. (With one still unexplained difference.)

The experiments will be moving towards timing to see the effects of that on the glitches.

We know the sample rate of the AWG is 125 Mhz. We know a play cycle contains 16384 samples. Whom either can be stretched by playing samples more than once, of be compacted by skipping samples.
I've played a 250 hz version of my ramp (with a good amount of glitches), which means 4096000 samples/s would ideally be played. Which the AWG cannot, but it can play each sample about 30,5 times on average.

I also played a 250 hz version of a new more steep ramp (16383  steps of +8 instead of +4), which has 50% zero values in it.

What we see then is that the glitches (seem to be less, but that does not need to mean much), are noticeable at the exact Y-position.

Surely need to think that one through. Putting an offset in the wavedata might be an idea.
« Last Edit: April 27, 2019, 10:08:22 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #111 on: April 27, 2019, 11:14:54 pm »
Two new graphs, one with +3 steps, and one with +3 steps and +1000 offset.

The glitches appear exactly at the same Y-pos.

This means we should see something happening with a ramp just around the problem area, but with changing the wavedata. This way everything else stays the same.

When the Y-values change slowly and a glitch would appear, that would maybe give the exact value where things go wrong., and maybe an indication on why.
« Last Edit: April 27, 2019, 11:17:37 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4618
  • Country: au
  • Question Everything... Except This Statement
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #112 on: April 27, 2019, 11:48:08 pm »
I should point out all the glitches in your output appear periodic, e.g. the last image i can see atleast 5 of them very evenly spaced, It could be a glitch in how samples are scaled, what if you generate a waveform and run it at a frequency that is a perfect division of 125MHz? while still allowing every sample to be used.
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #113 on: April 28, 2019, 12:03:26 am »
I should point out all the glitches in your output appear periodic, e.g. the last image i can see atleast 5 of them very evenly spaced, It could be a glitch in how samples are scaled, what if you generate a waveform and run it at a frequency that is a perfect division of 125MHz? while still allowing every sample to be used.
The problem is that 125 M is not dividable by 16384. If we took 254,313151041668 hz then each sample would be played about 30 times. I'll try that after searching for the (input!) glitch value(s).

I've got a clear graph of the glitch, but thousands of values are still candidate.... It's a process of trial and error.
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4618
  • Country: au
  • Question Everything... Except This Statement
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #114 on: April 28, 2019, 01:52:41 am »
You have plenty of options than just frequency, you can also set by period, this gives many more cleaner divisions
Left is the period, right is how many times each sample is repeated in that period

There are more if you want them, these where just up to 5 significant figures, even if it does use frequency internally (don't know which it uses), these are clean enough divisions that it should limit the possibility of glitches.

0.0032768   25
0.0065536   50
0.0098304   75
0.016384   125
0.032768   250
0.049152   375
0.065536   500
0.08192   625
0.098304   750
0.16384   1250
0.24576   1875
0.32768   2500
0.4096   3125
0.49152   3750
0.57344   4375
0.65536   5000
0.73728   5625
0.8192   6250
0.90112   6875
0.98304   7500
1.2288   9375
1.6384   12500
2.048   15625
2.4576   18750
2.8672   21875
3.2768   25000
« Last Edit: April 28, 2019, 02:02:14 am by Rerouter »
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #115 on: April 28, 2019, 08:39:24 am »
Added is a "2 value" ramp up, which shows exactly one Y-value on the wave data side of things that lead to a glitch.

Thus when going up from 2663 to 2664 it drops in the output about 2 mV.

Each value is thus repeated 8K times.
« Last Edit: April 28, 2019, 08:49:06 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #116 on: April 28, 2019, 09:57:44 am »
You have plenty of options than just frequency, you can also set by period, this gives many more cleaner divisions
Left is the period, right is how many times each sample is repeated in that period

There are more if you want them, these where just up to 5 significant figures, even if it does use frequency internally (don't know which it uses), these are clean enough divisions that it should limit the possibility of glitches.

0.0032768   25
Nice table, good thinking to reverse it. I think it works "internally" by frequency, because it does not update the period value in the GUI. But that might just be sloppy programming.
Code: [Select]
C1:BSWV WVTP,ARB,PERI,0.0032768,AMP,1,OFST,0.5
I don't think there're less glitches. There must also be an perfect amplitude, but then we need to know to what output the input values are mapped (step size).
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4618
  • Country: au
  • Question Everything... Except This Statement
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #117 on: April 28, 2019, 10:08:14 am »
I was suspicious it may be something else internally, as the resulting frequency had more then 7 significant digits after setting the period via SCPI

as per you having a weird step between 2 values, perhaps try setting it to the lower attenuator setting, it may have some correction table inside that will move the quirk
« Last Edit: April 28, 2019, 10:21:26 am by Rerouter »
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #118 on: April 28, 2019, 10:30:36 am »
The glitch can be seen at every freq. I tried between 250 and 300.
However at the perfect period something fascinating happens (a glitch in a glitch????). It should be noted all output values are averaged (190x).

It is probably the "sine wave" we saw earlier. (At least the scope made a sine out of it. But we don't know if it is.) I think it is a sign that the triggering is in sync with the sample rate of the AWG.


I don't think the horizontal stuff affect the glitching much, except that it may bring integer values forward that are troublesome.

The missing piece of information is the step size, that might give a clue why for instance 2664 acts weird. Also what is origin of the 2 mV? How many steps would that be?
« Last Edit: April 28, 2019, 10:51:02 am by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4618
  • Country: au
  • Question Everything... Except This Statement
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #119 on: April 28, 2019, 10:49:36 am »
Well at a minumum, looks like your the glitch is interesting, 6V pk-pk, it should be a 16 bit DAC, but your offset looks almost exactly like it behaving like a 12 bit, 4096 steps, which comes to about 1.5mV per step,

Could you share your ramp waveform?
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #120 on: April 28, 2019, 11:04:30 am »
Well at a minumum, looks like your the glitch is interesting, 6V pk-pk, it should be a 16 bit DAC, but your offset looks almost exactly like it behaving like a 12 bit, 4096 steps, which comes to about 1.5mV per step,

Could you share your ramp waveform?
I think it is advertised as being a 14 bit DAC. It should be mapped to 6V pk-pk at least, but with what exact value do they calculate. Everything that is only a slight bit of does not give answers.
Changing the offset slightly until a step "toggles" would give some clue. But that is another DAC.

Changing the amplitude until it toggles tells a lot less, because an amplitude will be scaled.

 :-//
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4618
  • Country: au
  • Question Everything... Except This Statement
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #121 on: April 28, 2019, 11:14:08 am »
sorry, yep 14 bit,

There may be some kind of calibration routine, But I am suspicious, it defiantly has enough memory on board to store some kind of correction table, just doesn't make much sense to me why it would exist, (decent hardware)

Just using the built in generated ramp I do not see any such glitch, only thing of note, hooking up another BNC cable between my scope and the AWG IN/OUT pin gets rid of most the glitches due to the USB noise.
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #122 on: April 28, 2019, 11:36:50 am »
Averaging is the key to bring the dark creatures to light.

Also it drops at a certain value, but it is not “restored” near that value. So quite a range of values are off.

I hope the calculations are faulty, that is something that can be fixed.

Just to be sure, your Sag1021 shows similar glitches?
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4618
  • Country: au
  • Question Everything... Except This Statement
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #123 on: April 28, 2019, 11:46:34 am »
I have scrolled 0V - 1.8V and have not seen any glitches, if I only have one BNC lead connected I will see spiking, but no sudden discontinuities like your graphs are showing.
 

Offline HendriXML

  • Frequent Contributor
  • **
  • Posts: 719
  • Country: nl
    • KiCad-BOM-reporter
Re: Using a AWG and a Scope -> Exploring the wavedata
« Reply #124 on: April 28, 2019, 12:47:03 pm »
For those who would like to test their AWG...

The attached CVS file should result into the
2663 and 2664 value ramp when send by EasyWave.

The values can be checked by NI I/O trace when copying the message.
67 0A = 2663
68 0A = 2664

It starts with a -0.5 and a 0.5 to have EasyWave force an amplitude of 1.0
Code: [Select]
72.  viWrite (TCPIP0::192.168.2.73::INSTR (0x1157ACD8), "C1:WVDT WVNM,Glitchy,...", 32888, 32888)
Process ID: 0x00002D1C         Thread ID: 0x00002860
Start Time: 14:26:42.166       Call Duration 00:00:00.007
Status: 0 (VI_SUCCESS)
Buffer Contents
00000000:  43 31 3A 57 56 44 54 20 57 56 4E 4D 2C 47 6C 69  C1:WVDT WVNM,Gli
00000010:  74 63 68 79 2C 54 59 50 45 2C 35 2C 4C 45 4E 47  tchy,TYPE,5,LENG
00000020:  54 48 2C 33 32 4B 42 2C 46 52 45 51 2C 32 35 30  TH,32KB,FREQ,250
00000030:  2E 30 30 30 30 30 30 30 30 30 2C 41 4D 50 4C 2C  .000000000,AMPL,
00000040:  31 2E 30 30 30 30 30 30 30 30 30 2C 4F 46 53 54  1.000000000,OFST
00000050:  2C 30 2E 30 30 30 30 30 30 30 30 30 2C 50 48 41  ,0.000000000,PHA
00000060:  53 45 2C 30 2E 30 30 30 30 30 30 30 30 30 2C 57  SE,0.000000000,W
00000070:  41 56 45 44 41 54 41 2C 00 80 FE 7F 67 0A 67 0A  AVEDATA,....g.g.
00000080:  67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A  g.g.g.g.g.g.g.g.
00000090:  67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A  g.g.g.g.g.g.g.g.
000000A0:  67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A  g.g.g.g.g.g.g.g.
000000B0:  67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A  g.g.g.g.g.g.g.g.
000000C0:  67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A  g.g.g.g.g.g.g.g.
000000D0:  67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A 67 0A  g.g.g.g.g.g.g.g.

.......

00008050:  68 0A 68 0A 68 0A 68 0A 68 0A 68 0A 68 0A 68 0A  h.h.h.h.h.h.h.h.
00008060:  68 0A 68 0A 68 0A 68 0A 68 0A 68 0A 68 0A 68 0A  h.h.h.h.h.h.h.h.
00008070:  68 0A 68 0A 68 0A 68 0A                          h.h.h.h.
« Last Edit: April 28, 2019, 04:50:02 pm by HendriXML »
“I ‘d like to reincarnate as a dung beetle, ‘cause there’s nothing wrong with a shitty life, real misery comes from high expectations”
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf