Forums

12-bit ADC with C6713

Started by B S December 21, 2010
Hi,

I have interfaced a 12-bit ADC with C6713 DSP. How can I scale the output to see
the amplitude of the output signal same as of input signal ? For example,
Amplitude = 2 Vp_p with 5KHz frequency ?

I want to run ADC for 5 minutes or more and save all the sampled values in a
file to examine them in Matlab ? Can you please tell me how could I do it ?

Waiting for your help.

BR,
BAS
BAS,

On 12/21/2010 1:57 PM, B S wrote:
> Hi,
>
> I have interfaced a 12-bit ADC with C6713 DSP. How can I scale the
> output to see the amplitude of the output signal same as of input
> signal ? For example, Amplitude = 2 Vp_p with 5KHz frequency ?
>
> I want to run ADC for 5 minutes or more and save all the sampled
> values in a file to examine them in Matlab ? Can you please tell me
> how could I do it ?

1. Determine storage requirement
#samplesPerSec * numberOfSec * numberOfBytesPerSample
5000 * (5 * 60) * 2 = 3,000,000 bytes
2. Modify your code to save the samples in SDRAM and exit.
3. Examine and verify the data in SDRAM.
3. Modify your code to 'fprintf' the data to a file on the PC before the
program exits.

The scaling factor will depend on the ADC and the 'expected scaling
factor' in the data file.

mikedunn
>
> Waiting for your help.
>
> BR,
> BAS
B.S.

a 5Khz input signal will require a(at least) a 10khz sampling rate to avoid
problems with the nyquist(sp) frequency.
I think the next higher sampling rate available is 16khz.
so 16k*60*5H00000 samples in 5 minutes.
at 4 bytes per sample= 19,200,000 bytes of RAM
That is nearly 20megs of RAM.
(you might be able to use 'short' (16bit) values, which would cut the RAM used
by half)

Do you have that much RAM available?
You did not mention which ADC you are using.
You did not mention how the ADC is actually attached to the DSP.
You did not mention how you are handling the negative voltage values.
That info would be useful in determining the expected range of the data values
in RAM and if any pre-scaling or level shifting of the voltages will be needed
in hardware.
I expect you will need to shift the voltage levels both for the input and for
the output.
I expect you will need to scale the voltage levels both for the input and for
the output.

How do you plan on getting the data from the DSP RAM to MatLab?
RTDX, DAC, something else?

Such details will make a significant difference in how the RAM data will need to
be scaled, level shifted, etc. before being sent out.

R. Williams

---------- Original Message -----------
From: B S
To: c...
Sent: Tue, 21 Dec 2010 11:57:59 -0800 (PST)
Subject: [c6x] 12-bit ADC with C6713

> Hi,
>
> I have interfaced a 12-bit ADC with C6713 DSP. How can I scale the
> output to see the amplitude of the output signal same as of input
> signal ? For example, Amplitude = 2 Vp_p with 5KHz frequency ?
>
> I want to run ADC for 5 minutes or more and save all the sampled
> values in a file to examine them in Matlab ? Can you please tell me
> how could I do it ?
>
> Waiting for your help.
>
> BR,
> BAS
------- End of Original Message -------

_____________________________________
BAS,

