From: mlajevar on
Hello

I wrote a vhdl code for implementing amplifer and ADC on sparan3E board, I
am working with LTC1407A-1 Dual A/D on spartan3E(with SPI protocol),my
problem is when I changed the analog voltage which is applied to this
A/D,the eight most significant digital value on LEDs also changed
accordingly,but it's not equal to what I calculated based on the formula
D[13:0]=(Gain*(Vin-1.65)*8192)/1.25v provided in the data sheet.LED's
follow specific pattern for each analog voltage ,I mean I tested different
voltage and every time the result on LED's were same,so my program does
understand different volages,but the problem is ,it is not equivalent to
what I got from formula. can anyone help?please give me an idea what I can
do.


From: KJ on
On Dec 30, 3:36 pm, "mlajevar" <mahsa_lajeva...(a)yahoo.com> wrote:

> please give me an idea what I can do.

1. Use either an oscilloscope or a multi-meter to make a measurement
of the analog input and reference voltages
2. If #1 checks out, run a simulation and verify correct operation of
your SPI interface code.

This basic process works to solve most any design problem. If you're
stumped and have no hypothesis to explain the unwanted behavior, then
you make measurements to give you additional insight (#1), or run
additional simulation test cases (#2) until you finally can say 'Ah
ha!'...then you fix whatever it was that caused you to say 'Ah ha!'

Kevin Jennings

From: mlajevar on
Hello

thanks for your idea,

I did the simulation for amplifier part to check if SPI communication
working properly or not,and it was right,after that I made a op level
module from my amplifier combined with ADC behavior which I cannot simulate
it ,because t needs analog voltage,so all I can do for the top level is to
check it when it is programmd on the board.

Moreover,the reference volatge generated via a voltage divider on the
board,I just applied 3.3 volt from power supply to vcc og Header J7,so I
suppose reference voltage should be right.

the thing is what I got from LEDs is not even two's complement or invert
form of what I expected from formula. with these information,does any one
have new idea? thanks in advance

---------------------------------------
This message was sent using the comp.arch.fpga web interface on
http://www.FPGARelated.com
From: KJ on
On Dec 30, 11:43 pm, "mlajevar" <mahsa_lajeva...(a)yahoo.com> wrote:
> I did the simulation for amplifier part to check if SPI communication
> working properly or not,and it was right,after that I made a op level
> module from my amplifier combined with ADC behavior which I cannot simulate
> it ,because t needs analog voltage,

VHDL has a data type 'real', analog voltages can be modelled quite
nicely. The transfer function of your ADC can be implemeted quite
easily.

To simulate the ADC, make an entity with all of the I/O using type
'real' for any of the analog inputs. Next compute the ADC output and
finally implement the SPI interface of the ADC. Do all of this by
consulting the data sheet for the part. Now you have a simulation
model for the ADC that will work with your design. Beef up your
testbench for your FPGA to include the ADC model and some form of
stimulus (even a constant voltage) for the ADC input.

> so all I can do for the top level is to
> check it when it is programmd on the board.
>

If the problem is actually in the VHDL code that you wrote, then
checking it on the board is doing it the hard way. If the problem is
in the analog portion of the board then a meter or scope is all you
should need to find the problem. Looking at LED patterns is like
looking at Christmas lights and provides little information about the
problem unless it was something simple like the LED values represent
1/2 or 2x the correct value or some simple to spot thing like that.

> Moreover,the reference volatge generated via a voltage divider on the
> board,I just applied 3.3 volt from power supply to vcc og Header J7,so I
> suppose reference voltage should be right.
>

Suppose all you want...I suggested to measure and verify so that you
wouldn't have to speculate and guess.

> the thing is what I got from LEDs is not even two's complement or invert
> form of what I expected from formula. with these information,does any one
> have new idea? thanks in advance          
>

It's not at all clear just what you know is working and what is not.
It sounds like you wrote some VHDL and the logic is being implemented
in some board that has a Spartan 3E on it. Is the board design in
question or is it the VHDL that controls the ADC? Or maybe the LED
driver? If the board is in question then the meter on the analog
signals will clear it all up. Once you've verified that the inputs to
the ADC are correct, then guess what, the problem is in your VHDL
code...and simulation will find it...IF you model the system correctly
(i.e. the above mentioned ADC model has been verified to the data
sheet for the part, the interconnect from ADC to Spartan is correct,
the interconnect between Spartan and LEDs are modelled correctly)

Kevin Jennings
From: mlajevar on
Hello

I got that the values on LEDs is the half of the value I expect from the
formula,so I think the problem would be with the 14th bit in my vhdl
code,because from 13th bit to LSB ,all bits are almost same,but the big
differencce comes from being half of the original value caused by 14th
bit.

I am trying to work with chipscope,I haven't worked with it ,and I don't
know which type of chipscop pro have to work
with?(ATC2,ICON,ILA,VIO)according to some materials I read,I think I should
work with ILA s that right? I mean to check all my fourtheen bits value for
ADC.

thanks in advance for all your ideas and suggestion

---------------------------------------
This message was sent using the comp.arch.fpga web interface on
http://www.FPGARelated.com