> I've got a solution for the problem. With a
FLUKE Meter
> measured the output and input, got the ratio
> output/input and every sample i'm multipling with this
> ratio. It's not perfect but its a solution.
>
> Another problem: I calculated the RMS of a sine wave,
> for 2Vp-p its 0.707Vrms. I want to show on the scope
> this value but when i run the program its always 0
> (a line at 0 on scope). I think there is a problem
> with plotting a variable with constant values.
Well I can't help you. I asked you at least five (5)questions before and
you didn't answer, plus I never heard the
results of the experiments I outlined. So I really have no idea what
you're doing.
-Jeff
> ________________________________
> From: Jeff Brower
> To: c...
> Cc: Adi Aditza
> Sent: Friday, May 20, 2011 2:16 AM
> Subject: Re: [c6x] DSP 6416
>
> Adi-
>
>> I've run the code you posted and i've got nothing on the
>> scope
>
> Please clarify "nothing" -- you mean you have a flat line? What is your scope
timebase (time per division)? What is
> your AIC23 sampling rate? In your posts so far, I've seen two sampling
rates mentioned: 8 and 48 kHz. The test code
> I gave you generates a sawtooth waveform -- if you use 8 kHz and you increment
your output by 1 each sample then it
> will a little more than 8 sec to see one period of the sawtooth. If you use
48 kHz then it will take somewhat less
> than 1 sec. If you adjust the increment value you can make the period faster.
For example you can set your timebase
> for 1 msec per div and then adjust N in your ISR code until you see
something:
>
> static unsigned short int i = 0;
>
> sample_data = (short int)i;
> i += N; /* increase N until scope shows a sawtooth waveform */
> output_sample(sample_data); //output data
>
>> but i could save the values of posmax and negmax in a
>> file.
>>
>> Here are some values (first column is posmax, second is negmax) and they are
pretty strange:
>>
>> 0 0
>> 9293 0
>> 9693 0
>> 9748 0
>> 9748 0
>> -5049 0
>> -888 0
>> 9096 0
>> -6205 0
>> -1230 0
>> -3100 0
>> -4948 0
>> -6869 0
>> -8043 0
>> -8955 0
>> -9512 0
>> -9764 0
>> -9709 0
>> -9254 0
>> -8457 0
>> -6787 0
>> -5300 0
>> -3552 0
>> -8088 0
>> -6873 0
>> 1882 0
>> 9198 0
>> 9198 0
>> 9198 0
>> 9198 0
>> 9202 0
>> 9677 0
>> 9677 0
>> 9677 0
>> 9677 0
>> 9677 0
>> -9787 0
>> 9669 0
>> 9669 0
>> 9669 0
>> 9669 0
>>
>> Let me know you're opinion on this thing.
>
> My opinion is you that either you didn't write out the correct values or
you didn't use my code correctly. First, why
> do you need to print out so many values? The idea of keeping max values is
that you only need to check two values
> after letting the code run for a while (positive and negative max) -- the
point being to measure your maximum
> peak-to-peak input levels. Second, why is negmax always zero? You don't
have any negative codec input values? I
> doubt that.
>
> -Jeff
>
>> ________________________________
>> From: mikedunn
>> To: Adi Aditza
>> Cc: c...
>> Sent: Thursday, May 19, 2011 12:39 AM
>> Subject: Re: [c6x] DSP 6416
>> Adi,
>>
>> Slow down and think. You have characterized your problem - that is
>> good.
>> BTW, I am not familiar with the analog circuitry but I would never
>> apply more than 2v to line in.
>>
>> Now that your problem is characterized, you know that you have two
>> "boxes" [input & output] that could be "broken". Like Jeff has
>> advised, you need to verify the correct or incorrect behavior of the
>> "boxes".
>>
>> Some ideas to for troubleshooting...
>> 1. Follow Jeff's suggestions.
>> 2. You could also hack your code to output a value, delay, output a
>> second value, delay in an infinite loop to create a square wave.
>> Check measured values vs. expected values.
>> 3. One disadvantage in your setup is that it is unbuffered. You may
>> want to consider capturing enough input samples for a couple of
>> cycles and analyzing the values.
>>
>> As for "how is it possible?" - the answer is usually very clear
>> after methodical troubleshooting.
>>
>> mikedunn
>>
>> On 5/18/2011 1:22 PM, Jeff Brower wrote:
>> Â
>>>Adi-
>>>
>>>You're worried about too many things -- it takes too much
>> time to read your post and try to follow along.
>>>
>>>The art of debug requires you to simplify and divide the
>> problem, and check basic things one at a time. Start by
>>>separating input from output and checking your output
>> levels, by generating output signals in software.
>>>
>>>I explained how to do this in my previous post. I can't
>> help you any further unless you do those specific
>>>experiments. What results do you get?
>>>
>>>-Jeff
>>>
>>>> I've been doing some research on the board and found
>> out this in Rulph Chassaing book: "The maximum allowable
>> input
>>>> signal level at the LINE IN inputs to the codec is
>>>> 1 V rms. However, the C6713 and C6416 DSKs contain a
>> potential divider circuit with a
gain of 0.5 between
>> their LINE
>>>> IN sockets and the codec itself with the effect
>>>> that the maximum allowable input signal level at the
>> LINE IN sockets on the DSKs is 2 V
rms. Above this level,
>> input
>>>> signals will be distorted. Input and output sockets
>>>> on the DSKs are ac coupled to the codec."ÂÂ
>>>>
>>>> I used this code from the book:ÂÂ
>>>>
>>>> //loop_poll.c loop program using polling
>>>> #include "DSK6416_AIC23.h" //codec support
>>>> Uint32 fs=DSK6416_AIC23_FREQ_8KHZ; //set sampling
>> rate
>>>>
>>>> void main()
>>>> {
>>>> short sample_data;
>>>> comm_poll(); //init DSK, codec, McBSP
>>>> while(1) //infinite loop
>>>> {
>>>> sample_data = input_left_sample(); //input sample
>>>> output_left_sample(sample_data); //output sample
>>>> }
>>>> }
>>>>
>>>> From the book again: "Input a sinusoidal waveform to
>> the LINE IN connector on the DSK, with an
amplitude of
>>>> approximately 2.0 V p - p and a frequency of
>> approximately 1 kHz. Connect
>>>> the output of the DSK, LINE OUT, to an oscilloscope,
>> and verify the presence of a tone of
the same frequency,
>> but
>>>> attenuated to approximately 1.0 V p - p. This
>> attenuation
>>>> is due to the potential divider network, comprising
>> two resistors, on the DSK circuit
board between the LINE
>> IN
>>>> socket and the codec input."
>>>>
>>>> Done that but with different results, at LINE OUT the
>> signal had same frequency and amplitude of 0.4Vp-p. The
>> AIC23
>>>> codec had this values in registers:ÂÂ
>>>>
>>>> DSK6416_AIC23_Config config = {ÂÂ
>>>> 0x0017, /* Set-Up Reg 0 Left line in volume control
>> */
>>>> 0x0017, /* Set-Up Reg 1 Right line in volume control
>> */ÂÂ
>>>> 0x01f9, /* Set-Up Reg 2 Left channel headphone volume
>> */ÂÂ
>>>> 0x01f9, /* Set-Up Reg 3 Right channel headphone
>> volume */ÂÂ
>>>> 0x0011, /* Set-Up Reg 4 Analog audio path control
>> */ÂÂ
>>>> 0x0000, /* Set-Up Reg 5 Digital audio path control
>> */ÂÂ
>>>> 0x0000, /* Set-Up Reg 6 Power down control
*/ÂÂ
>>>> 0x0043, /* Set-Up Reg 7 Digital audio interface
>> format */ÂÂ
>>>> 0x0081, /* Set-Up Reg 8 Sample rate control
*/ÂÂ
>>>> 0x0001 /* Set-Up Reg 9 Digital interface activation
>> */ÂÂ
>>>> };
>>>>
>>>> After this i tested the board for different
>> amplitudes and got this results:
>>>>
>>>> input =1.5Vp-poutput=0.3Vp-p
>>>> input=2Vp-poutput=0.4Vp-p
>>>> input=3Vp-poutput=0.6Vp-p
>>>> input=4Vp-poutput=0.76Vp-pÂÂ
 ÂÂ