My bad - as Williams explained, you will need at least a 10Khz sample
rate to recover a facsimile of the original signal. This will double the
SDRAM requirement to 6,000,000 bytes.
(#samplesPerSec * 2) * numberOfSec * numberOfBytesPerSample
5000 * (5 * 60) * 2 * 2 = 6,000,000 bytes

You could go to 4 samples per 5000 hz [12,000,000 bytes]

NOTE:
The transfer to the PC will be VERY slow.

mikedunn

On 12/21/2010 2:27 PM, mikedunn wrote:
> BAS,
>
> On 12/21/2010 1:57 PM, B S wrote:
>> Hi,
>>
>> I have interfaced a 12-bit ADC with C6713 DSP. How can I scale the
>> output to see the amplitude of the output signal same as of input
>> signal ? For example, Amplitude = 2 Vp_p with 5KHz frequency ?
>>
>> I want to run ADC for 5 minutes or more and save all the sampled
>> values in a file to examine them in Matlab ? Can you please tell me
>> how could I do it ?
>
> 1. Determine storage requirement
> #samplesPerSec * numberOfSec * numberOfBytesPerSample
> 5000 * (5 * 60) * 2 = 3,000,000 bytes
> 2. Modify your code to save the samples in SDRAM and exit.
> 3. Examine and verify the data in SDRAM.
> 3. Modify your code to 'fprintf' the data to a file on the PC before
> the program exits.
>
> The scaling factor will depend on the ADC and the 'expected scaling
> factor' in the data file.
>
> mikedunn
>>
>> Waiting for your help.
>>
>> BR,
>> BAS
B.S,

I have a question regarding the connector you used.

What cable did you use to interface ADC and the 6713 ? Does the ADC output
LVDS signals.

Thanks,

On Tue, Dec 21, 2010 at 4:13 PM, mikedunn wrote:

> BAS,
>
> My bad - as Williams explained, you will need at least a 10Khz sample rate
> to recover a facsimile of the original signal. This will double the SDRAM
> requirement to 6,000,000 bytes.
> (#samplesPerSec * 2) * numberOfSec * numberOfBytesPerSample
> 5000 * (5 * 60) * 2 * 2 = 6,000,000 bytes
>
> You could go to 4 samples per 5000 hz [12,000,000 bytes]
>
> NOTE:
> The transfer to the PC will be VERY slow.
>
> mikedunn
> On 12/21/2010 2:27 PM, mikedunn wrote:
>
> BAS,
>
> On 12/21/2010 1:57 PM, B S wrote:
> Hi,
>
> I have interfaced a 12-bit ADC with C6713 DSP. How can I scale the output
> to see the amplitude of the output signal same as of input signal ? For
> example, Amplitude = 2 Vp_p with 5KHz frequency ?
>
> I want to run ADC for 5 minutes or more and save all the sampled values in
> a file to examine them in Matlab ? Can you please tell me how could I do it
> ?
>
>
> 1. Determine storage requirement
> #samplesPerSec * numberOfSec * numberOfBytesPerSample
> 5000 * (5 * 60) * 2 = 3,000,000 bytes
> 2. Modify your code to save the samples in SDRAM and exit.
> 3. Examine and verify the data in SDRAM.
> 3. Modify your code to 'fprintf' the data to a file on the PC before the
> program exits.
>
> The scaling factor will depend on the ADC and the 'expected scaling factor'
> in the data file.
>
> mikedunn
> Waiting for your help.
>
> BR,
> BAS
>
>
>

--
Varun
Thanks guys for your answers.

@ R. Williams,

I don't think that much RAM is available. I am using C6713 DSK with 16 MB SDRAM,
L1P is 4K-Bytes and L1D is 4K-Bytes while L2 memory is 256K-Bytes.

I am using ADS7881EVM.

ADS7881EVM has been interfaced through a 5-6K Interface Board to DSP.

Since ADC is unipolar, I am using offser Voltage of 1V controlled by ADS7881.

ADC is 12 bit device while DSP is saving sampled values in unsigned short
format. Check out the amplitude level of sampled sine wave in the snapshot given
below, I don't know how DSP is doing mathematics to convert 12 bits to 16 bits.
I really don't know how to scale the output.

http://i55.tinypic.com/21d51ty.jpg

#pragma DATA_ALIGN (r_buffer, 128)
unsigned short r_buffer[BUFFER_SIZE];

I don't know how transfer of data from DSP to PC will take place, heard about
RTDX but don't know how it works. Any help regarding that will be appreciated.
Size of the data is not a problem even 1024 samples will be enough but I want to
examine them in Matlab.

@ Voranian

I am using 5-6K Interfacing Board to interface ADS7881 Evaliation Module with
C6713.

@ Mikedunn

Don't know much about SDRAM, but I will see how to do it.
---------

Waiting for your response.

-BAS

________________________________
From: Richard Williams
To: B S ; c...
Sent: Wed, December 22, 2010 12:43:25 AM
Subject: Re: [c6x] 12-bit ADC with C6713

B.S.

a 5Khz input signal will require a(at least) a 10khz sampling rate to avoid
problems with the nyquist(sp) frequency.
I think the next higher sampling rate available is 16khz.
so 16k*60*5H00000 samples in 5 minutes.
at 4 bytes per sample= 19,200,000 bytes of RAM
That is nearly 20megs of RAM.
(you might be able to use 'short' (16bit) values, which would cut the RAM used
by half)

Do you have that much RAM available?

You did not mention which ADC you are using.
You did not mention how the ADC is actually attached to the DSP.
You did not mention how you are handling the negative voltage values.

That info would be useful in determining the expected range of the data values
in RAM and if any pre-scaling or level shifting of the voltages will be needed
in hardware.

I expect you will need to shift the voltage levels both for the input and for
the output.
I expect you will need to scale the voltage levels both for the input and for
the output.

How do you plan on getting the data from the DSP RAM to MatLab?
RTDX, DAC, something else?

Such details will make a significant difference in how the RAM data will need to
be scaled, level shifted, etc. before being sent out.

R. Williams

---------- Original Message -----------
From: B S
To: c...
Sent: Tue, 21 Dec 2010 11:57:59 -0800 (PST)
Subject: [c6x] 12-bit ADC with C6713

> Hi,
>
> I have interfaced a 12-bit ADC with C6713 DSP. How can I scale the
> output to see the amplitude of the output signal same as of input
> signal ? For example, Amplitude = 2 Vp_p with 5KHz frequency ?
>
> I want to run ADC for 5 minutes or more and save all the sampled
> values in a file to examine them in Matlab ? Can you please tell me
> how could I do it ?
>
> Waiting for your help.
>
> BR,
> BAS
------- End of Original Message -------
BAS,

On 12/22/2010 4:58 AM, B S wrote:
> Thanks guys for your answers.
>
> @ R. Williams,
>
> I don't think that much RAM is available. I am using C6713 DSK with 16
> MB SDRAM, L1P is 4K-Bytes and L1D is 4K-Bytes while L2 memory is
> 256K-Bytes.

You can use a timer interrupt to trigger ADC reads at the frequency you
need [10 KHz]. This and using 'shorts' will constrain the amount of
memory that you require.
>
> I am using ADS7881EVM.
>
> ADS7881EVM has been interfaced through a 5-6K Interface Board to DSP.
>
> Since ADC is unipolar, I am using offser Voltage of 1V controlled by
> ADS7881.
>
> ADC is 12 bit device while DSP is saving sampled values in unsigned
> short format. Check out the amplitude level of sampled sine wave in
> the snapshot given below, I don't know how DSP is doing mathematics to
> convert 12 bits to 16 bits.

There should not be any math involved - just four 0s added to the MSBs
for positive numbers.
> I really don't know how to scale the output.

Read the datasheet for your ADC. Determine the bit pattern that will be
generated when you read 1 v. To adjust for a +1v offset, you will need
to subtract that value from each entry in your buffer. Scaling [linear]
is simply applying the same 'adjustment' to each value in the buffer.
NOTE:
If your values will be negative, you will need to use a 'signed short'.
>
> http://i55.tinypic.com/21d51ty.jpg
>
> #pragma DATA_ALIGN (r_buffer, 128)
> unsigned short r_buffer[BUFFER_SIZE];

I would not recommend using an array if your buffer size is very large.
>
> I don't know how transfer of data from DSP to PC will take place,
> heard about RTDX but don't know how it works. Any help regarding that
> will be appreciated. Size of the data is not a problem even 1024
> samples will be enough but I want to examine them in Matlab.

The simplest way to transfer non-realtime data is 'fprintf'.
>
> @ Voranian
>
> I am using 5-6K Interfacing Board to interface ADS7881 Evaliation
> Module with C6713.
>
> @ Mikedunn
>
> Don't know much about SDRAM, but I will see how to do it.

1. make sure that the memory map has an entry for the SDRAM address range.
2. use '#pragma DATA_SECTION' to place the buffer in the SDRAM space
3. use a short pointer to store the data
> ---------
>
> Waiting for your response.
>
> -BAS
>
>
> *From:* Richard Williams
> *To:* B S ; c...
> *Sent:* Wed, December 22, 2010 12:43:25 AM
> *Subject:* Re: [c6x] 12-bit ADC with C6713
> B.S.
>
> a 5Khz input signal will require a(at least) a 10khz sampling rate to
> avoid
> problems with the nyquist(sp) frequency.
> I think the next higher sampling rate available is 16khz.
> so 16k*60*5H00000 samples in 5 minutes.
> at 4 bytes per sample= 19,200,000 bytes of RAM
> That is nearly 20megs of RAM.
> (you might be able to use 'short' (16bit) values, which would cut the
> RAM used
> by half)
>
> Do you have that much RAM available?
>
> You did not mention which ADC you are using.
> You did not mention how the ADC is actually attached to the DSP.
> You did not mention how you are handling the negative voltage values.
>
> That info would be useful in determining the expected range of the
> data values
> in RAM and if any pre-scaling or level shifting of the voltages will
> be needed
> in hardware.
>
> I expect you will need to shift the voltage levels both for the input
> and for
> the output.
> I expect you will need to scale the voltage levels both for the input
> and for
> the output.
>
> How do you plan on getting the data from the DSP RAM to MatLab?
> RTDX, DAC, something else?
>
> Such details will make a significant difference in how the RAM data
> will need to
> be scaled, level shifted, etc. before being sent out.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S >
> To: c...
> Sent: Tue, 21 Dec 2010 11:57:59 -0800 (PST)
> Subject: [c6x] 12-bit ADC with C6713
>
> > Hi,
> >
> > I have interfaced a 12-bit ADC with C6713 DSP. How can I scale the
> > output to see the amplitude of the output signal same as of input
> > signal ? For example, Amplitude = 2 Vp_p with 5KHz frequency ?
> >
> > I want to run ADC for 5 minutes or more and save all the sampled
> > values in a file to examine them in Matlab ? Can you please tell me
> > how could I do it ?
> >
> > Waiting for your help.
> >
> > BR,
> > BAS
> ------- End of Original Message -------
>
B.S.

for scaling to make output look like input.

using short int values (signed values)

1) subtract the '0volt' value from all data points.
This will result in the data both positive and negative values, centered around 0.

2) multiply all data points by 'value' needed to bring the peaks to represent
+/-1 volt.
This will scale the data to the original scaling of 2 Vp_p.
Exactly what that 'value' will need to be may require some experimentation.

