Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Signal Generator using FPGA and DAC

Reply
Thread Tools

Signal Generator using FPGA and DAC

 
 
Sheetal
Guest
Posts: n/a
 
      04-24-2007
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

 
Reply With Quote
 
 
 
 
canadianJaouk
Guest
Posts: n/a
 
      04-27-2007
On Apr 24, 6:23 am, Sheetal <(E-Mail Removed)> 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

 
Reply With Quote
 
 
 
 
Hrishi
Guest
Posts: n/a
 
      05-02-2007
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!!!

 
Reply With Quote
 
Mark McDougall
Guest
Posts: n/a
 
      05-03-2007
Hrishi wrote:

> 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,

--
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
 
Reply With Quote
 
Mark McDougall
Guest
Posts: n/a
 
      05-03-2007
Sheetal wrote:

> 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,

--
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
 
Reply With Quote
 
Mark McDougall
Guest
Posts: n/a
 
      05-03-2007
canadianJaouk wrote:

>> 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..


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,

--
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
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      05-03-2007
On May 2, 8:20 pm, Mark McDougall <(E-Mail Removed)> wrote:

> 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

 
Reply With Quote
 
Mark McDougall
Guest
Posts: n/a
 
      05-04-2007
Andy wrote:

> 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,

--
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
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      05-07-2007
On May 3, 7:50 pm, Mark McDougall <(E-Mail Removed)> wrote:
> Andy wrote:
> > 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,
>
> --
> 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


 
Reply With Quote
 
hsvjap hsvjap is offline
Junior Member
Join Date: Mar 2008
Posts: 21
 
      03-15-2008
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

http://www.velocityreviews.com/forums/(E-Mail Removed)


Thanks in advance.
sahana
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
fpga board with parallel dac? picnanard VHDL 0 11-22-2010 06:42 PM
FPGA Central eNewsletter - LinkedIn, Write Articles, Post FREE Jobs,FPGA for Mobiles Vikram VHDL 0 07-24-2008 07:37 PM
signal generator on fpga hsvjap VHDL 0 03-15-2008 10:36 AM
Signal generator using FPGA and DAC Sheetal VHDL 1 04-25-2007 03:55 AM
Slightly OT: 12 bit DAC vs. 10 bit DAC br2001@webtv.net DVD Video 1 08-03-2003 05:40 AM



Advertisments