Signal Generator using FPGA and DAC

S

Sheetal

hi..I'm a university student familiar with the only the basics of VHDL
and FPGA implementation..For my project, I'm trying a make a sine
wave, ramp, triangular and square wave generator which outputs
required wave of required amplitude and required frequency

The FPGA is connected with DAC thru I2C bus..

The development board (nanoboard) has on- board freq of 20 mhz...now the
dac being connected to the I2c bus can work upto max 400 Mhz..so a
suitable clock divisor has to be implemented ..thus a low frequency
can be used as SCL input to DAC..

a)Now, for the sine and square wave, I'm assuming that we can use the
same look-up table(values ranging from 0 to 256)for the output values
of DAC.for

obtaining different frequencies, only the SCL needs to be changed .
i.e.if SCl rate is high, the DAC would output from 0 to 256, then to 0
at a faster rate,

if SCL is low, it would output the same values, but with some delay.
THus, variable frequency can be obtained by changing SCL rate..am I
correct in assuming so?

b)If this is correct, can anyone please tell me the relationship
between SCL and output wave frequency..if such a formula/well defined
relationship does exist

c) Also, can anyone tell me about a good link for a simple tutorial on
implementing look-up table?I did find some on the web, but they all
seemed to be complicated..either because they ARE..or because my mind
has gone all-blank right now, with the submission date coming so
near..

Any help at this time would be hugely appreciated

Kind Regards,
Sheetal
 
C

canadianJaouk

hi..I'm a university student familiar with the only the basics of VHDL
and FPGA implementation..For my project, I'm trying a make a sine
wave, ramp, triangular and square wave generator which outputs
required wave of required amplitude and required frequency

The FPGA is connected with DAC thru I2C bus..

The development board (nanoboard) has on- board freq of 20 mhz...now the
dac being connected to the I2c bus can work upto max 400 Mhz..so a
suitable clock divisor has to be implemented ..thus a low frequency
can be used as SCL input to DAC..

a)Now, for the sine and square wave, I'm assuming that we can use the
same look-up table(values ranging from 0 to 256)for the output values
of DAC.for

obtaining different frequencies, only the SCL needs to be changed .
i.e.if SCl rate is high, the DAC would output from 0 to 256, then to 0
at a faster rate,

if SCL is low, it would output the same values, but with some delay.
THus, variable frequency can be obtained by changing SCL rate..am I
correct in assuming so?

b)If this is correct, can anyone please tell me the relationship
between SCL and output wave frequency..if such a formula/well defined
relationship does exist

c) Also, can anyone tell me about a good link for a simple tutorial on
implementing look-up table?I did find some on the web, but they all
seemed to be complicated..either because they ARE..or because my mind
has gone all-blank right now, with the submission date coming so
near..

Any help at this time would be hugely appreciated

Kind Regards,
Sheetal

I don't really understand how your system is setup... You have an I2C
bus between an FPGA and a 400M DAC? I2C typically runs around
400kHz. You will never be able to get samples to the DAC at at rate
of 400M samples using I2C

You need to read up on the I2C standard a bit perhaps. Typically
you'll transfer 1 byte per bus cycle. How many bits are the samples?

What FPGA are you using? I know Xilinx (and I suspect that's true for
Altera as well) has soft cores to generate sine waves in various
ways. You don't need to be bothered implementing your own look up
tables. Also you could use a cordic core (also a soft macro in
xilinx) to generate your sine waves (to avoid using memory).

Provide more details and I can try to help you

-Jakub
 
H

Hrishi

Hello Sheetal!!!

I m Hrishikesh . I along with two of my friends are also currently
trying to build a Function generator for my Final Year Engg course!!
The on- board crystal for our FPGA board is 6MHz. We are using Xilinx
FPGA Xc2s50 tq144 -6

I have been successful in generating
square wave upto 45kHz
sine wave with 128 sample pts for one cycle upto 12kHz
triangular wave with 128 sample points for one cycle upto 7.5kHz.

The main restrictions that we faced were
1. The on board clock is of too low frequency.
2. The floating point values are not synthesisable.For higher
frequency generation the count used for delays being floating point
values were approximated to integer values.This reduces the accuracy
of the frequencies generated.