BTW:
If you are using the code from: STAA257.zip
Then you will be missing data.
The reason is the EDMA is setup to
1) read data into pingBuf
2) then, read data into pongBuf
3) then, pause while the data is copied into the dataPing and dataPong buffers
4) then, resume reading data.

That pause will cause data to be missed.
I would suggest:
--first EDMA sequence:
--read data into pingBuf, when full invoke' EDMA interrupt' event
--chain (as it is currently doing) to the second EDMA sequence

--second EDMA sequence:
--read data into pongBuf, when full invoke 'EDMA interrupt' event
--chain (this is new) to the first EDMA sequence

--in the 'EDMA interrupt' event handler:
--use the EDMA status to determine which EDMA sequence caused the interrupt and
set the pingpong variable accordingly
--only reset/re-enable the appropriate EDMA event
--trigger a 'software interrupt'

--add a 'software interrupt'' handler to the system
--in the 'software interrupt' handler:

--use the pingpong variable to determine which data buffer on which to perform
any data processing

Note:
unless the data processing requires copying, do not perform any data buffer
copying as that takes an extended amount of time/CPU cycles.

R. Williams

---------- Original Message -----------
From: B S
To: Richard Williams
Cc: c...
Sent: Wed, 22 Dec 2010 02:58:27 -0800 (PST)
Subject: Re: [c6x] 12-bit ADC with C6713

