Jump to content
  • 0

matthew-aedapt

Question

Hi,

I have an Analog Discovery 2 and a Digital Discovery (Great Products) which I have been using to test some designs.

I want to test a pre-amplifer with ADC board by sweeping a signal across the audio band and plotting the I2S output of the ADC chip.

I have tested the analogue circuit response using the network analyzer (so I get the feedback of the delivered analogue signal), what I want to do now is create a script that runs the network analyzer but instead of using the 2nd analogue input to plot the response, capture the I2S peak values for that frequency and plot/ save them.

Is this the right way to do this and can you give me any scripts you may have to start me in the right direction.

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Hi Attila,

I found that the Scope I2S doesn't give me consistent results and have changed to the logic I2S.

This gives me nice consistent results and I can save the results and chart them using the built in logging when its set to I2S.

BUT, If I write a script to save the I2S data, I don't get the same data! 

(its a pity you can't "View" the script behind built in functions)

I want to be able to get the data the same as the logging, I can then process it for the Min, Max and Pk2Pk values I am after for each Input frequency bin.

Link to comment
Share on other sites

  • 0

Hi @matthew-aedapt

It would be helpful if you could provide more information, attach a screenshot or workspace with data...

The Format can be specified in the I2S configuration:

image.png

 

This is a script for logging the value:

var rg = Logic1.Channels.I2S.events; //events
var rgt = Logic1.Channels.I2S.eventStamps; // event time stamps
var c = rg.length-1; // number of events

var i = 0;
if(rg[0].charAt(0)!="R") i++; // make sure to start with right

var file = File("~/Desktop/i2s.csv");
file.writeLine("Right,Left");

for(; i < c; i+=2){
    // trim leading R/L char
    print(rg[i].substring(2), rg[i+1].substring(2));
    file.appendLine(rg[i].substring(2)+","+rg[i+1].substring(2));
}var rg = Logic1.Channels.I2S.events; //events
var rgt = Logic1.Channels.I2S.eventStamps; // event time stamps
var c = rg.length-1; // number of events

var i = 0;
if(rg[0].charAt(0)!="R") i++; // make sure to start with right

var file = File("~/Desktop/i2s.csv");
file.writeLine("Right,Left");

for(; i < c; i+=2){
    // trim leading R/L char
    print(rg[i].substring(2), rg[i+1].substring(2));
    file.appendLine(rg[i].substring(2)+","+rg[i+1].substring(2));
}

image.png
 

Link to comment
Share on other sites

  • 0

Thanks Attila, that helped using events rather than data.

When using the scope digital channel for I2S, selecting 2 complement didn't give the right output (The logic one does).

The negative values were being shown as there integer equivalents, So a sine wave wasn't centered around zero.

This made any attempt at Pk2Pk measuring invalid seeing as the small negative values were always over 95% value.

Hope this feedback helps.

 

Thanks for your help

 

Matthew

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...