We also have done duty cycle variation for sqare and triangular wave
though we have shown only 10,30,50 and 70% duty cycles. other values
can also be obtained

the DAC we have used is DAC0808.

Sorry but i really haven't tried out interfacing it to an I2C bus but
i'm sure u'll be succesful in doin that!!!
all the best!!!
 
M

Mark McDougall

Hrishi said:
I m Hrishikesh . I along with two of my friends are also currently
trying to build a Function generator for my Final Year Engg course!!
The on- board crystal for our FPGA board is 6MHz. We are using Xilinx
FPGA Xc2s50 tq144 -6

I have been successful in generating
square wave upto 45kHz
sine wave with 128 sample pts for one cycle upto 12kHz
triangular wave with 128 sample points for one cycle upto 7.5kHz.

With a 6MHz clock and 150ns settling time, you should be able to
generate square waves in the low MHz range?!? And 128-sample/cycle waves
(of any shape) around 46kHz by my calculations.
The main restrictions that we faced were
1. The on board clock is of too low frequency.

With a 150ns settling time you won't need a faster clock, and even if
you did you can use a DCM to multiply the clock internally.

Regards,
 
M

Mark McDougall

Sheetal said:
The development board (nanoboard) has on- board freq of 20 mhz...now
the dac being connected to the I2c bus can work upto max 400 Mhz..so
a suitable clock divisor has to be implemented ..thus a low frequency
can be used as SCL input to DAC..

This is a Nanoboard-NB1?

You need to read up on the I2C bus. BTW the maximum clock rate on the
bus is 400kHz (not MHz) and taking a quick look at the data sheet, you
need to write a minimum of 3 bytes to the device to update a DAC output.
So the maximum rate you can output will be roughly 400k/(3*9) or 14kHz.

Opencores has an I2C controller that should get you up-and-running at
least. It interfaces to wishbone but generating simple wishbone cycles
is trivial.

Regards,
 
M

Mark McDougall

Why do you need a lookup table?

For example, if you have a single 128-byte sine wave stored in an array,
you simply need to clock a counter to use as the array address (index)
at your sampling rate.

You could even clock this asynchronously to the process that writes the
DAC, so your DAC is updated at the same rate regardless of your sampling
rate. The usual precautions need to be taken when shuffling data across
clock domains of course...

Regards,
 
A

Andy

Why do you need a lookup table?

For example, if you have a single 128-byte sine wave stored in an array,
you simply need to clock a counter to use as the array address (index)
at your sampling rate.

Your sine wave stored in an array is a lookup table!

By reversing the sign of the output, and the direction of the counter,
you can get by with only a quarter cycle of the wave due to symmetry.

Andy
 
M

Mark McDougall

Andy said:
Your sine wave stored in an array is a lookup table!

Umm, not really. A lookup table generally implies an associated search
function for mapping one value to another - and an order of magnitude
more difficult to implement.

The sine wave in question is more akin to a waveform sample stored in,
for example, a ROM. Or you could do away with the addressing altogether
and use a circular shift-register.
By reversing the sign of the output, and the direction of the counter,
you can get by with only a quarter cycle of the wave due to symmetry.

True.

Regards,
 
A

Andy

Umm, not really. A lookup table generally implies an associated search
function for mapping one value to another - and an order of magnitude
more difficult to implement.

The sine wave in question is more akin to a waveform sample stored in,
for example, a ROM. Or you could do away with the addressing altogether
and use a circular shift-register.


True.

Regards,

--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266


Umm, yes; there are more complex look up tables than simple arrays,
but when an array is used to transform the input vector (address) into
the output vector (data element), it is in fact a look up table, and
if coded correctly will be implemented as a ROM or RAM in an FPGA.
Just because the search function is implemented very efficiently in
hardware (address decoding) does not mean there is no search function.

For all but the smallest tables, an addressed ROM/RAM (using
appropriate FPGA resources) is almost always more efficient than a
circular shift register.

Andy
 
Joined
Mar 15, 2008
Messages
17
Reaction score
0
signal generator using fpga