> Thanks guys for your answers.
>
> @ R. Williams,
>
> I don't think that much RAM is available. I am using C6713 DSK with 16
> MB SDRAM, L1P is 4K-Bytes and L1D is 4K-Bytes while L2 memory is 256K-Bytes.
>
> I am using ADS7881EVM.
>
> ADS7881EVM has been interfaced through a 5-6K Interface Board to DSP.
>
> Since ADC is unipolar, I am using offser Voltage of 1V controlled by ADS7881.
>
> ADC is 12 bit device while DSP is saving sampled values in unsigned
> short format. Check out the amplitude level of sampled sine wave in
> the snapshot given below, I don't know how DSP is doing mathematics to
> convert 12 bits to 16 bits. I really don't know how to scale the output.
>
> http://i55.tinypic.com/21d51ty.jpg
>
> #pragma DATA_ALIGN (r_buffer, 128)
> unsigned short r_buffer[BUFFER_SIZE];
>
> I don't know how transfer of data from DSP to PC will take place,
> heard about RTDX but don't know how it works. Any help regarding that
> will be appreciated. Size of the data is not a problem even 1024
> samples will be enough but I want to examine them in Matlab.
>
> @ Voranian
>
> I am using 5-6K Interfacing Board to interface ADS7881 Evaliation
> Module with C6713.
>
> @ Mikedunn
>
> Don't know much about SDRAM, but I will see how to do it.
> ---------
>
> Waiting for your response.
>
> -BAS
>
> ________________________________
> From: Richard Williams
> To: B S ; c...
> Sent: Wed, December 22, 2010 12:43:25 AM
> Subject: Re: [c6x] 12-bit ADC with C6713
>
> B.S.
>
> a 5Khz input signal will require a(at least) a 10khz sampling rate to avoid
> problems with the nyquist(sp) frequency.
> I think the next higher sampling rate available is 16khz.
> so 16k*60*5H00000 samples in 5 minutes.
> at 4 bytes per sample= 19,200,000 bytes of RAM
> That is nearly 20megs of RAM.
>
> (you might be able to use 'short' (16bit) values, which would cut the
> RAM used by half)
>
> Do you have that much RAM available?
>
> You did not mention which ADC you are using.
> You did not mention how the ADC is actually attached to the DSP.
> You did not mention how you are handling the negative voltage values.
>
> That info would be useful in determining the expected range of the
> data values in RAM and if any pre-scaling or level shifting of the
> voltages will be needed in hardware.
>
> I expect you will need to shift the voltage levels both for the input
> and for the output. I expect you will need to scale the voltage levels
> both for the input and for the output.
>
> How do you plan on getting the data from the DSP RAM to MatLab?
> RTDX, DAC, something else?
>
> Such details will make a significant difference in how the RAM data
> will need to be scaled, level shifted, etc. before being sent out.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S
> To: c...
> Sent: Tue, 21 Dec 2010 11:57:59 -0800 (PST)
> Subject: [c6x] 12-bit ADC with C6713
>
> > Hi,
> >
> > I have interfaced a 12-bit ADC with C6713 DSP. How can I scale the
> > output to see the amplitude of the output signal same as of input
> > signal ? For example, Amplitude = 2 Vp_p with 5KHz frequency ?
> >
> > I want to run ADC for 5 minutes or more and save all the sampled
> > values in a file to examine them in Matlab ? Can you please tell me
> > how could I do it ?
> >
> > Waiting for your help.
> >
> > BR,
> > BAS
> ------- End of Original Message -------
------- End of Original Message -------