>>>> input=5Vp-poutput=1Vp-p
>>>>
>>>>
>>>> Looks like the output=0.2*input. How is it possible
>> ?????
>>>>
>>>>
>>>> ________________________________
>>>> From: Jeff Brower
>>>> To: c...
>>>> Cc: Adi Aditza
>>>> Sent: Friday, May 13, 2011 11:43 PM
>>>> Subject: Re: [c6x] DSP 6416
>>>>
>>>>
>>>> ÂÂ
>>>> Adi-
>>>>
>>>>> Let me start again with the problem.
>>>>>
>>>>> Here is the code im using:ÂÂ
>>>>>
>>>>> #include "dsk6416_aic23.h" //codec-DSK support
>> file
>>>>> Uint32 fs=DSK6416_AIC23_FREQ_48KHZ; //set
>> sampling rate
>>>>> interrupt void c_int11() //interrupt service
>> routine
>>>>> {
>>>>> short sample_data;
>>>>> sample_data = input_sample(); //input data
>>>>> output_sample(sample_data); //output data
>>>>> return;
>>>>> }
>>>>> void main()
>>>>> {
>>>>> comm_intr(); //init DSK, codec, McBSP
>>>>> while(1); //infinite loop
>>>>> }
>>>>>
>>>>> I generate a signal with 2Vp-p amplitude and 1kHz
>> frequency
>>>>> with a signal generator and connect it to Line
>> IN. After i
>>>>> run the code, the signal from Line OUT shown on
>> oscilloscope
>>>>> is  a sine wave with 0.8Vp-p and 1kHz. If i
vary
>> the
>>>>> frequency and amplitude at input, it varies at
>> output
>>>>> (frequency at output is the same as input only
>> the amplitude
>>>>> is attentuated at output).ÂÂ
>>>>>
>>>>> The cables im working with are coaxial with BNC
>> plug at one
>>>>> end and audio jack (3.5mm) at the other end, and
>> another
>>>>> coaxial has BNC plugs at both ends.ÂÂ
>>>>> The signal generator and oscilloscope are
>> connected to
>>>>> 230VAC.
>>>>>
>>>>> The board im using is TMS320C6416T. If you need
>> the other
>>>>> files im using let me know. They
>>>>>
>>
are: C6416dskinit.c, C6416dsk.cmd, Vectors_intr.asm,
>>>>> c6416dskinit.h, dsk6416_aic23.h.
>>>>
>>>> It could be the DSK board has different gain settings
>> for input vs. output. In your first post you mentioned
>> some
>>>> register values -- what are those? AIC23 registers?
>> If so which ones? Do you have input and output gain (or
>>>> attenuation) set as matching?
>>>>
>>>> Also, try doing the following in your ISR:
>>>>
>>>> static unsigned short int i = 0;
>>>> static short int posmax =0;
>>>> static short int negmax = 0;
>>>>
>>>> sample_data = input_sample(); //input data
>>>> if (sample_data > posmax) posmax = sample_data;
>>>> if (sample_data < negmax) negmax = sample_data;
>>>> sample_data = (short int)i++;
>>>> output_sample(sample_data); //output data
>>>>
>>>> This will cause output ranging from 0 to 65535; i.e.
>> maximum possible range. What's the max Vpp you see on
the
>> scope?
>>>> If your max scope Vpp is still 0.8, then clearly
>> something in hardware is restricting your output amplitude
>> level.
>>>>
>>>> And you can look at posmax and negmax values after
>> you pause the code. First they should be symmetric, if not
>> then
>>>> you don't have the signal generator hooked up
>> correctly. Second from what I recall with the DSK boards
>> and AIC23
>>>> codecs, you should be able to give +/- 2V input to
>> the boards, maybe a bit higher. So in your case posmax
>> should be
>>>> around 15,000.
>>>>
>>>> -Jeff
>>>>
>>>>> ________________________________
>>>>> From: Jeff Brower
>>>>> To: Adi Aditza
>>>>> Cc: c...
>>>>> Sent: Thursday, May 12, 2011 10:40 PM
>>>>> Subject: Re: [c6x] DSP 6416
>>>>>
>>>>> Adi-
>>>>>
>>>>>> I connected the signal from signal generator
>> to the
>>>>>> oscilloscope and its a sine wave with 2Vp-p
>> amplitude.
>>>>>
>>>>> Is that not what you expect? Can you vary
the
>> level using the amplitude control on the signal generator?
>>>>>
>>>>>> generator has 2 output impedances (50ohm and
>> 600ohm)
>>>>>> and the result its the same.
>>>>>
>>>>> Scope inputs are high impedance, so it won't
>> matter what is the signal generator output impedance --
>> both selections
>>>>> should look the same.
>>>>>
>>>>>> I have a DSP 6416T and i'm using it for
>> calculating
>>>>>> the effective value of a sine wave.
>>>>>
>>>>> Can you clarify your setup? If the signal
>> generator is producing the sine wave and the scope is
>> measuring it, then
>>>>> what is the DSP doing? And what type of
board
>> do you have? DSK
6416? Something else?
>>>>>
>>>>> -Jeff
>>>>>
>>>>>> ________________________________
>>>>>> From: mikedunn
>>>>>> To: Ceausu Adrian
>>>>>> Cc: c...
>>>>>> Sent: Thursday, May 12, 2011 7:42 PM
>>>>>> Subject: Re: [c6x] DSP 6416
>>>>>>
>>>>>>
>>>>>> Ceausu Adrian,
>>>>>>
>>>>>> On 5/12/2011 8:20 AM, Ceausu Adrian wrote:
>>>>>> ÂÂÂ
>>>>>>>Hello,
>>>>>>>
>>>>>>>
>>>>>>>I have a DSP 6416T and i'm using it for
>> calculating the effective value of a sine wave.
>>>>>>>I've made the default settings in
>> registers, 0x0017 for input and 0x01f9 for output, and
>> when i generate (with a
>>>>>>> signal generator) a sine wave with 2Vp-p
>> amplitude, on the oscilloscope its only
0.8Vp-p.ÂÂÂ
>>>>>>>
>>>>>>>
>>>>>>>Does anyone knows why ?
>>>>>>
>>>>>> a. the impedance of the load is incorrect for
>> the signal generator
>>>>>> or
>>>>>> b. the signal generator is broken or
>> incorrectly set up
>>>>>> or
>>>>>> c. the scope or probe is broken, out of
>> calibration, or incorrectly
>>>>>>  set up
>>>>>>
>>>>>>
>>>>>> mikedunn
>>>>>> Thank
you.ÂÂÂ
_____________________________________
Reply by Adi aditza●May 26, 20112011-05-26
Jeff,
I've got a solution for the problem. With a FLUKE Meter measured the output
and input, got the ratio output/input and every sample i'm multipling with
this ratio. It's not perfect but its a solution.
Another problem: I calculated the RMS of a sine wave, for 2Vp-p its 0.707Vrms. I
want to show on the scope this value but when i run the program its always 0 (a
line at 0 on scope). I think there is a problem with plotting a variable with
constant values.
________________________________
From: Jeff Brower
To: c...
Cc: Adi Aditza
Sent: Friday, May 20, 2011 2:16 AM
Subject: Re: [c6x] DSP 6416
Adi-
> I've run the code you posted and i've got
nothing on the
> scope
Please clarify "nothing" -- you mean you have a flat line? What is your scope
timebase (time per division)? What is
your AIC23 sampling rate? In your posts so far, I've seen two sampling
rates mentioned: 8 and 48 kHz. The test code
I gave you generates a sawtooth waveform -- if you use 8 kHz and you increment
your output by 1 each sample then it
will a little more than 8 sec to see one period of the sawtooth. If you use 48
kHz then it will take somewhat less
than 1 sec. If you adjust the increment value you can make the period faster.
For example you can set your timebase
for 1 msec per div and then adjust N in your ISR code until you see
something:
static unsigned short int i = 0;
sample_data = (short int)i;
i += N; /* increase N until scope shows a sawtooth waveform */
output_sample(sample_data); //output data
> but i could save the values of posmax and negmax in
a
> file.
>
> Here are some values (first column is posmax, second is negmax) and they are
pretty strange:
>
> 0 0
> 9293 0
> 9693 0
> 9748 0
> 9748 0
> -5049 0
> -888 0
> 9096 0
> -6205 0
> -1230 0
> -3100 0
> -4948 0
> -6869 0
> -8043 0
> -8955 0
> -9512 0
> -9764 0
> -9709 0
> -9254 0
> -8457 0
> -6787 0
> -5300 0
> -3552 0
> -8088 0
> -6873 0
> 1882 0
> 9198 0
> 9198 0
> 9198 0
> 9198 0
> 9202 0
> 9677 0
> 9677 0
> 9677 0
> 9677 0
> 9677 0
> -9787 0
> 9669 0
> 9669 0
> 9669 0
> 9669 0
>
> Let me know you're opinion on this thing.
My opinion is you that either you didn't write out the correct values or
you didn't use my code correctly. First, why
do you need to print out so many values? The idea of keeping max values is that
you only need to check two values
after letting the code run for a while (positive and negative max) -- the point
being to measure your maximum
peak-to-peak input levels. Second, why is negmax always zero? You don't
have any negative codec input values? I
doubt that.
-Jeff
> ________________________________
> From: mikedunn
> To: Adi Aditza
> Cc: c...
> Sent: Thursday, May 19, 2011 12:39 AM
> Subject: Re: [c6x] DSP 6416
> Adi,
>
> Slow down and think. You have characterized your problem - that is
> good.
> BTW, I am not familiar with the analog circuitry but I would never
> apply more than 2v to line in.
>
> Now that your problem is characterized, you know that you have two
> "boxes" [input & output] that could be "broken". Like Jeff has
> advised, you need to verify the correct or incorrect behavior of the
> "boxes".
>
> Some ideas to for troubleshooting...
> 1. Follow Jeff's suggestions.
> 2. You could also hack your code to output a value, delay, output a
> second value, delay in an infinite loop to create a square wave.
> Check measured values vs. expected values.
> 3. One disadvantage in your setup is that it is unbuffered. You may
> want to consider capturing enough input samples for a couple of
> cycles and analyzing the values.
>
> As for "how is it possible?" - the answer is usually very clear
> after methodical troubleshooting.
>
> mikedunn
>
> On 5/18/2011 1:22 PM, Jeff Brower wrote:
> Â
>>Adi-
>>
>>You're worried about too many things -- it takes too much
> time to read your post and try to follow along.
>>
>>The art of debug requires you to simplify and divide the
> problem, and check basic things one at a time. Start by
>>separating input from output and checking your output
> levels, by generating output signals in software.
>>
>>I explained how to do this in my previous post. I can't
> help you any further unless you do those specific
>>experiments. What results do you get?
>>
>>-Jeff
>>
>>> I've been doing some research on the board and found
> out this in Rulph Chassaing book: "The maximum allowable
> input
>>> signal level at the LINE IN inputs to the codec is
>>> 1 V rms. However, the C6713 and C6416 DSKs contain a
> potential divider circuit with a gain
of 0.5 between
> their LINE
>>> IN sockets and the codec itself with the effect
>>> that the maximum allowable input signal level at the
> LINE IN sockets on the DSKs is 2 V
rms. Above this level,
> input
>>> signals will be distorted. Input and output sockets
>>> on the DSKs are ac coupled to the codec."ÂÂ
>>>
>>> I used this code from the book:ÂÂ
>>>
>>> //loop_poll.c loop program using polling
>>> #include "DSK6416_AIC23.h" //codec support
>>> Uint32 fs=DSK6416_AIC23_FREQ_8KHZ; //set sampling
> rate
>>>
>>> void main()
>>> {
>>> short sample_data;
>>> comm_poll(); //init DSK, codec, McBSP
>>> while(1) //infinite loop
>>> {
>>> sample_data = input_left_sample(); //input sample
>>> output_left_sample(sample_data); //output sample
>>> }
>>> }
>>>
>>> From the book again: "Input a sinusoidal waveform to
> the LINE IN connector on the DSK, with an
amplitude of
>>> approximately 2.0 V p - p and a frequency of
> approximately 1 kHz. Connect
>>> the output of the DSK, LINE OUT, to an oscilloscope,
> and verify the presence of a tone of
the same frequency,
> but
>>> attenuated to approximately 1.0 V p - p. This
> attenuation
>>> is due to the potential divider network, comprising
> two resistors, on the DSK circuit
board between the LINE
> IN
>>> socket and the codec input."
>>>
>>> Done that but with different results, at LINE OUT the
> signal had same frequency and amplitude of 0.4Vp-p. The
> AIC23
>>> codec had this values in registers:ÂÂ
>>>
>>> DSK6416_AIC23_Config config = {ÂÂ
>>> 0x0017, /* Set-Up Reg 0 Left line in volume control
> */
>>> 0x0017, /* Set-Up Reg 1 Right line in volume control
> */ÂÂ
>>> 0x01f9, /* Set-Up Reg 2 Left channel headphone volume
> */ÂÂ
>>> 0x01f9, /* Set-Up Reg 3 Right channel headphone
> volume */ÂÂ
>>> 0x0011, /* Set-Up Reg 4 Analog audio path control
> */ÂÂ
>>> 0x0000, /* Set-Up Reg 5 Digital audio path control
> */ÂÂ
>>> 0x0000, /* Set-Up Reg 6 Power down control */ÂÂ
>>> 0x0043, /* Set-Up Reg 7 Digital audio interface
> format */ÂÂ
>>> 0x0081, /* Set-Up Reg 8 Sample rate control
*/ÂÂ
>>> 0x0001 /* Set-Up Reg 9 Digital interface activation
> */ÂÂ
>>> };
>>>
>>> After this i tested the board for different
> amplitudes and got this results:
>>>
>>> input =1.5Vp-poutput=0.3Vp-p
>>> input=2Vp-poutput=0.4Vp-p
>>> input=3Vp-poutput=0.6Vp-p
>>> input=4Vp-poutput=0.76Vp-pÂÂ
 ÂÂ