Hello all,
Iam new to this community.i am doing my final year engg proj on fpga.Sythesizable function generator. i have written the codes for sine wave generation,wat must be included to vary the frequency. can someone help me in generating square and triangular wave with variable frequency.
plz mail me at

(e-mail address removed)


Thanks in advance.
sahana
 
Joined
Feb 19, 2010
Messages
1
Reaction score
0
hi
i am trying to generate sine waves of different frequencies using LUT. i am using AD558JN as DAC having max 1.5us settling time.though i am able to generate diffrent frequencies ,the shape of waveform i am getting , does nt exactly resemble sinewave.

cud anyone tell waht problem i am facing? i hv used 20Mhz clock and LUT has 256 samples.do i need to latch my FPGA o/p till it renders next sample to the dac?? i hv XC3s200 fpga
 
Joined
Feb 25, 2010
Messages
38
Reaction score
0
get the code from here..
vhdlguru.blogspot.com/2010/03/simple-sine-wave-generator-in-vhdl.html
 
Joined
Jun 16, 2010
Messages
1
Reaction score
0
canadianJaouk said:
On Apr 24, 6:23 am, Sheetal <[email protected]> wrote:
> hi..I'm a university student familiar with the only the basics of VHDL
> and FPGA implementation..For my project, I'm trying a make a sine
> wave, ramp, triangular and square wave generator which outputs
> required wave of required amplitude and required frequency
>
> The FPGA is connected with DAC thru I2C bus..
>
> The development board (nanoboard) has on- board freq of 20 mhz...now the
> dac being connected to the I2c bus can work upto max 400 Mhz..so a
> suitable clock divisor has to be implemented ..thus a low frequency
> can be used as SCL input to DAC..
>
> a)Now, for the sine and square wave, I'm assuming that we can use the
> same look-up table(values ranging from 0 to 256)for the output values
> of DAC.for
>
> obtaining different frequencies, only the SCL needs to be changed .
> i.e.if SCl rate is high, the DAC would output from 0 to 256, then to 0
> at a faster rate,
>
> if SCL is low, it would output the same values, but with some delay.
> THus, variable frequency can be obtained by changing SCL rate..am I
> correct in assuming so?
>
> b)If this is correct, can anyone please tell me the relationship
> between SCL and output wave frequency..if such a formula/well defined
> relationship does exist
>
> c) Also, can anyone tell me about a good link for a simple tutorial on
> implementing look-up table?I did find some on the web, but they all
> seemed to be complicated..either because they ARE..or because my mind
> has gone all-blank right now, with the submission date coming so
> near..
>
> Any help at this time would be hugely appreciated
>
> Kind Regards,
> Sheetal


I don't really understand how your system is setup... You have an I2C
bus between an FPGA and a 400M DAC? I2C typically runs around
400kHz. You will never be able to get samples to the DAC at at rate
of 400M samples using I2C

You need to read up on the I2C standard a bit perhaps. Typically
you'll transfer 1 byte per bus cycle. How many bits are the samples?

What FPGA are you using? I know Xilinx (and I suspect that's true for
Altera as well) has soft cores to generate sine waves in various
ways. You don't need to be bothered implementing your own look up
tables. Also you could use a cordic core (also a soft macro in
xilinx) to generate your sine waves (to avoid using memory).

Provide more details and I can try to help you

-Jakub

Hi!
I'm a university student too and need to produce a sine wave C code for a Nios II core. It will then be compared by a comparator, written in VHDL, with a triangular wave also written in VHDL. Will it be fine if I use the sin function to write my sine code? And how can vary the frequency in it?
 
Joined
Apr 13, 2011
Messages
1
Reaction score
0
generation of I&Q signals for sateliite communication

hiiiiiiii everyone

m workin n a project 4my finl year B.E
its based n generating i/q sinals bt r8 nw i need details of Y SHOULD WE USE I/Q signals? also i hve written code bt m n need f mre details since i need 2prepare report...
m usin cyclone III altera kit quartus II S/W..so pls gve me details regardin data sheet,flowcharts etc...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top