_____________________________________
Hi,
I was trying to convert the sampled values back to voltage the following way:

float buffer_involt[BLOCK_SZ];
float maxAdcBits = 4095.0f;
float maxVolts = 2.5f; // Vref
float offset = 0.5f;

buffer_involt = (maxVolts-offset)*(float)r_buffer/maxAdcBits;

Please find attached snapshot of waveform.

http://i56.tinypic.com/105eeef.jpg

In the first diagram, there is no offset and input voltage is 1V which in turns
giving 0.939V after using the formula given above.

In the second diagram, offset has set to 0.5V according to Oscilloscope and
input signal is still 1V. Now graph doesn't show 0.939V for 1V input ?
What am I doing wrong ?

BAS

From: Richard Williams

To: B S
Cc: c...
Sent: Wed, December 22, 2010 8:18:35 PM
Subject: Re: [c6x] 12-bit ADC with C6713

B.S.

for scaling to make output look like input.

using short int values (signed values)

1) subtract the '0volt' value from all data points.
This will result in the data both positive and negative values, centered around
0.

2) multiply all data points by 'value' needed to bring the peaks to represent
+/-1 volt.
This will scale the data to the original scaling of 2 Vp_p.
Exactly what that 'value' will need to be may require some experimentation.

BTW:
If you are using the code from: STAA257.zip
Then you will be missing data.
The reason is the EDMA is setup to
1) read data into pingBuf
2) then, read data into pongBuf
3) then, pause while the data is copied into the dataPing and dataPong buffers
4) then, resume reading data.