>>> input=5Vp-poutput=1Vp-p
>>>
>>>
>>> Looks like the output=0.2*input. How is it possible
> ?????
>>>
>>>
>>> ________________________________
>>> From: Jeff Brower
>>> To: c...
>>> Cc: Adi Aditza
>>> Sent: Friday, May 13, 2011 11:43 PM
>>> Subject: Re: [c6x] DSP 6416
>>>
>>>
>>> ÂÂ
>>> Adi-
>>>
>>>> Let me start again with the problem.
>>>>
>>>> Here is the code im using:ÂÂ
>>>>
>>>> #include "dsk6416_aic23.h" //codec-DSK support
> file
>>>> Uint32 fs=DSK6416_AIC23_FREQ_48KHZ; //set
> sampling rate
>>>> interrupt void c_int11() //interrupt service
> routine
>>>> {
>>>> short sample_data;
>>>> sample_data = input_sample(); //input data
>>>> output_sample(sample_data); //output data
>>>> return;
>>>> }
>>>> void main()
>>>> {
>>>> comm_intr(); //init DSK, codec, McBSP
>>>> while(1); //infinite loop
>>>> }
>>>>
>>>> I generate a signal with 2Vp-p amplitude and 1kHz
> frequency
>>>> with a signal generator and connect it to Line
> IN. After i
>>>> run the code, the signal from Line OUT shown on
> oscilloscope
>>>> is  a sine wave with 0.8Vp-p and 1kHz. If i
vary
> the
>>>> frequency and amplitude at input, it varies at
> output
>>>> (frequency at output is the same as input only
> the amplitude
>>>> is attentuated at output).ÂÂ
>>>>
>>>> The cables im working with are coaxial with BNC
> plug at one
>>>> end and audio jack (3.5mm) at the other end, and
> another
>>>> coaxial has BNC plugs at both ends.ÂÂ
>>>> The signal generator and oscilloscope are
> connected to
>>>> 230VAC.
>>>>
>>>> The board im using is TMS320C6416T. If you need
> the other
>>>> files im using let me know. They
>>>>
>
are: C6416dskinit.c, C6416dsk.cmd, Vectors_intr.asm,
>>>> c6416dskinit.h, dsk6416_aic23.h.
>>>
>>> It could be the DSK board has different gain settings
> for input vs. output. In your first post you mentioned
> some
>>> register values -- what are those? AIC23 registers?
> If so which ones? Do you have input and output gain (or
>>> attenuation) set as matching?
>>>
>>> Also, try doing the following in your ISR:
>>>
>>> static unsigned short int i = 0;
>>> static short int posmax =0;
>>> static short int negmax = 0;
>>>
>>> sample_data = input_sample(); //input data
>>> if (sample_data > posmax) posmax = sample_data;
>>> if (sample_data < negmax) negmax = sample_data;
>>> sample_data = (short int)i++;
>>> output_sample(sample_data); //output data
>>>
>>> This will cause output ranging from 0 to 65535; i.e.
> maximum possible range. What's the max Vpp you see on
the
> scope?
>>> If your max scope Vpp is still 0.8, then clearly
> something in hardware is restricting your output amplitude
> level.
>>>
>>> And you can look at posmax and negmax values after
> you pause the code. First they should be symmetric, if not
> then
>>> you don't have the signal generator hooked up
> correctly. Second from what I recall with the DSK boards
> and AIC23
>>> codecs, you should be able to give +/- 2V input to
> the boards, maybe a bit higher. So in your case posmax
> should be
>>> around 15,000.
>>>
>>> -Jeff
>>>
>>>> ________________________________
>>>> From: Jeff Brower
>>>> To: Adi Aditza
>>>> Cc: c...
>>>> Sent: Thursday, May 12, 2011 10:40 PM
>>>> Subject: Re: [c6x] DSP 6416
>>>>
>>>> Adi-
>>>>
>>>>> I connected the signal from signal generator
> to the
>>>>> oscilloscope and its a sine wave with 2Vp-p
> amplitude.
>>>>
>>>> Is that not what you expect? Can you vary
the
> level using the amplitude control on the signal generator?
>>>>
>>>>> generator has 2 output impedances (50ohm and
> 600ohm)
>>>>> and the result its the same.
>>>>
>>>> Scope inputs are high impedance, so it won't
> matter what is the signal generator output impedance --
> both selections
>>>> should look the same.
>>>>
>>>>> I have a DSP 6416T and i'm using it for
> calculating
>>>>> the effective value of a sine wave.
>>>>
>>>> Can you clarify your setup? If the signal
> generator is producing the sine wave and the scope is
> measuring it, then
>>>> what is the DSP doing? And what type of
board
> do you have? DSK
6416? Something else?
>>>>
>>>> -Jeff
>>>>
>>>>> ________________________________
>>>>> From: mikedunn
>>>>> To: Ceausu Adrian
>>>>> Cc: c...
>>>>> Sent: Thursday, May 12, 2011 7:42 PM
>>>>> Subject: Re: [c6x] DSP 6416
>>>>>
>>>>>
>>>>> Ceausu Adrian,
>>>>>
>>>>> On 5/12/2011 8:20 AM, Ceausu Adrian wrote:
>>>>> ÂÂÂ
>>>>>>Hello,
>>>>>>
>>>>>>
>>>>>>I have a DSP 6416T and i'm using it for
> calculating the effective value of a sine wave.
>>>>>>I've made the default settings in
> registers, 0x0017 for input and 0x01f9 for output, and
> when i generate (with a
>>>>>> signal generator) a sine wave with 2Vp-p
> amplitude, on the oscilloscope its only
0.8Vp-p.ÂÂÂ
>>>>>>
>>>>>>
>>>>>>Does anyone knows why ?
>>>>>
>>>>> a. the impedance of the load is incorrect for
> the signal generator
>>>>> or
>>>>> b. the signal generator is broken or
> incorrectly set up
>>>>> or
>>>>> c. the scope or probe is broken, out of
> calibration, or incorrectly
>>>>>  set up
>>>>>
>>>>>
>>>>> mikedunn
>>>>> Thank
you.ÂÂÂ
Reply by Richard Williams●May 19, 20112011-05-19
Adi,
If you have the full CCS installed, the examples sub directory contains a
folder, named something like: dsp_app.
This folder contains a complete program for reading via the daughter card,
and
echoing the results back via the daughter card.
It is well commented.
It makes use of the BIOS in one version.
It makes use of the interrupts,
It makes use of the EDMA,
It makes use of double buffering for both the input and output
It makes use of software interrupts.
I.E. it contains everything you need to properly access the aic daughter
card.
R. Williams
---------- Original Message -----------
From: Adi aditza
To: mikedunn , "j...@signalogic.com"
> Jeff,
>
> I've run the code you posted and i've got nothing on the scope but i
> could save the values of posmax and negmax in a file.
>
> Here are some values (first column is posmax, second is negmax) and
> they are pretty strange:
>
> 0 0
> 9293 0
> 9693 0
> 9748 0
> 9748 0
> -5049 0
> -888 0
> 9096 0
> -6205 0
> -1230 0
> -3100 0
> -4948 0
> -6869 0
> -8043 0
> -8955 0
> -9512 0
> -9764 0
> -9709 0
> -9254 0
> -8457 0
> -6787 0
> -5300 0
> -3552 0
> -8088 0
> -6873 0
> 1882 0
> 9198 0
> 9198 0
> 9198 0
> 9198 0
> 9202 0
> 9677 0
> 9677 0
> 9677 0
> 9677 0
> 9677 0
> -9787 0
> 9669 0
> 9669 0
> 9669 0
> 9669 0
>
> Let me know you're opinion on this thing.
>
> ________________________________
> From: mikedunn
> To: Adi Aditza
> Cc: c...
> Sent: Thursday, May 19, 2011 12:39 AM
> Subject: Re: [c6x] DSP 6416
>
> Adi,
>
> Slow down and think. You have characterized your problem - that is
> good.
> BTW, I am not familiar with the analog circuitry but I would never
> apply more than 2v to line in.
>
> Now that your problem is characterized, you know that you have two
> "boxes" [input & output] that could be "broken". Like Jeff has
> advised, you need to verify the correct or incorrect behavior of
> the "boxes".
>
> Some ideas to for troubleshooting...
> 1. Follow Jeff's suggestions.
> 2. You could also hack your code to output a value, delay, output a
> second value, delay in an infinite loop to create a square wave.
> Check measured values vs. expected values.
> 3. One disadvantage in your setup is that it is unbuffered. You may
> want to consider capturing enough input samples for a couple of
> cycles and analyzing the values.
>
> As for "how is it possible?" - the answer is usually very clear
> after methodical troubleshooting.
>
> mikedunn
>
> On 5/18/2011 1:22 PM, Jeff Brower wrote:
>
> >Adi-
> >
> >You're worried about too many things -- it takes too much
> time to read your post and try to follow along.
> >
> >The art of debug requires you to simplify and divide the
> problem, and check basic things one at a time. Start by
> >separating input from output and checking your output
> levels, by generating output signals in software.
> >
> >I explained how to do this in my previous post. I can't
> help you any further unless you do those specific
> >experiments. What results do you get?
> >
> >-Jeff
> >
> >> I've been doing some research on the board and found
> out this in Rulph Chassaing book: "The maximum allowable
> input
> >> signal level at the LINE IN inputs to the codec is
> >> 1 V rms. However, the C6713 and C6416 DSKs contain a
> potential divider circuit with a gain of 0.5
between
> their LINE
> >> IN sockets and the codec itself with the effect
> >> that the maximum allowable input signal level at the
> LINE IN sockets on the DSKs is 2 V rms. Above this
> level, input
> >> signals will be distorted. Input and output sockets
> >> on the DSKs are ac coupled to the codec."Â
> >>
> >> I used this code from the book:Â
> >>
> >> //loop_poll.c loop program using polling
> >> #include "DSK6416_AIC23.h" //codec support
> >> Uint32 fs=DSK6416_AIC23_FREQ_8KHZ; //set sampling
> rate
> >>
> >> void main()
> >> {
> >> short sample_data;
> >> comm_poll(); //init DSK, codec, McBSP
> >> while(1) //infinite loop
> >> {
> >> sample_data = input_left_sample(); //input sample
> >> output_left_sample(sample_data); //output sample
> >> }
> >> }
> >>
> >> From the book again: "Input a sinusoidal waveform to
> the LINE IN connector on the DSK, with an
amplitude of
> >> approximately 2.0 V p - p and a frequency of
> approximately 1 kHz. Connect
> >> the output of the DSK, LINE OUT, to an oscilloscope,
> and verify the presence of a tone of the same
> frequency, but
> >> attenuated to approximately 1.0 V p - p. This
> attenuation
> >> is due to the potential divider network, comprising
> two resistors, on the DSKÂ circuit board between the
LINE
> IN
> >> socket and the codec input."
> >>
> >> Done that but with different results, at LINE OUT the
> signal had same frequency and amplitude of 0.4Vp-p. The
> AIC23
> >> codec had this values in registers:Â
> >>
> >> DSK6416_AIC23_Config config = {Â
> >> 0x0017, /* Set-Up Reg 0 Left line in volume control
> */
> >> 0x0017, /* Set-Up Reg 1 Right line in volume control
> */Â
> >> 0x01f9, /* Set-Up Reg 2 Left channel headphone volume
> */Â
> >> 0x01f9, /* Set-Up Reg 3 Right channel headphone
> volume */Â
> >> 0x0011, /* Set-Up Reg 4 Analog audio path control
> */Â
> >> 0x0000, /* Set-Up Reg 5 Digital audio path control
> */Â
> >> 0x0000, /* Set-Up Reg 6 Power down control */Â
> >> 0x0043, /* Set-Up Reg 7 Digital audio interface
> format */Â
> >> 0x0081, /* Set-Up Reg 8 Sample rate control */Â
> >> 0x0001 /* Set-Up Reg 9 Digital interface activation
> */Â
> >> };
> >>
> >> After this i tested the board for different
> amplitudes and got this results:
> >>
> >> input =1.5Vp-poutput=0.3Vp-p
> >> input=2Vp-poutput=0.4Vp-p
> >> input=3Vp-poutput=0.6Vp-p
> >> input=4Vp-poutput=0.76Vp-p  Â
> >> input=5Vp-poutput=1Vp-p
> >>
> >>
> >> Looks like the output=0.2*input. How is it possible
> ?????
> >>
> >>
> >> ________________________________
> >> From: Jeff Brower
> >> To: c...
> >> Cc: Adi Aditza
> >> Sent: Friday, May 13, 2011 11:43 PM
> >> Subject: Re: [c6x] DSP 6416
> >>
> >>
> >> Â
> >> Adi-
> >>
> >>> Let me start again with the problem.
> >>>
> >>> Here is the code im using:Â
> >>>
> >>> #include "dsk6416_aic23.h" //codec-DSK support
> file
> >>> Uint32 fs=DSK6416_AIC23_FREQ_48KHZ; //set
> sampling rate
> >>> interrupt void c_int11() //interrupt service
> routine
> >>> {
> >>> short sample_data;
> >>> sample_data = input_sample(); //input data
> >>> output_sample(sample_data); //output data
> >>> return;
> >>> }
> >>> void main()
> >>> {
> >>> comm_intr(); //init DSK, codec, McBSP
> >>> while(1); //infinite loop
> >>> }
> >>>
> >>> I generate a signal with 2Vp-p amplitude and 1kHz
> frequency
> >>> with a signal generator and connect it to Line
> IN. After i
> >>> run the code, the signal from Line OUT shown on
> oscilloscope
> >>> is  a sine wave with 0.8Vp-p and 1kHz. If i vary
> the
> >>> frequency and amplitude at input, it varies at
> output
> >>> (frequency at output is the same as input only
> the amplitude
> >>> is attentuated at output).Â
> >>>
> >>> The cables im working with are coaxial with BNC
> plug at one
> >>> end and audio jack (3.5mm) at the other end, and
> another
> >>> coaxial has BNC plugs at both ends.Â
> >>> The signal generator and oscilloscope are
> connected to
> >>> 230VAC.
> >>>
> >>> The board im using is TMS320C6416T. If you need
> the other
> >>> files im using let me know. They
> >>>
> are: C6416dskinit.c, C6416dsk.cmd,
> Â Vectors_intr.asm,
> >>> c6416dskinit.h, dsk6416_aic23.h.
> >>
> >> It could be the DSK board has different gain settings
> for input vs. output. In your first post you mentioned
> some
> >> register values -- what are those? AIC23 registers?
> If so which ones? Do you have input and output gain (or
> >> attenuation) set as matching?
> >>
> >> Also, try doing the following in your ISR:
> >>
> >> static unsigned short int i = 0;
> >> static short int posmax =0;
> >> static short int negmax = 0;
> >>
> >> sample_data = input_sample(); //input data
> >> if (sample_data > posmax) posmax = sample_data;
> >> if (sample_data < negmax) negmax = sample_data;
> >> sample_data = (short int)i++;
> >> output_sample(sample_data); //output data
> >>
> >> This will cause output ranging from 0 to 65535; i.e.
> maximum possible range. What's the max Vpp you see on
the
> scope?
> >> If your max scope Vpp is still 0.8, then clearly
> something in hardware is restricting your output
> amplitude level.
> >>
> >> And you can look at posmax and negmax values after
> you pause the code. First they should be symmetric, if
> not then
> >> you don't have the signal generator hooked up
> correctly. Second from what I recall with the DSK boards
> and AIC23
> >> codecs, you should be able to give +/- 2V input to
> the boards, maybe a bit higher. So in your case posmax
> should be
> >> around 15,000.
> >>
> >> -Jeff
> >>
> >>> ________________________________
> >>> From: Jeff Brower
> >>> To: Adi Aditza
> >>> Cc: c...
> >>> Sent: Thursday, May 12, 2011 10:40 PM
> >>> Subject: Re: [c6x] DSP 6416
> >>>
> >>> Adi-
> >>>
> >>>> I connected the signal from signal generator
> to the
> >>>> oscilloscope and its a sine wave with 2Vp-p
> amplitude.
> >>>
> >>> Is that not what you expect? Can you vary the
> level using the amplitude control on the signal generator?
> >>>
> >>>> generator has 2 output impedances (50ohm and
> 600ohm)
> >>>> and the result its the same.
> >>>
> >>> Scope inputs are high impedance, so it won't
> matter what is the signal generator output impedance --
> both selections
> >>> should look the same.
> >>>
> >>>> I have a DSP 6416T and i'm using it for
> calculating
> >>>> the effective value of a sine wave.
> >>>
> >>> Can you clarify your setup? If the signal
> generator is producing the sine wave and the scope is
> measuring it, then
> >>> what is the DSP doing? And what type of board
> do you have? DSK 6416? Something
else?
> >>>
> >>> -Jeff
> >>>
> >>>> ________________________________
> >>>> From: mikedunn
> >>>> To: Ceausu Adrian
> >>>> Cc: c...
> >>>> Sent: Thursday, May 12, 2011 7:42 PM
> >>>> Subject: Re: [c6x] DSP 6416
> >>>>
> >>>>
> >>>> Ceausu Adrian,
> >>>>
> >>>> On 5/12/2011 8:20 AM, Ceausu Adrian wrote:
> >>>> ÂÂ
> >>>>>Hello,
> >>>>>
> >>>>>
> >>>>>I have a DSP 6416T and i'm using it for
> calculating the effective value of a sine wave.
> >>>>>I've made the default settings in
> registers, 0x0017 for input and 0x01f9 for output, and
> when i generate (with a
> >>>>> signal generator) a sine wave with 2Vp-p
> amplitude, on the oscilloscope its only
0.8Vp-p.ÂÂ
> >>>>>
> >>>>>
> >>>>>Does anyone knows why ?
> >>>>
> >>>> a. the impedance of the load is incorrect for
> the signal generator
> >>>> or
> >>>> b. the signal generator is broken or
> incorrectly set up
> >>>> or
> >>>> c. the scope or probe is broken, out of
> calibration, or incorrectly
> >>>>Â Â set up
> >>>>
> >>>>
> >>>> mikedunn
> >>>> Thank you.ÂÂ
> >
> >
> > ------- End of Original Message -------
_____________________________________
Reply by Richard Williams●May 19, 20112011-05-19
Adi,
Amongst other things, the input volume is set rather low and the output
volume
is set rather low.
So you could bump those values.
(and dont be sending more than the specified 2vPP to the input, otherwise the
chip(s) will soon be destroyed.)
R. Williams
---------- Original Message -----------
From: Adi aditza
To: Jeff Brower , "m...@gmail.com"
> Hi,
>
> I've been doing some research on the board and found out this in Rulph
> Chassaing book: "The maximum allowable input signal level at the LINE
> IN inputs to the codec is 1 V rms. However, the C6713 and C6416 DSKs
> contain a potential divider circuit with a gain of 0.5 between their
> LINE IN sockets and the codec itself with the effect that the maximum
> allowable input signal level at the LINE IN sockets on the DSKs is 2
> V rms. Above this level, input signals will be distorted. Input and
> output sockets on the DSKs are ac coupled to the codec."
>
> I used this code from the book:
>
> //loop_poll.c loop program using polling
> #include "DSK6416_AIC23.h" //codec support
> Uint32 fs=DSK6416_AIC23_FREQ_8KHZ; //set sampling rate
>
> void main()
> {
> short sample_data;
> comm_poll(); //init DSK, codec, McBSP
> while(1) //infinite loop
> {
> sample_data = input_left_sample(); //input sample
> output_left_sample(sample_data); //output sample
> }
> }
>
> >From the book again: "Input a sinusoidal waveform to the LINE IN connector
on the DSK, with an amplitude of approximately 2.0 V p - p and a
frequency of
approximately 1 kHz. Connect > the output of the DSK, LINE OUT, to an oscilloscope,
and verify the
> presence of a tone of the same frequency, but attenuated to
> approximately 1.0 V p - p. This attenuation is due to the potential
> divider network, comprising two resistors, on the DSK circuit board
> between the LINE IN socket and the codec input."
>
> Done that but with different results, at LINE OUT the signal had same
> frequency and amplitude of 0.4Vp-p. The AIC23 codec had this values in
> registers:
>
> DSK6416_AIC23_Config config = {
> 0x0017, /* Set-Up Reg 0 Left line in volume control */
> 0x0017, /* Set-Up Reg 1 Right line in volume control */
> 0x01f9, /* Set-Up Reg 2 Left channel headphone volume */
> 0x01f9, /* Set-Up Reg 3 Right channel headphone volume */
> 0x0011, /* Set-Up Reg 4 Analog audio path control */
> 0x0000, /* Set-Up Reg 5 Digital audio path control */
> 0x0000, /* Set-Up Reg 6 Power down control */
> 0x0043, /* Set-Up Reg 7 Digital audio interface format */
> 0x0081, /* Set-Up Reg 8 Sample rate control */
> 0x0001 /* Set-Up Reg 9 Digital interface activation */
> };
>
> After this i tested the board for different amplitudes and got this
results:
>
> input =1.5Vp-poutput=0.3Vp-p
> input=2Vp-poutput=0.4Vp-p
> input=3Vp-poutput=0.6Vp-p
> input=4Vp-poutput=0.76Vp-p
> input=5Vp-poutput=1Vp-p
>
> Looks like the output=0.2*input. How is it possible ?????
>
> ________________________________
> From: Jeff Brower
> To: c...
> Cc: Adi Aditza
> Sent: Friday, May 13, 2011 11:43 PM
> Subject: Re: [c6x] DSP 6416
>
>
> Adi-
>
> > Let me start again with the problem.
> >
> > Here is the code im using:
> >
> > #include "dsk6416_aic23.h" //codec-DSK support file
> > Uint32 fs=DSK6416_AIC23_FREQ_48KHZ; //set sampling rate
> > interrupt void c_int11() //interrupt service routine
> > {
> > short sample_data;
> > sample_data = input_sample(); //input data
> > output_sample(sample_data); //output data
> > return;
> > }
> > void main()
> > {
> > comm_intr(); //init DSK, codec, McBSP
> > while(1); //infinite loop
> > }
> >
> > I generate a signal with 2Vp-p amplitude and 1kHz frequency
> > with a signal generator and connect it to Line IN. After i
> > run the code, the signal from Line OUT shown on oscilloscope
> > is a sine wave with 0.8Vp-p and 1kHz. If i vary the
> > frequency and amplitude at input, it varies at output
> > (frequency at output is the same as input only the amplitude
> > is attentuated at output).
> >
> > The cables im working with are coaxial with BNC plug at one
> > end and audio jack (3.5mm) at the other end, and another
> > coaxial has BNC plugs at both ends.
> > The signal generator and oscilloscope are connected to
> > 230VAC.
> >
> > The board im using is TMS320C6416T. If you need the other
> > files im using let me know. They
> > are: C6416dskinit.c, C6416dsk.cmd, Vectors_intr.asm,
> > c6416dskinit.h, dsk6416_aic23.h.
>
> It could be the DSK board has different gain settings for input vs.
> output. In your first post you mentioned some register values -- what
> are those? AIC23 registers? If so which ones? Do you have input and
> output gain (or attenuation) set as matching?
>
> Also, try doing the following in your ISR:
>
> static unsigned short int i = 0;
> static short int posmax =0;
> static short int negmax = 0;
>
> sample_data = input_sample(); //input data
> if (sample_data > posmax) posmax = sample_data;
> if (sample_data < negmax) negmax = sample_data;
> sample_data = (short int)i++;
> output_sample(sample_data); //output data
>
> This will cause output ranging from 0 to 65535; i.e. maximum possible
> range. What's the max Vpp you see on the scope? If your max scope Vpp
> is still 0.8, then clearly something in hardware is restricting your
> output amplitude level.
>
> And you can look at posmax and negmax values after you pause the code.
> First they should be symmetric, if not then you don't have the signal
> generator hooked up correctly. Second from what I recall with the DSK
> boards and AIC23 codecs, you should be able to give +/- 2V input to
> the boards, maybe a bit higher. So in your case posmax should be
> around 15,000.
>
> -Jeff
>
> > ________________________________
> > From: Jeff Brower
> > To: Adi Aditza
> > Cc: c...
> > Sent: Thursday, May 12, 2011 10:40 PM
> > Subject: Re: [c6x] DSP 6416
> >
> > Adi-
> >
> >> I connected the signal from signal generator to the
> >> oscilloscope and its a sine wave with 2Vp-p amplitude.
> >
> > Is that not what you expect? Can you vary the level using the
amplitude control on the signal generator? > >
> >> generator has 2 output impedances (50ohm and 600ohm)
> >> and the result its the same.
> >
> > Scope inputs are high impedance, so it won't matter what is the
signal generator output impedance -- both selections > > should look the same.
> >
> >> I have a DSP 6416T and i'm using it for calculating
> >> the effective value of a sine wave.
> >
> > Can you clarify your setup? If the signal generator is producing the
sine wave and the scope is measuring it, then > > what is the DSP doing? And what type of board
do you have? DSK 6416? Something else? > >
> > -Jeff
> >
> >> ________________________________
> >> From: mikedunn
> >> To: Ceausu Adrian
> >> Cc: c...
> >> Sent: Thursday, May 12, 2011 7:42 PM
> >> Subject: Re: [c6x] DSP 6416
> >>
> >>
> >> Ceausu Adrian,
> >>
> >> On 5/12/2011 8:20 AM, Ceausu Adrian wrote:
> >> Â
> >>>Hello,
> >>>
> >>>
> >>>I have a DSP 6416T and i'm using it for calculating the effective
value of a sine wave. > >>>I've made the default settings in registers,
0x0017 for input and 0x01f9 for output, and when i generate (with a > >>> signal generator) a sine wave with 2Vp-p
amplitude, on the oscilloscope its only 0.8Vp-p. > >>>
> >>>
> >>>Does anyone knows why ?
> >>
> >> a. the impedance of the load is incorrect for the signal generator
> >> or
> >> b. the signal generator is broken or incorrectly set up
> >> or
> >> c. the scope or probe is broken, out of calibration, or incorrectly
> >> set up
> >>
> >>
> >> mikedunn
> >> Thank you.Â
> >>> ------- End of Original Message -------
Adi,
_____________________________________
Reply by Jeff Brower●May 19, 20112011-05-19
Adi-
> I've run the code you posted and i've got
nothing on the
> scope
Please clarify "nothing" -- you mean you have a flat line? What is your scope
timebase (time per division)? What is
your AIC23 sampling rate? In your posts so far, I've seen two sampling
rates mentioned: 8 and 48 kHz. The test code
I gave you generates a sawtooth waveform -- if you use 8 kHz and you increment
your output by 1 each sample then it
will a little more than 8 sec to see one period of the sawtooth. If you use 48
kHz then it will take somewhat less
than 1 sec. If you adjust the increment value you can make the period faster.
For example you can set your timebase
for 1 msec per div and then adjust N in your ISR code until you see
something:
static unsigned short int i = 0;
sample_data = (short int)i;
i += N; /* increase N until scope shows a sawtooth waveform */
output_sample(sample_data); //output data
> but i could save the values of posmax and negmax in
a
> file.
>
> Here are some values (first column is posmax, second is negmax) and they are
pretty strange:
>
> 0 0
> 9293 0
> 9693 0
> 9748 0
> 9748 0
> -5049 0
> -888 0
> 9096 0
> -6205 0
> -1230 0
> -3100 0
> -4948 0
> -6869 0
> -8043 0
> -8955 0
> -9512 0
> -9764 0
> -9709 0
> -9254 0
> -8457 0
> -6787 0
> -5300 0
> -3552 0
> -8088 0
> -6873 0
> 1882 0
> 9198 0
> 9198 0
> 9198 0
> 9198 0
> 9202 0
> 9677 0
> 9677 0
> 9677 0
> 9677 0
> 9677 0
> -9787 0
> 9669 0
> 9669 0
> 9669 0
> 9669 0
>
> Let me know you're opinion on this thing.
My opinion is you that either you didn't write out the correct values or
you didn't use my code correctly. First, why
do you need to print out so many values? The idea of keeping max values is that
you only need to check two values
after letting the code run for a while (positive and negative max) -- the point
being to measure your maximum
peak-to-peak input levels. Second, why is negmax always zero? You don't
have any negative codec input values? I
doubt that.
-Jeff
> ________________________________
> From: mikedunn
> To: Adi Aditza
> Cc: c...
> Sent: Thursday, May 19, 2011 12:39 AM
> Subject: Re: [c6x] DSP 6416
> Adi,
>
> Slow down and think. You have characterized your problem - that is
> good.
> BTW, I am not familiar with the analog circuitry but I would never
> apply more than 2v to line in.
>
> Now that your problem is characterized, you know that you have two
> "boxes" [input & output] that could be "broken". Like Jeff has
> advised, you need to verify the correct or incorrect behavior of the
> "boxes".
>
> Some ideas to for troubleshooting...
> 1. Follow Jeff's suggestions.
> 2. You could also hack your code to output a value, delay, output a
> second value, delay in an infinite loop to create a square wave.
> Check measured values vs. expected values.
> 3. One disadvantage in your setup is that it is unbuffered. You may
> want to consider capturing enough input samples for a couple of
> cycles and analyzing the values.
>
> As for "how is it possible?" - the answer is usually very clear
> after methodical troubleshooting.
>
> mikedunn
>
> On 5/18/2011 1:22 PM, Jeff Brower wrote:
>
>>Adi-
>>
>>You're worried about too many things -- it takes too much
> time to read your post and try to follow along.
>>
>>The art of debug requires you to simplify and divide the
> problem, and check basic things one at a time. Start by
>>separating input from output and checking your output
> levels, by generating output signals in software.
>>
>>I explained how to do this in my previous post. I can't
> help you any further unless you do those specific
>>experiments. What results do you get?
>>
>>-Jeff
>>
>>> I've been doing some research on the board and found
> out this in Rulph Chassaing book: "The maximum allowable
> input
>>> signal level at the LINE IN inputs to the codec is
>>> 1 V rms. However, the C6713 and C6416 DSKs contain a
> potential divider circuit with a gain of 0.5
between
> their LINE
>>> IN sockets and the codec itself with the effect
>>> that the maximum allowable input signal level at the
> LINE IN sockets on the DSKs is 2 V rms. Above this
level,
> input
>>> signals will be distorted. Input and output sockets
>>> on the DSKs are ac coupled to the codec."Â
>>>
>>> I used this code from the book:Â
>>>
>>> //loop_poll.c loop program using polling
>>> #include "DSK6416_AIC23.h" //codec support
>>> Uint32 fs=DSK6416_AIC23_FREQ_8KHZ; //set sampling
> rate
>>>
>>> void main()
>>> {
>>> short sample_data;
>>> comm_poll(); //init DSK, codec, McBSP
>>> while(1) //infinite loop
>>> {
>>> sample_data = input_left_sample(); //input sample
>>> output_left_sample(sample_data); //output sample
>>> }
>>> }
>>>
>>> From the book again: "Input a sinusoidal waveform to
> the LINE IN connector on the DSK, with an
amplitude of
>>> approximately 2.0 V p - p and a frequency of
> approximately 1 kHz. Connect
>>> the output of the DSK, LINE OUT, to an oscilloscope,
> and verify the presence of a tone of the same
frequency,
> but
>>> attenuated to approximately 1.0 V p - p. This
> attenuation
>>> is due to the potential divider network, comprising
> two resistors, on the DSKÂ circuit board between the
LINE
> IN
>>> socket and the codec input."
>>>
>>> Done that but with different results, at LINE OUT the
> signal had same frequency and amplitude of 0.4Vp-p. The
> AIC23
>>> codec had this values in registers:Â
>>>
>>> DSK6416_AIC23_Config config = {Â
>>> 0x0017, /* Set-Up Reg 0 Left line in volume control
> */
>>> 0x0017, /* Set-Up Reg 1 Right line in volume control
> */Â
>>> 0x01f9, /* Set-Up Reg 2 Left channel headphone volume
> */Â
>>> 0x01f9, /* Set-Up Reg 3 Right channel headphone
> volume */Â
>>> 0x0011, /* Set-Up Reg 4 Analog audio path control
> */Â
>>> 0x0000, /* Set-Up Reg 5 Digital audio path control
> */Â
>>> 0x0000, /* Set-Up Reg 6 Power down control */Â
>>> 0x0043, /* Set-Up Reg 7 Digital audio interface
> format */Â
>>> 0x0081, /* Set-Up Reg 8 Sample rate control */Â
>>> 0x0001 /* Set-Up Reg 9 Digital interface activation
> */Â
>>> };
>>>
>>> After this i tested the board for different
> amplitudes and got this results:
>>>
>>> input =1.5Vp-poutput=0.3Vp-p
>>> input=2Vp-poutput=0.4Vp-p
>>> input=3Vp-poutput=0.6Vp-p
>>> input=4Vp-poutput=0.76Vp-p  Â
>>> input=5Vp-poutput=1Vp-p
>>>
>>>
>>> Looks like the output=0.2*input. How is it possible
> ?????
>>>
>>>
>>> ________________________________
>>> From: Jeff Brower
>>> To: c...
>>> Cc: Adi Aditza
>>> Sent: Friday, May 13, 2011 11:43 PM
>>> Subject: Re: [c6x] DSP 6416
>>>
>>>
>>> Â
>>> Adi-
>>>
>>>> Let me start again with the problem.
>>>>
>>>> Here is the code im using:Â
>>>>
>>>> #include "dsk6416_aic23.h" //codec-DSK support
> file
>>>> Uint32 fs=DSK6416_AIC23_FREQ_48KHZ; //set
> sampling rate
>>>> interrupt void c_int11() //interrupt service
> routine
>>>> {
>>>> short sample_data;
>>>> sample_data = input_sample(); //input data
>>>> output_sample(sample_data); //output data
>>>> return;
>>>> }
>>>> void main()
>>>> {
>>>> comm_intr(); //init DSK, codec, McBSP
>>>> while(1); //infinite loop
>>>> }
>>>>
>>>> I generate a signal with 2Vp-p amplitude and 1kHz
> frequency
>>>> with a signal generator and connect it to Line
> IN. After i
>>>> run the code, the signal from Line OUT shown on
> oscilloscope
>>>> is  a sine wave with 0.8Vp-p and 1kHz. If i vary
> the
>>>> frequency and amplitude at input, it varies at
> output
>>>> (frequency at output is the same as input only
> the amplitude
>>>> is attentuated at output).Â
>>>>
>>>> The cables im working with are coaxial with BNC
> plug at one
>>>> end and audio jack (3.5mm) at the other end, and
> another
>>>> coaxial has BNC plugs at both ends.Â
>>>> The signal generator and oscilloscope are
> connected to
>>>> 230VAC.
>>>>
>>>> The board im using is TMS320C6416T. If you need
> the other
>>>> files im using let me know. They
>>>>
>
are: C6416dskinit.c, C6416dsk.cmd, Vectors_intr.asm,
>>>> c6416dskinit.h, dsk6416_aic23.h.
>>>
>>> It could be the DSK board has different gain settings
> for input vs. output. In your first post you mentioned
> some
>>> register values -- what are those? AIC23 registers?
> If so which ones? Do you have input and output gain (or
>>> attenuation) set as matching?
>>>
>>> Also, try doing the following in your ISR:
>>>
>>> static unsigned short int i = 0;
>>> static short int posmax =0;
>>> static short int negmax = 0;
>>>
>>> sample_data = input_sample(); //input data
>>> if (sample_data > posmax) posmax = sample_data;
>>> if (sample_data < negmax) negmax = sample_data;
>>> sample_data = (short int)i++;
>>> output_sample(sample_data); //output data
>>>
>>> This will cause output ranging from 0 to 65535; i.e.
> maximum possible range. What's the max Vpp you see on
the
> scope?
>>> If your max scope Vpp is still 0.8, then clearly
> something in hardware is restricting your output amplitude
> level.
>>>
>>> And you can look at posmax and negmax values after
> you pause the code. First they should be symmetric, if not
> then
>>> you don't have the signal generator hooked up
> correctly. Second from what I recall with the DSK boards
> and AIC23
>>> codecs, you should be able to give +/- 2V input to
> the boards, maybe a bit higher. So in your case posmax
> should be
>>> around 15,000.
>>>
>>> -Jeff
>>>
>>>> ________________________________
>>>> From: Jeff Brower
>>>> To: Adi Aditza
>>>> Cc: c...
>>>> Sent: Thursday, May 12, 2011 10:40 PM
>>>> Subject: Re: [c6x] DSP 6416
>>>>
>>>> Adi-
>>>>
>>>>> I connected the signal from signal generator
> to the
>>>>> oscilloscope and its a sine wave with 2Vp-p
> amplitude.
>>>>
>>>> Is that not what you expect? Can you vary the
> level using the amplitude control on the signal generator?
>>>>
>>>>> generator has 2 output impedances (50ohm and
> 600ohm)
>>>>> and the result its the same.
>>>>
>>>> Scope inputs are high impedance, so it won't
> matter what is the signal generator output impedance --
> both selections
>>>> should look the same.
>>>>
>>>>> I have a DSP 6416T and i'm using it for
> calculating
>>>>> the effective value of a sine wave.
>>>>
>>>> Can you clarify your setup? If the signal
> generator is producing the sine wave and the scope is
> measuring it, then
>>>> what is the DSP doing? And what type of board
> do you have? DSK 6416? Something
else?
>>>>
>>>> -Jeff
>>>>
>>>>> ________________________________
>>>>> From: mikedunn
>>>>> To: Ceausu Adrian
>>>>> Cc: c...
>>>>> Sent: Thursday, May 12, 2011 7:42 PM
>>>>> Subject: Re: [c6x] DSP 6416
>>>>>
>>>>>
>>>>> Ceausu Adrian,
>>>>>
>>>>> On 5/12/2011 8:20 AM, Ceausu Adrian wrote:
>>>>> ÂÂ
>>>>>>Hello,
>>>>>>
>>>>>>
>>>>>>I have a DSP 6416T and i'm using it for
> calculating the effective value of a sine wave.
>>>>>>I've made the default settings in
> registers, 0x0017 for input and 0x01f9 for output, and
> when i generate (with a
>>>>>> signal generator) a sine wave with 2Vp-p
> amplitude, on the oscilloscope its only
0.8Vp-p.ÂÂ
>>>>>>
>>>>>>
>>>>>>Does anyone knows why ?
>>>>>
>>>>> a. the impedance of the load is incorrect for
> the signal generator
>>>>> or
>>>>> b. the signal generator is broken or
> incorrectly set up
>>>>> or
>>>>> c. the scope or probe is broken, out of
> calibration, or incorrectly
>>>>>Â Â set up
>>>>>
>>>>>
>>>>> mikedunn
>>>>> Thank you.ÂÂ
_____________________________________
Reply by Adi aditza●May 19, 20112011-05-19
Hi,
I've been doing some research on the board and found out this in Rulph
Chassaing book: "The maximum allowable input signal level at the LINE IN inputs
to the codec is
1 V rms. However, the C6713 and C6416 DSKs contain a potential divider
circuit with a gain of 0.5 between their LINE IN sockets and the codec
itself with the effect
that the maximum allowable input signal level at the LINE IN sockets on the
DSKs is 2 V rms. Above this level, input signals will be distorted. Input
and output sockets
on the DSKs are ac coupled to the codec."
I used this code from the book:
//loop_poll.c loop program using polling
#include "DSK6416_AIC23.h" //codec support
Uint32 fs=DSK6416_AIC23_FREQ_8KHZ; //set sampling rate
From the book again: "Input a sinusoidal waveform to the LINE IN connector on
the DSK, with an amplitude of approximately 2.0 V p - p and a frequency of
approximately 1 kHz. Connect
the output of the DSK, LINE OUT, to an oscilloscope, and verify the presence
of a tone of the same frequency, but attenuated to approximately 1.0 V p -
p. This attenuation
is due to the potential divider network, comprising two resistors, on the
DSK circuit board between the LINE IN socket and the codec input."
Done that but with different results, at LINE OUT the signal had same frequency
and amplitude of 0.4Vp-p. The AIC23 codec had this values in registers:
DSK6416_AIC23_Config config = {
0x0017, /* Set-Up Reg 0 Left line in volume control */
0x0017, /* Set-Up Reg 1 Right line in volume control */
0x01f9, /* Set-Up Reg 2 Left channel headphone volume */
0x01f9, /* Set-Up Reg 3 Right channel headphone volume */
0x0011, /* Set-Up Reg 4 Analog audio path control */
0x0000, /* Set-Up Reg 5 Digital audio path control */
0x0000, /* Set-Up Reg 6 Power down control */
0x0043, /* Set-Up Reg 7 Digital audio interface format */
0x0081, /* Set-Up Reg 8 Sample rate control */
0x0001 /* Set-Up Reg 9 Digital interface activation */
};
After this i tested the board for different amplitudes and got this results:
input =1.5Vp-poutput=0.3Vp-p
input=2Vp-poutput=0.4Vp-p
input=3Vp-poutput=0.6Vp-p
input=4Vp-poutput=0.76Vp-p
input=5Vp-poutput=1Vp-p
Looks like the output=0.2*input. How is it possible ?????
________________________________
From: Jeff Brower
To: c...
Cc: Adi Aditza
Sent: Friday, May 13, 2011 11:43 PM
Subject: Re: [c6x] DSP 6416
Adi-
> Let me start again with the problem.
>
> Here is the code im using:
>
> #include "dsk6416_aic23.h" //codec-DSK support file
> Uint32 fs=DSK6416_AIC23_FREQ_48KHZ; //set sampling rate
> interrupt void c_int11() //interrupt service routine
> {
> short sample_data;
> sample_data = input_sample(); //input data
> output_sample(sample_data); //output data
> return;
> }
> void main()
> {
> comm_intr(); //init DSK, codec, McBSP
> while(1); //infinite loop
> }
>
> I generate a signal with 2Vp-p amplitude and 1kHz frequency
> with a signal generator and connect it to Line IN. After i
> run the code, the signal from Line OUT shown on oscilloscope
> is a sine wave with 0.8Vp-p and 1kHz. If i vary the
> frequency and amplitude at input, it varies at output
> (frequency at output is the same as input only the amplitude
> is attentuated at output).
>
> The cables im working with are coaxial with BNC plug at one
> end and audio jack (3.5mm) at the other end, and another
> coaxial has BNC plugs at both ends.
> The signal generator and oscilloscope are connected to
> 230VAC.
>
> The board im using is TMS320C6416T. If you need the other
> files im using let me know. They
> are: C6416dskinit.c, C6416dsk.cmd, Vectors_intr.asm,
> c6416dskinit.h, dsk6416_aic23.h.
It could be the DSK board has different gain settings for input vs. output. In
your first post you mentioned some
register values -- what are those? AIC23 registers? If so which ones? Do you
have input and output gain (or
attenuation) set as matching?
Also, try doing the following in your ISR:
static unsigned short int i = 0;
static short int posmax =0;
static short int negmax = 0;
sample_data = input_sample(); //input data
if (sample_data > posmax) posmax = sample_data;
if (sample_data < negmax) negmax = sample_data;
sample_data = (short int)i++;
output_sample(sample_data); //output data
This will cause output ranging from 0 to 65535; i.e. maximum possible range.
What's the max Vpp you see on the scope?
If your max scope Vpp is still 0.8, then clearly something in hardware is
restricting your output amplitude level.
And you can look at posmax and negmax values after you pause the code. First
they should be symmetric, if not then
you don't have the signal generator hooked up correctly. Second from what
I recall with the DSK boards and AIC23
codecs, you should be able to give +/- 2V input to the boards, maybe a bit
higher. So in your case posmax should be
around 15,000.
-Jeff
> ________________________________
> From: Jeff Brower
> To: Adi Aditza
> Cc: c...
> Sent: Thursday, May 12, 2011 10:40 PM
> Subject: Re: [c6x] DSP 6416
>
> Adi-
>
>> I connected the signal from signal generator to the
>> oscilloscope and its a sine wave with 2Vp-p amplitude.
>
> Is that not what you expect? Can you vary the level using the amplitude
control on the signal generator?
>
>> generator has 2 output impedances (50ohm and 600ohm)
>> and the result its the same.
>
> Scope inputs are high impedance, so it won't matter what is the signal
generator output impedance -- both selections
> should look the same.
>
>> I have a DSP 6416T and i'm using it for calculating
>> the effective value of a sine wave.
>
> Can you clarify your setup? If the signal generator is producing the
sine wave and the scope is measuring it, then
> what is the DSP doing? And what type of board do you have? DSK
6416? Something else?
>
> -Jeff
>
>> ________________________________
>> From: mikedunn
>> To: Ceausu Adrian
>> Cc: c...
>> Sent: Thursday, May 12, 2011 7:42 PM
>> Subject: Re: [c6x] DSP 6416
>> Ceausu Adrian,
>>
>> On 5/12/2011 8:20 AM, Ceausu Adrian wrote:
>> Â
>>>Hello,
>>>
>>>
>>>I have a DSP 6416T and i'm using it for calculating the effective value
of a sine wave.
>>>I've made the default settings in registers, 0x0017 for input and 0x01f9
for output, and when i generate (with a
>>> signal generator) a sine wave with 2Vp-p amplitude, on the oscilloscope its
only 0.8Vp-p.Â
>>>
>>>
>>>Does anyone knows why ?
>>
>> a. the impedance of the load is incorrect for the signal generator
>> or
>> b. the signal generator is broken or incorrectly set up
>> or
>> c. the scope or probe is broken, out of calibration, or incorrectly
>> set up
>> mikedunn
>> Thank you.Â
>>>
Reply by Adi aditza●May 19, 20112011-05-19
Jeff,
I've run the code you posted and i've got nothing on the scope but i
could save the values of posmax and negmax in a file.
Here are some values (first column is posmax, second is negmax) and they are
pretty strange:
Let me know you're opinion on this thing.
________________________________
From: mikedunn
To: Adi Aditza
Cc: c...
Sent: Thursday, May 19, 2011 12:39 AM
Subject: Re: [c6x] DSP 6416
Adi,
Slow down and think. You have characterized your problem - that is
good.
BTW, I am not familiar with the analog circuitry but I would never
apply more than 2v to line in.
Now that your problem is characterized, you know that you have two
"boxes" [input & output] that could be "broken". Like Jeff has
advised, you need to verify the correct or incorrect behavior of the
"boxes".
Some ideas to for troubleshooting...
1. Follow Jeff's suggestions.
2. You could also hack your code to output a value, delay, output a
second value, delay in an infinite loop to create a square wave.
Check measured values vs. expected values.
3. One disadvantage in your setup is that it is unbuffered. You may
want to consider capturing enough input samples for a couple of
cycles and analyzing the values.
As for "how is it possible?" - the answer is usually very clear
after methodical troubleshooting.
mikedunn
On 5/18/2011 1:22 PM, Jeff Brower wrote:
>Adi-
>
>You're worried about too many things -- it takes too much time to read your post and try to follow along. >
>The art of debug requires you to simplify and divide the problem, and check basic things one at a time. Start by >separating input from output and checking your
output levels, by generating output signals in software. >
>I explained how to do this in my previous post. I can't help you any further unless you do those specific >experiments. What results do you get?
>
>-Jeff
>
>> I've been doing some research on the board and found out this in Rulph Chassaing book: "The maximum allowable
input >> signal level at the LINE IN inputs to the codec
is
>> 1 V rms. However, the C6713 and C6416 DSKs contain a potential divider circuit with a gain of 0.5
between
their LINE >> IN sockets and the codec itself with the effect
>> that the maximum allowable input signal level at the LINE IN sockets on the DSKs is 2 V rms. Above
this level,
input >> signals will be distorted. Input and output
sockets
>> on the DSKs are ac coupled to the codec."Â
>>
>> I used this code from the book:Â
>>
>> //loop_poll.c loop program using polling
>> #include "DSK6416_AIC23.h" //codec support
>> Uint32 fs=DSK6416_AIC23_FREQ_8KHZ; //set sampling rate >>
>> void main()
>> {
>> short sample_data;
>> comm_poll(); //init DSK, codec, McBSP
>> while(1) //infinite loop
>> {
>> sample_data = input_left_sample(); //input sample
>> output_left_sample(sample_data); //output sample
>> }
>> }
>>
>> From the book again: "Input a sinusoidal waveform to the LINE IN connector on the DSK, with an
amplitude of >> approximately 2.0 V p - p and a frequency of approximately 1 kHz. Connect >> the output of the DSK, LINE OUT, to an
oscilloscope, and verify the presence of a tone of the same
frequency,
but >> attenuated to approximately 1.0 V p - p. This attenuation >> is due to the potential divider network,
comprising two resistors, on the DSKÂ circuit board between
the LINE
IN >> socket and the codec input."
>>
>> Done that but with different results, at LINE OUT the signal had same frequency and amplitude of 0.4Vp-p. The
AIC23 >> codec had this values in registers:Â
>>
>> DSK6416_AIC23_Config config = {Â
>> 0x0017, /* Set-Up Reg 0 Left line in volume control */ >> 0x0017, /* Set-Up Reg 1 Right line in volume
control */Â >> 0x01f9, /* Set-Up Reg 2 Left channel headphone
volume */Â >> 0x01f9, /* Set-Up Reg 3 Right channel headphone volume */Â >> 0x0011, /* Set-Up Reg 4 Analog audio path control */Â >> 0x0000, /* Set-Up Reg 5 Digital audio path
control */Â >> 0x0000, /* Set-Up Reg 6 Power down control
*/Â
>> 0x0043, /* Set-Up Reg 7 Digital audio interface format */Â >> 0x0081, /* Set-Up Reg 8 Sample rate control
*/Â
>> 0x0001 /* Set-Up Reg 9 Digital interface activation */Â >> };
>>
>> After this i tested the board for different amplitudes and got this results: >>
>> input =1.5Vp-poutput=0.3Vp-p
>> input=2Vp-poutput=0.4Vp-p
>> input=3Vp-poutput=0.6Vp-p
>> input=4Vp-poutput=0.76Vp-p  Â
>> input=5Vp-poutput=1Vp-p
>> Looks like the output=0.2*input. How is it possible ????? >> ________________________________
>> From: Jeff Brower
>> To: c...
>> Cc: Adi Aditza
>> Sent: Friday, May 13, 2011 11:43 PM
>> Subject: Re: [c6x] DSP 6416
>> Â
>> Adi-
>>
>>> Let me start again with the problem.
>>>
>>> Here is the code im using:Â
>>>
>>> #include "dsk6416_aic23.h" //codec-DSK support file >>> Uint32 fs=DSK6416_AIC23_FREQ_48KHZ; //set sampling rate >>> interrupt void c_int11() //interrupt service routine >>> {
>>> short sample_data;
>>> sample_data = input_sample(); //input data
>>> output_sample(sample_data); //output data
>>> return;
>>> }
>>> void main()
>>> {
>>> comm_intr(); //init DSK, codec, McBSP
>>> while(1); //infinite loop
>>> }
>>>
>>> I generate a signal with 2Vp-p amplitude and 1kHz frequency >>> with a signal generator and connect it to Line IN. After i >>> run the code, the signal from Line OUT shown on oscilloscope >>> is  a sine wave with 0.8Vp-p and 1kHz.
If i vary the >>> frequency and amplitude at input, it varies at output >>> (frequency at output is the same as input only the amplitude >>> is attentuated at output).Â
>>>
>>> The cables im working with are coaxial with BNC plug at one >>> end and audio jack (3.5mm) at the other end, and another >>> coaxial has BNC plugs at both ends.Â
>>> The signal generator and oscilloscope are connected to >>> 230VAC.
>>>
>>> The board im using is TMS320C6416T. If you need the other >>> files im using let me know. They
>>>
are: C6416dskinit.c, C6416dsk.cmd, Vectors_intr.asm, >>> c6416dskinit.h, dsk6416_aic23.h.
>>
>> It could be the DSK board has different gain settings for input vs. output. In your first post you mentioned
some >> register values -- what are those? AIC23
registers? If so which ones? Do you have input and output gain (or >> attenuation) set as matching?
>>
>> Also, try doing the following in your ISR:
>>
>> static unsigned short int i = 0;
>> static short int posmax =0;
>> static short int negmax = 0;
>>
>> sample_data = input_sample(); //input data
>> if (sample_data > posmax) posmax = sample_data;
>> if (sample_data < negmax) negmax = sample_data;
>> sample_data = (short int)i++;
>> output_sample(sample_data); //output data
>>
>> This will cause output ranging from 0 to 65535; i.e. maximum possible range. What's the max Vpp you see on
the
scope? >> If your max scope Vpp is still 0.8, then clearly something in hardware is restricting your output
amplitude
level. >>
>> And you can look at posmax and negmax values after you pause the code. First they should be symmetric, if
not
then >> you don't have the signal generator hooked
up correctly. Second from what I recall with the DSK boards
and AIC23 >> codecs, you should be able to give +/- 2V input
to the boards, maybe a bit higher. So in your case posmax
should be >> around 15,000.
>>
>> -Jeff
>>
>>> ________________________________
>>> From: Jeff Brower
>>> To: Adi Aditza
>>> Cc: c...
>>> Sent: Thursday, May 12, 2011 10:40 PM
>>> Subject: Re: [c6x] DSP 6416
>>>
>>> Adi-
>>>
>>>> I connected the signal from signal generator to the >>>> oscilloscope and its a sine wave with 2Vp-p amplitude. >>>
>>> Is that not what you expect? Can you vary the level using the amplitude control on the signal
generator? >>>
>>>> generator has 2 output impedances (50ohm and 600ohm) >>>> and the result its the same.
>>>
>>> Scope inputs are high impedance, so it won't matter what is the signal generator output impedance --
both selections >>> should look the same.
>>>
>>>> I have a DSP 6416T and i'm using it for calculating >>>> the effective value of a sine wave.
>>>
>>> Can you clarify your setup? If the signal generator is producing the sine wave and the scope is
measuring it, then >>> what is the DSP doing? And what type
of board do you have? DSK 6416? Something
else? >>>
>>> -Jeff
>>>
>>>> ________________________________
>>>> From: mikedunn
>>>> To: Ceausu Adrian
>>>> Cc: c...
>>>> Sent: Thursday, May 12, 2011 7:42 PM
>>>> Subject: Re: [c6x] DSP 6416
>>>>
>>>>
>>>> Ceausu Adrian,
>>>>
>>>> On 5/12/2011 8:20 AM, Ceausu Adrian wrote:
>>>> ÂÂ
>>>>>Hello,
>>>>>
>>>>>
>>>>>I have a DSP 6416T and i'm using it for calculating the effective value of a sine wave. >>>>>I've made the default settings in registers, 0x0017 for input and 0x01f9 for output, and
when i generate (with a >>>>> signal generator) a sine wave with 2Vp-p amplitude, on the oscilloscope its only
0.8Vp-p. >>>>>
>>>>>
>>>>>Does anyone knows why ?
>>>>
>>>> a. the impedance of the load is incorrect for the signal generator >>>> or
>>>> b. the signal generator is broken or incorrectly set up >>>> or
>>>> c. the scope or probe is broken, out of calibration, or incorrectly >>>>Â Â set up
>>>>
>>>>
>>>> mikedunn
>>>> Thank you.ÂÂ
>
Reply by mikedunn●May 18, 20112011-05-18
Adi,
Slow down and think. You have characterized your problem - that is good.
BTW, I am not familiar with the analog circuitry but I would never apply
more than 2v to line in.
Now that your problem is characterized, you know that you have two
"boxes" [input & output] that could be "broken". Like Jeff has advised,
you need to verify the correct or incorrect behavior of the "boxes".
Some ideas to for troubleshooting...
1. Follow Jeff's suggestions.
2. You could also hack your code to output a value, delay, output a
second value, delay in an infinite loop to create a square wave.
Check measured values vs. expected values.
3. One disadvantage in your setup is that it is unbuffered. You may want
to consider capturing enough input samples for a couple of cycles and
analyzing the values.
As for "how is it possible?" - the answer is usually very clear after
methodical troubleshooting.
mikedunn
On 5/18/2011 1:22 PM, Jeff Brower wrote: >
> Adi-
>
> You're worried about too many things -- it takes too much time to read
> your post and try to follow along.
>
> The art of debug requires you to simplify and divide the problem, and
> check basic things one at a time. Start by
> separating input from output and checking your output levels, by
> generating output signals in software.
>
> I explained how to do this in my previous post. I can't help you any
> further unless you do those specific
> experiments. What results do you get?
>
> -Jeff
>
> > I've been doing some research on the board and found out this in
> Rulph Chassaing book: "The maximum allowable input
> > signal level at the LINE IN inputs to the codec is
> > 1 V rms. However, the C6713 and C6416 DSKs contain a potential
> divider circuitwith a gain of 0.5 between their LINE
> > IN sockets and the codec itself with the effect
> > that the maximum allowable input signal level at the LINE IN sockets
> on the DSKsis 2 V rms. Above this level, input
> > signals will be distorted. Input and output sockets
> > on the DSKs are ac coupled to the codec."br />
> >
> > I used this code from the book:br />
> >
> > //loop_poll.c loop program using polling
> > #include "DSK6416_AIC23.h" //codec support
> > Uint32 fs=DSK6416_AIC23_FREQ_8KHZ; //set sampling rate
> >
> > void main()
> > {
> > short sample_data;
> > comm_poll(); //init DSK, codec, McBSP
> > while(1) //infinite loop
> > {
> > sample_data = input_left_sample(); //input sample
> > output_left_sample(sample_data); //output sample
> > }
> > }
> >
> > From the book again: "Input a sinusoidal waveform to the LINE IN
> connector on the DSK, with an amplitudeof
> > approximately 2.0 V p - p and a frequency of approximately 1 kHz.
> Connect
> > the output of the DSK, LINE OUT, to an oscilloscope, and verify the
> presence ofa tone of the same frequency, but
> > attenuated to approximately 1.0 V p - p. This attenuation
> > is due to the potential divider network, comprising two resistors,
> on the DSKcircuit board between the LINE IN
> > socket and the codec input."
> >
> > Done that but with different results, at LINE OUT the signal had
> same frequency and amplitude of 0.4Vp-p. The AIC23
> > codec had this values in registers:br />
> >
> > DSK6416_AIC23_Config config = {br />
> > 0x0017, /* Set-Up Reg 0 Left line in volume control */
> > 0x0017, /* Set-Up Reg 1 Right line in volume control */br />
> > 0x01f9, /* Set-Up Reg 2 Left channel headphone volume */br />
> > 0x01f9, /* Set-Up Reg 3 Right channel headphone volume */br />
> > 0x0011, /* Set-Up Reg 4 Analog audio path control */br />
> > 0x0000, /* Set-Up Reg 5 Digital audio path control */br />
> > 0x0000, /* Set-Up Reg 6 Power down control */br />
> > 0x0043, /* Set-Up Reg 7 Digital audio interface format */br />
> > 0x0081, /* Set-Up Reg 8 Sample rate control */br />
> > 0x0001 /* Set-Up Reg 9 Digital interface activation */br />
> > };
> >
> > After this i tested the board for different amplitudes and got this
> results:
> >
> > input =1.5Vp-poutput=0.3Vp-p
> > input=2Vp-poutput=0.4Vp-p
> > input=3Vp-poutput=0.6Vp-p
> > input=4Vp-poutput=0.76Vp-p br />
> > input=5Vp-poutput=1Vp-p
> >
> >
> > Looks like the output=0.2*input. How is it possible ?????
> >
> >
> > ________________________________
> > From: Jeff Brower
> >
> > To: c...
> > Cc: Adi Aditza >
> > Sent: Friday, May 13, 2011 11:43 PM
> > Subject: Re: [c6x] DSP 6416
> >
> >
> > br />
> > Adi-
> >
> >> Let me start again with the problem.
> >>
> >> Here is the code im using:br />
> >>
> >> #include "dsk6416_aic23.h" //codec-DSK support file
> >> Uint32 fs=DSK6416_AIC23_FREQ_48KHZ; //set sampling rate
> >> interrupt void c_int11() //interrupt service routine
> >> {
> >> short sample_data;
> >> sample_data = input_sample(); //input data
> >> output_sample(sample_data); //output data
> >> return;
> >> }
> >> void main()
> >> {
> >> comm_intr(); //init DSK, codec, McBSP
> >> while(1); //infinite loop
> >> }
> >>
> >> I generate a signal with 2Vp-p amplitude and 1kHz frequency
> >> with a signal generator and connect it to Line IN. After i
> >> run the code, the signal from Line OUT shown on oscilloscope
> >> is a sine wave with 0.8Vp-p and 1kHz. If i vary the
> >> frequency and amplitude at input, it varies at output
> >> (frequency at output is the same as input only the amplitude
> >> is attentuated at output).br />
> >>
> >> The cables im working with are coaxial with BNC plug at one
> >> end and audio jack (3.5mm) at the other end, and another
> >> coaxial has BNC plugs at both ends.br />
> >> The signal generator and oscilloscope are connected to
> >> 230VAC.
> >>
> >> The board im using is TMS320C6416T. If you need the other
> >> files im using let me know. They
> >> are:C6416dskinit.c,C6416dsk.cmd,Vectors_intr.asm,
> >>c6416dskinit.h,dsk6416_aic23.h.
> >
> > It could be the DSK board has different gain settings for input vs.
> output. In your first post you mentioned some
> > register values -- what are those? AIC23 registers? If so which
> ones? Do you have input and output gain (or
> > attenuation) set as matching?
> >
> > Also, try doing the following in your ISR:
> >
> > static unsigned short int i = 0;
> > static short int posmax =0;
> > static short int negmax = 0;
> >
> > sample_data = input_sample(); //input data
> > if (sample_data > posmax) posmax = sample_data;
> > if (sample_data < negmax) negmax = sample_data;
> > sample_data = (short int)i++;
> > output_sample(sample_data); //output data
> >
> > This will cause output ranging from 0 to 65535; i.e. maximum
> possible range. What's the max Vpp you see on the scope?
> > If your max scope Vpp is still 0.8, then clearly something in
> hardware is restricting your output amplitude level.
> >
> > And you can look at posmax and negmax values after you pause the
> code. First they should be symmetric, if not then
> > you don't have the signal generator hooked up correctly. Second from
> what I recall with the DSK boards and AIC23
> > codecs, you should be able to give +/- 2V input to the boards, maybe
> a bit higher. So in your case posmax should be
> > around 15,000.
> >
> > -Jeff
> >
> >> ________________________________
> >> From: Jeff Brower
> >
> >> To: Adi Aditza >
> >> Cc: c...
> >> Sent: Thursday, May 12, 2011 10:40 PM
> >> Subject: Re: [c6x] DSP 6416
> >>
> >> Adi-
> >>
> >>> I connected the signal from signal generator to the
> >>> oscilloscope and its a sine wave with 2Vp-p amplitude.
> >>
> >> Is that not what you expect? Can you vary the level using the
> amplitude control on the signal generator?
> >>
> >>> generator has 2 output impedances (50ohm and 600ohm)
> >>> and the result its the same.
> >>
> >> Scope inputs are high impedance, so it won't matter what is the
> signal generator output impedance -- both selections
> >> should look the same.
> >>
> >>> I have a DSP 6416T and i'm using it for calculating
> >>> the effective value of a sine wave.
> >>
> >> Can you clarify your setup? If the signal generator is producing
> the sine wave and the scope is measuring it, then
> >> what is the DSP doing? And what type of board do you have? DSK
> 6416? Something else?
> >>
> >> -Jeff
> >>
> >>> ________________________________
> >>> From: mikedunn
> >
> >>> To: Ceausu Adrian >
> >>> Cc: c...
> >>> Sent: Thursday, May 12, 2011 7:42 PM
> >>> Subject: Re: [c6x] DSP 6416
> >>>
> >>>
> >>> Ceausu Adrian,
> >>>
> >>> On 5/12/2011 8:20 AM, Ceausu Adrian wrote:
> >>> br />
> >>>>Hello,
> >>>>
> >>>>
> >>>>I have a DSP 6416T and i'm using it for calculating the effective
> value of a sine wave.
> >>>>I've made the default settings in registers, 0x0017 for input and
> 0x01f9 for output, and when i generate (with a
> >>>> signal generator) a sine wave with 2Vp-p amplitude, on the
> oscilloscope its only 0.8Vp-p.br />
> >>>>
> >>>>
> >>>>Does anyone knows why ?
> >>>
> >>> a. the impedance of the load is incorrect for the signal generator
> >>> or
> >>> b. the signal generator is broken or incorrectly set up
> >>> or
> >>> c. the scope or probe is broken, out of calibration, or incorrectly
> >>> set up
> >>>
> >>>
> >>> mikedunn
> >>> Thank you./span>
Reply by Jeff Brower●May 18, 20112011-05-18
Adi-
You're worried about too many things -- it takes too much time to read your
post and try to follow along.
The art of debug requires you to simplify and divide the problem, and check
basic things one at a time. Start by
separating input from output and checking your output levels, by generating
output signals in software.
I explained how to do this in my previous post. I can't help you any
further unless you do those specific
experiments. What results do you get?
-Jeff
> I've been doing some research on the board and
found out this in Rulph Chassaing book: "The maximum allowable input
> signal level at the LINE IN inputs to the codec is
> 1 V rms. However, the C6713 and C6416 DSKs contain a potential divider
circuit with a gain of 0.5 between their LINE
> IN sockets and the codec itself with the effect
> that the maximum allowable input signal level at the LINE IN sockets on the
DSKs is 2 V rms. Above this level, input
> signals will be distorted. Input and output sockets
> on the DSKs are ac coupled to the codec."
>
> I used this code from the book:
>
> //loop_poll.c loop program using polling
> #include "DSK6416_AIC23.h" //codec support
> Uint32 fs=DSK6416_AIC23_FREQ_8KHZ; //set sampling rate
>
> void main()
> {
> short sample_data;
> comm_poll(); //init DSK, codec, McBSP
> while(1) //infinite loop
> {
> sample_data = input_left_sample(); //input sample
> output_left_sample(sample_data); //output sample
> }
> }
>
> From the book again: "Input a sinusoidal waveform to the LINE IN connector on
the DSK, with an amplitude of
> approximately 2.0 V p - p and a frequency of approximately 1 kHz. Connect
> the output of the DSK, LINE OUT, to an oscilloscope, and verify the presence
of a tone of the same frequency, but
> attenuated to approximately 1.0 V p - p. This attenuation
> is due to the potential divider network, comprising two resistors, on the
DSK circuit board between the LINE IN
> socket and the codec input."
>
> Done that but with different results, at LINE OUT the signal had same
frequency and amplitude of 0.4Vp-p. The AIC23
> codec had this values in registers:
>
> DSK6416_AIC23_Config config = {
> 0x0017, /* Set-Up Reg 0 Left line in volume control */
> 0x0017, /* Set-Up Reg 1 Right line in volume control */
> 0x01f9, /* Set-Up Reg 2 Left channel headphone volume */
> 0x01f9, /* Set-Up Reg 3 Right channel headphone volume */
> 0x0011, /* Set-Up Reg 4 Analog audio path control */
> 0x0000, /* Set-Up Reg 5 Digital audio path control */
> 0x0000, /* Set-Up Reg 6 Power down control */
> 0x0043, /* Set-Up Reg 7 Digital audio interface format */
> 0x0081, /* Set-Up Reg 8 Sample rate control */
> 0x0001 /* Set-Up Reg 9 Digital interface activation */
> };
>
> After this i tested the board for different amplitudes and got this
results:
>
> input =1.5Vp-poutput=0.3Vp-p
> input=2Vp-poutput=0.4Vp-p
> input=3Vp-poutput=0.6Vp-p
> input=4Vp-poutput=0.76Vp-p
> input=5Vp-poutput=1Vp-p
> Looks like the output=0.2*input. How is it possible ?????
> ________________________________
> From: Jeff Brower
> To: c...
> Cc: Adi Aditza
> Sent: Friday, May 13, 2011 11:43 PM
> Subject: Re: [c6x] DSP 6416
>
> Adi-
>
>> Let me start again with the problem.
>>
>> Here is the code im using:
>>
>> #include "dsk6416_aic23.h" //codec-DSK support file
>> Uint32 fs=DSK6416_AIC23_FREQ_48KHZ; //set sampling rate
>> interrupt void c_int11() //interrupt service routine
>> {
>> short sample_data;
>> sample_data = input_sample(); //input data
>> output_sample(sample_data); //output data
>> return;
>> }
>> void main()
>> {
>> comm_intr(); //init DSK, codec, McBSP
>> while(1); //infinite loop
>> }
>>
>> I generate a signal with 2Vp-p amplitude and 1kHz frequency
>> with a signal generator and connect it to Line IN. After i
>> run the code, the signal from Line OUT shown on oscilloscope
>> is a sine wave with 0.8Vp-p and 1kHz. If i vary the
>> frequency and amplitude at input, it varies at output
>> (frequency at output is the same as input only the amplitude
>> is attentuated at output).
>>
>> The cables im working with are coaxial with BNC plug at one
>> end and audio jack (3.5mm) at the other end, and another
>> coaxial has BNC plugs at both ends.
>> The signal generator and oscilloscope are connected to
>> 230VAC.
>>
>> The board im using is TMS320C6416T. If you need the other
>> files im using let me know. They
>> are: C6416dskinit.c, C6416dsk.cmd, Vectors_intr.asm,
>> c6416dskinit.h, dsk6416_aic23.h.
>
> It could be the DSK board has different gain settings for input vs. output.
In your first post you mentioned some
> register values -- what are those? AIC23 registers? If so which ones? Do
you have input and output gain (or
> attenuation) set as matching?
>
> Also, try doing the following in your ISR:
>
> static unsigned short int i = 0;
> static short int posmax =0;
> static short int negmax = 0;
>
> sample_data = input_sample(); //input data
> if (sample_data > posmax) posmax = sample_data;
> if (sample_data < negmax) negmax = sample_data;
> sample_data = (short int)i++;
> output_sample(sample_data); //output data
>
> This will cause output ranging from 0 to 65535; i.e. maximum possible range.
What's the max Vpp you see on the scope?
> If your max scope Vpp is still 0.8, then clearly something in hardware is
restricting your output amplitude level.
>
> And you can look at posmax and negmax values after you pause the code. First
they should be symmetric, if not then
> you don't have the signal generator hooked up correctly. Second from
what I recall with the DSK boards and AIC23
> codecs, you should be able to give +/- 2V input to the boards, maybe a bit
higher. So in your case posmax should be
> around 15,000.
>
> -Jeff
>
>> ________________________________
>> From: Jeff Brower
>> To: Adi Aditza
>> Cc: c...
>> Sent: Thursday, May 12, 2011 10:40 PM
>> Subject: Re: [c6x] DSP 6416
>>
>> Adi-
>>
>>> I connected the signal from signal generator to the
>>> oscilloscope and its a sine wave with 2Vp-p amplitude.
>>
>> Is that not what you expect? Can you vary the level using the amplitude
control on the signal generator?
>>
>>> generator has 2 output impedances (50ohm and 600ohm)
>>> and the result its the same.
>>
>> Scope inputs are high impedance, so it won't matter what is the signal
generator output impedance -- both selections
>> should look the same.
>>
>>> I have a DSP 6416T and i'm using it for calculating
>>> the effective value of a sine wave.
>>
>> Can you clarify your setup? If the signal generator is producing the
sine wave and the scope is measuring it, then
>> what is the DSP doing? And what type of board do you have? DSK
6416? Something else?
>>
>> -Jeff
>>
>>> ________________________________
>>> From: mikedunn
>>> To: Ceausu Adrian
>>> Cc: c...
>>> Sent: Thursday, May 12, 2011 7:42 PM
>>> Subject: Re: [c6x] DSP 6416
>>>
>>>
>>> Ceausu Adrian,
>>>
>>> On 5/12/2011 8:20 AM, Ceausu Adrian wrote:
>>> Â
>>>>Hello,
>>>>
>>>>
>>>>I have a DSP 6416T and i'm using it for calculating the effective value
of a sine wave.
>>>>I've made the default settings in registers, 0x0017 for input and
0x01f9 for output, and when i generate (with a
>>>> signal generator) a sine wave with 2Vp-p amplitude, on the oscilloscope its
only 0.8Vp-p.Â
>>>>
>>>>
>>>>Does anyone knows why ?
>>>
>>> a. the impedance of the load is incorrect for the signal generator
>>> or
>>> b. the signal generator is broken or incorrectly set up
>>> or
>>> c. the scope or probe is broken, out of calibration, or incorrectly
>>> set up
>>>
>>>
>>> mikedunn
>>> Thank you.Â
_____________________________________
Reply by Jeff Brower●May 13, 20112011-05-13
Adi-
> Let me start again with the problem.
>
> Here is the code im using:
>
> #include "dsk6416_aic23.h" //codec-DSK support file
> Uint32 fs=DSK6416_AIC23_FREQ_48KHZ; //set sampling rate
> interrupt void c_int11() //interrupt service routine
> {
> short sample_data;
> sample_data = input_sample(); //input data
> output_sample(sample_data); //output data
> return;
> }
> void main()
> {
> comm_intr(); //init DSK, codec, McBSP
> while(1); //infinite loop
> }
>
> I generate a signal with 2Vp-p amplitude and 1kHz frequency
> with a signal generator and connect it to Line IN. After i
> run the code, the signal from Line OUT shown on oscilloscope
> is a sine wave with 0.8Vp-p and 1kHz. If i vary the
> frequency and amplitude at input, it varies at output
> (frequency at output is the same as input only the amplitude
> is attentuated at output).
>
> The cables im working with are coaxial with BNC plug at one
> end and audio jack (3.5mm) at the other end, and another
> coaxial has BNC plugs at both ends.
> The signal generator and oscilloscope are connected to
> 230VAC.
>
> The board im using is TMS320C6416T. If you need the other
> files im using let me know. They
> are:C6416dskinit.c,C6416dsk.cmd,Vectors_intr.asm,
>c6416dskinit.h,dsk6416_aic23.h.
It could be the DSK board has different gain settings for input vs. output. In
your first post you mentioned some
register values -- what are those? AIC23 registers? If so which ones? Do you
have input and output gain (or
attenuation) set as matching?
Also, try doing the following in your ISR:
static unsigned short int i = 0;
static short int posmax =0;
static short int negmax = 0;
sample_data = input_sample(); //input data
if (sample_data > posmax) posmax = sample_data;
if (sample_data < negmax) negmax = sample_data;
sample_data = (short int)i++;
output_sample(sample_data); //output data
This will cause output ranging from 0 to 65535; i.e. maximum possible range.
What's the max Vpp you see on the scope?
If your max scope Vpp is still 0.8, then clearly something in hardware is
restricting your output amplitude level.
And you can look at posmax and negmax values after you pause the code. First
they should be symmetric, if not then
you don't have the signal generator hooked up correctly. Second from what
I recall with the DSK boards and AIC23
codecs, you should be able to give +/- 2V input to the boards, maybe a bit
higher. So in your case posmax should be
around 15,000.
-Jeff
> ________________________________
> From: Jeff Brower
> To: Adi Aditza
> Cc: c...
> Sent: Thursday, May 12, 2011 10:40 PM
> Subject: Re: [c6x] DSP 6416
>
> Adi-
>
>> I connected the signal from signal generator to the
>> oscilloscope and its a sine wave with 2Vp-p amplitude.
>
> Is that not what you expect? Can you vary the level using the amplitude
control on the signal generator?
>
>> generator has 2 output impedances (50ohm and 600ohm)
>> and the result its the same.
>
> Scope inputs are high impedance, so it won't matter what is the signal
generator output impedance -- both selections
> should look the same.
>
>> I have a DSP 6416T and i'm using it for calculating
>> the effective value of a sine wave.
>
> Can you clarify your setup? If the signal generator is producing the sine
wave and the scope is measuring it, then
> what is the DSP doing? And what type of board do you have? DSK 6416?
Something else?
>
> -Jeff
>
>> ________________________________
>> From: mikedunn
>> To: Ceausu Adrian
>> Cc: c...
>> Sent: Thursday, May 12, 2011 7:42 PM
>> Subject: Re: [c6x] DSP 6416
>> Ceausu Adrian,
>>
>> On 5/12/2011 8:20 AM, Ceausu Adrian wrote:
>>
>>>Hello,
>>>
>>>
>>>I have a DSP 6416T and i'm using it for calculating the effective value
of a sine wave.
>>>I've made the default settings in registers, 0x0017 for input and 0x01f9
for output, and when i generate (with a
>>> signal generator) a sine wave with 2Vp-p amplitude, on the oscilloscope its
only 0.8Vp-p.
>>>
>>>
>>>Does anyone knows why ?
>>
>> a. the impedance of the load is incorrect for the signal generator
>> or
>> b. the signal generator is broken or incorrectly set up
>> or
>> c. the scope or probe is broken, out of calibration, or incorrectly
>> set up
>> mikedunn
>> Thank you.
>>>