That pause will cause data to be missed.
I would suggest:
--first EDMA sequence:
--read data into pingBuf, when full invoke' EDMA interrupt' event
--chain (as it is currently doing) to the second EDMA sequence

--second EDMA sequence:
--read data into pongBuf, when full invoke 'EDMA interrupt' event
--chain (this is new) to the first EDMA sequence

--in the 'EDMA interrupt' event handler:
--use the EDMA status to determine which EDMA sequence caused the interrupt and
set the pingpong variable accordingly
--only reset/re-enable the appropriate EDMA event
--trigger a 'software interrupt'

--add a 'software interrupt'' handler to the system
--in the 'software interrupt' handler:

--use the pingpong variable to determine which data buffer on which to perform
any data processing

Note:
unless the data processing requires copying, do not perform any data buffer
copying as that takes an extended amount of time/CPU cycles.

R. Williams

---------- Original Message -----------
From: B S
To: Richard Williams
Cc: c...
Sent: Wed, 22 Dec 2010 02:58:27 -0800 (PST)
Subject: Re: [c6x] 12-bit ADC with C6713

> Thanks guys for your answers.
>
> @ R. Williams,
>
> I don't think that much RAM is available. I am using C6713 DSK with 16
> MB SDRAM, L1P is 4K-Bytes and L1D is 4K-Bytes while L2 memory is 256K-Bytes.
>
> I am using ADS7881EVM.
>
> ADS7881EVM has been interfaced through a 5-6K Interface Board to DSP.
>
> Since ADC is unipolar, I am using offser Voltage of 1V controlled by ADS7881.
>
> ADC is 12 bit device while DSP is saving sampled values in unsigned
> short format. Check out the amplitude level of sampled sine wave in
> the snapshot given below, I don't know how DSP is doing mathematics to
> convert 12 bits to 16 bits. I really don't know how to scale the output.
>
> http://i55.tinypic.com/21d51ty.jpg
>
> #pragma DATA_ALIGN (r_buffer, 128)
> unsigned short r_buffer[BUFFER_SIZE];
>
> I don't know how transfer of data from DSP to PC will take place,
> heard about RTDX but don't know how it works. Any help regarding that
> will be appreciated. Size of the data is not a problem even 1024
> samples will be enough but I want to examine them in Matlab.
>
> @ Voranian
>
> I am using 5-6K Interfacing Board to interface ADS7881 Evaliation
> Module with C6713.
>
> @ Mikedunn
>
> Don't know much about SDRAM, but I will see how to do it.
> ---------
>
> Waiting for your response.
>
> -BAS
>
> ________________________________
> From: Richard Williams
> To: B S ; c...
> Sent: Wed, December 22, 2010 12:43:25 AM
> Subject: Re: [c6x] 12-bit ADC with C6713
>
> B.S.
>
> a 5Khz input signal will require a(at least) a 10khz sampling rate to avoid
> problems with the nyquist(sp) frequency.
> I think the next higher sampling rate available is 16khz.
> so 16k*60*5H00000 samples in 5 minutes.
> at 4 bytes per sample= 19,200,000 bytes of RAM
> That is nearly 20megs of RAM.
>
> (you might be able to use 'short' (16bit) values, which would cut the
> RAM used by half)
>
> Do you have that much RAM available?
>
> You did not mention which ADC you are using.
> You did not mention how the ADC is actually attached to the DSP.
> You did not mention how you are handling the negative voltage values.
>
> That info would be useful in determining the expected range of the
> data values in RAM and if any pre-scaling or level shifting of the
> voltages will be needed in hardware.
>
> I expect you will need to shift the voltage levels both for the input
> and for the output. I expect you will need to scale the voltage levels
> both for the input and for the output.
>
> How do you plan on getting the data from the DSP RAM to MatLab?
> RTDX, DAC, something else?
>
> Such details will make a significant difference in how the RAM data
> will need to be scaled, level shifted, etc. before being sent out.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S
> To: c...
> Sent: Tue, 21 Dec 2010 11:57:59 -0800 (PST)
> Subject: [c6x] 12-bit ADC with C6713
>
> > Hi,
> >
> > I have interfaced a 12-bit ADC with C6713 DSP. How can I scale the
> > output to see the amplitude of the output signal same as of input
> > signal ? For example, Amplitude = 2 Vp_p with 5KHz frequency ?
> >
> > I want to run ADC for 5 minutes or more and save all the sampled
> > values in a file to examine them in Matlab ? Can you please tell me
> > how could I do it ?
> >
> > Waiting for your help.
> >
> > BR,
> > BAS
> ------- End of Original Message -------
------- End of Original Message -------
B.S.

There are two things I would look at:

First, calculate the voltage-per-bit. Then calculate the input voltage by
multiplying the raw input value by the voltage-per-bit to get the actual input
voltage.

Second, feed the ADC a single voltage, NOT a sine wave, and work on your formula
to reproduce the actual voltage value.

Note: a .5 volt offset will produce a .5 volt offset in the raw input value.
so the resulting graph of the input values will show that offset.

In general, the initialization sequence of a ADC includes at least two readings.
One is the zero/ground voltage
two is the max voltage.
The above two reading will give you the appropriate offset(the ground reading)
and full scale(the max voltage reading) to be applied to the raw input value.

R. Williams

---------- Original Message -----------
From: B S
To: Richard Williams
Cc: c...
Sent: Thu, 30 Dec 2010 07:20:05 -0800 (PST)
Subject: Re: [c6x] 12-bit ADC with C6713

> Hi,
>
> I was trying to convert the sampled values back to voltage the
> following way:
>
> float buffer_involt[BLOCK_SZ];
> float maxAdcBits = 4095.0f;
> float maxVolts = 2.5f; // Vref
> float offset = 0.5f;
>
> buffer_involt = (maxVolts-offset)*(float)r_buffer/maxAdcBits;
>
> Please find attached snapshot of waveform.
>
> http://i56.tinypic.com/105eeef.jpg
>
> In the first diagram, there is no offset and input voltage is 1V
> which in turns giving 0.939V after using the formula given above.
>
> In the second diagram, offset has set to 0.5V according to
> Oscilloscope and input signal is still 1V. Now graph doesn't show
> 0.939V for 1V input ?
>
> What am I doing wrong ?
>
> BAS
>
> From: Richard Williams To: B S
> Cc: c...
> Sent: Wed, December 22, 2010 8:18:35 PM
> Subject: Re: [c6x] 12-bit ADC with C6713
>
> B.S.
>
> for scaling to make output look like input.
>
> using short int values (signed values)
>
> 1) subtract the '0volt' value from all data points.
> This will result in the data both positive and negative values,
> centered around
> 0.
>
> 2) multiply all data points by 'value' needed to bring the peaks to represent
> +/-1 volt.
> This will scale the data to the original scaling of 2 Vp_p.
> Exactly what that 'value' will need to be may require some experimentation.
>
> BTW:
> If you are using the code from: STAA257.zip
> Then you will be missing data.
> The reason is the EDMA is setup to
> 1) read data into pingBuf
> 2) then, read data into pongBuf
> 3) then, pause while the data is copied into the dataPing and dataPong
> buffers 4) then, resume reading data.
>
> That pause will cause data to be missed.
> I would suggest:
> --first EDMA sequence:
> --read data into pingBuf, when full invoke' EDMA interrupt' event
> --chain (as it is currently doing) to the second EDMA sequence
>
> --second EDMA sequence:
> --read data into pongBuf, when full invoke 'EDMA interrupt' event
> --chain (this is new) to the first EDMA sequence
>
> --in the 'EDMA interrupt' event handler:
> --use the EDMA status to determine which EDMA sequence caused the
> interrupt and set the pingpong variable accordingly --only reset/re-
> enable the appropriate EDMA event --trigger a 'software interrupt'
>
> --add a 'software interrupt'' handler to the system
> --in the 'software interrupt' handler:
>
> --use the pingpong variable to determine which data buffer on which to
> perform any data processing
>
> Note:
> unless the data processing requires copying, do not perform any data buffer
> copying as that takes an extended amount of time/CPU cycles.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S
> To: Richard Williams
> Cc: c...
> Sent: Wed, 22 Dec 2010 02:58:27 -0800 (PST)
> Subject: Re: [c6x] 12-bit ADC with C6713
>
> > Thanks guys for your answers.
> >
> > @ R. Williams,
> >
> > I don't think that much RAM is available. I am using C6713 DSK with 16
> > MB SDRAM, L1P is 4K-Bytes and L1D is 4K-Bytes while L2 memory is 256K-Bytes.
> >
> > I am using ADS7881EVM.
> >
> > ADS7881EVM has been interfaced through a 5-6K Interface Board to DSP.
> >
> > Since ADC is unipolar, I am using offser Voltage of 1V controlled by ADS7881.
> >
> > ADC is 12 bit device while DSP is saving sampled values in unsigned
> > short format. Check out the amplitude level of sampled sine wave in
> > the snapshot given below, I don't know how DSP is doing mathematics to
> > convert 12 bits to 16 bits. I really don't know how to scale the output.
> >
> > http://i55.tinypic.com/21d51ty.jpg
> >
> > #pragma DATA_ALIGN (r_buffer, 128)
> > unsigned short r_buffer[BUFFER_SIZE];
> >
> > I don't know how transfer of data from DSP to PC will take place,
> > heard about RTDX but don't know how it works. Any help regarding that
> > will be appreciated. Size of the data is not a problem even 1024
> > samples will be enough but I want to examine them in Matlab.
> >
> > @ Voranian
> >
> > I am using 5-6K Interfacing Board to interface ADS7881 Evaliation
> > Module with C6713.
> >
> > @ Mikedunn
> >
> > Don't know much about SDRAM, but I will see how to do it.
> > ---------
> >
> > Waiting for your response.
> >
> > -BAS
> >
> > ________________________________
> > From: Richard Williams
> > To: B S ; c...
> > Sent: Wed, December 22, 2010 12:43:25 AM
> > Subject: Re: [c6x] 12-bit ADC with C6713
> >
> > B.S.
> >
> > a 5Khz input signal will require a(at least) a 10khz sampling rate to avoid
> > problems with the nyquist(sp) frequency.
> > I think the next higher sampling rate available is 16khz.
> > so 16k*60*5H00000 samples in 5 minutes.
> > at 4 bytes per sample= 19,200,000 bytes of RAM
> > That is nearly 20megs of RAM.
> >
> > (you might be able to use 'short' (16bit) values, which would cut the
> > RAM used by half)
> >
> > Do you have that much RAM available?
> >
> > You did not mention which ADC you are using.
> > You did not mention how the ADC is actually attached to the DSP.
> > You did not mention how you are handling the negative voltage values.
> >
> > That info would be useful in determining the expected range of the
> > data values in RAM and if any pre-scaling or level shifting of the
> > voltages will be needed in hardware.
> >
> > I expect you will need to shift the voltage levels both for the input
> > and for the output. I expect you will need to scale the voltage levels
> > both for the input and for the output.
> >
> > How do you plan on getting the data from the DSP RAM to MatLab?
> > RTDX, DAC, something else?
> >
> > Such details will make a significant difference in how the RAM data
> > will need to be scaled, level shifted, etc. before being sent out.
> >
> > R. Williams
> >
> > ---------- Original Message -----------
> > From: B S
> > To: c...
> > Sent: Tue, 21 Dec 2010 11:57:59 -0800 (PST)
> > Subject: [c6x] 12-bit ADC with C6713
> >
> > > Hi,
> > >
> > > I have interfaced a 12-bit ADC with C6713 DSP. How can I scale the
> > > output to see the amplitude of the output signal same as of input
> > > signal ? For example, Amplitude = 2 Vp_p with 5KHz frequency ?
> > >
> > > I want to run ADC for 5 minutes or more and save all the sampled
> > > values in a file to examine them in Matlab ? Can you please tell me
> > > how could I do it ?
> > >
> > > Waiting for your help.
> > >
> > > BR,
> > > BAS
> > ------- End of Original Message -------
> ------- End of Original Message -------
------- End of Original Message -------

_____________________________________