Author Topic: IC for function generator  (Read 7047 times)

0 Members and 2 Guests are viewing this topic.

Offline testianTopic starter

  • Regular Contributor
  • *
  • Posts: 55
IC for function generator
« on: November 02, 2016, 08:14:49 pm »
Hi,

I would like to build my own function generator. But at the moment i am not sure what chip I should use. Everything will be controlled with a microcontroller.

AD9834
AD9102
used in other projects
nearly 0 references
75MHz Clock, crystal for clock
180MHz Clock, separate clock generation necessary
Sine,Square, Triangular
Sine,Square,Sawtooth, Triangular, On-chip 4,096 x 14 bit pattern memory
0.28 Hz resolution at 75MHz
10.8 Hz resolution at 180MHz
SOP
QFN
http://www.analog.com/media/en/technical-documentation/data-sheets/AD9834.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/AD9102.pdf

For the AD9102 I could use a second, lower clock of 18MHz to get 1Hz resolution at lower frequencies.

Is the resolution of the AD9102 good enough?
Is it possible for sb. who had never done something with higher frequencies?

Thanks in advance for you answers
« Last Edit: November 03, 2016, 07:18:30 pm by testian »
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14474
  • Country: de
Re: DDS project
« Reply #1 on: November 02, 2016, 08:46:59 pm »
The AD9102 is a rather new chip - so no wonder you don't find much.
The 14 Bit resolution is quite good. The frequency resolution is still a 24 Bit word. So not that bad. Using a slower clock can work, but this would also need a second lower frequency frequency reconstruction filter.

The triangle and even more saw tooth waveform is only good for much lower frequency than the sine and ideally also wants a different reconstruction filter, though a compromise might work if you don't need the highest sine frequencies. The rectangular signal directly from the DDS ( turned NCO) is likely not useful as it would have high jitter. A good rectangular would use the sine signal followed by a comparator and maybe followed by an extra divider.

So the AD9102 can result in a much better generator: higher frequency, less distortion, extra ARB option -  though limited memory. Only frequency resolution is not that fine without changing the clock.


 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
Re: DDS project
« Reply #2 on: November 02, 2016, 08:51:06 pm »
I can't tell you which to use. I built one with the AD9834 and a pic18f2550. It works well up to 1Mhz. I used a 32768Hz oscillator in order to get an exact binary division for a 1Hz output. I wish I could get the square waveform on the same pin as the sine and triangle.

Without exploring your other chip, it looks like you have a lot of additional waveforms. I think I would use the AD9102.
« Last Edit: November 02, 2016, 08:56:40 pm by MarkF »
 

Offline macck

  • Newbie
  • Posts: 9
  • Country: pl
Re: IC for function generator
« Reply #3 on: November 04, 2016, 11:33:41 am »
Hello everybody, im new to this board.

Im also into project of DDS. I've been granted samples as a student from AD and im in possesion of AD9102BCPZ and AD9833BRMZ.
I've done some research about AD9102 and it appears to be problematic (topics on AD board). Im also looking forward to learn about existing references of this one, to know-how. I've found very cool "tiny-dds" AFG with a touch screen that uses AD9834 and it's a fully open source project. I hooked on this one but i would love to replace AD9834 with AD9102 as it has RAM memory, and its capable of delivering 180MSPS  while the other generates signal driven via SPI bus from a uC and is capable of roughly 100kSPS. I'm going to study this deeper as I want to build device within 1 year for my engineering degree, it's may look like plenty of time but i think it's not :D .
Well, so im accualy into similar problem as author, but to make device somehow usefull in my workshop I would go for AD9102, and hook this up with STM32, FT801 smart display, and maybe some digital LPF's/VGA's as i recieved a lot of usefull stuff as a sample from analog/linear - but for basic coupling/offset/amplitude concept I would go for "tinydds" idea.
I would love to join discussion about designing fully functional DDS using AD9102, maybe we can work out something together with help of more experienced people on this board.

Best wishes for all of You.
 

Offline testianTopic starter

  • Regular Contributor
  • *
  • Posts: 55
Re: IC for function generator
« Reply #4 on: November 08, 2016, 02:47:16 pm »
I will go with the AD9834. Simply because I don't have to worry much about generating a clock signal and the better resolution. Another benefit is the better documentation.
But I will try to make it that way, that the AD9834 could be replace with an AD9102 module.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
Re: IC for function generator
« Reply #5 on: November 10, 2016, 07:36:11 am »
I will go with the AD9834. Simply because I don't have to worry much about generating a clock signal and the better resolution. Another benefit is the better documentation.
But I will try to make it that way, that the AD9834 could be replace with an AD9102 module.

I think you made a wise choice. I spent a little time looking at the AD9102 interface and it looks like it is pretty involved to program. (Not a good choice for the beginner.)


I thought I would pass along some lessons learned from building my DDS with an AD9834. I've attached a photo of my proto board. You'll have to excuse the layout. It is a re-purposed board. The PIC processer is under the display.

DESIGN:
  1Hz to 1MHz frequency range
  Sine, triangle, 1X square, 2X square, sweep up and sweep down (The sweep function is done in software)
  1 Vp-p output
  +/- 2VDC offset

HARDWARE:
  AD9834
  PIC18F2550
  TLE2082 OpAmp
  MCP4802 DAC
  32.768MHz Oscillator
  1.27" OLED display
  PEC11R-4220F-S0024 rotary encoder w. switch

    Use the recommended pullup/filter from the spec sheet for best encoder response.

SOFTWARE:
  32K program memory required.
  Implement frequency sweep up/down function
  Read rotary encoder

    With 35+ years of professional software development experience, I decided to write all the software myself to minimize memory usage and optimize execution speed. I did NOT use any libraries from the internet (i.e. the Adafruit graphics library). My graphics functions are optimized to use hardware capabilities and they use a minimal font. My code requires 99% of the PICs 32K program space (A little over 1000 lines of C code excluding header files.).
« Last Edit: November 10, 2016, 07:47:14 am by MarkF »
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14474
  • Country: de
Re: IC for function generator
« Reply #6 on: November 10, 2016, 04:01:55 pm »
There should be a filter at the output of the DDS, to get rid of the higher image frequencies. This usually is a passive LC filter - no really expensive parts, but needs some care in the layout because of the high frequencies. For a good triangle response one might not want the steepest filter - so it's a compromise, that might limit the upper frequency limit.

For a good square wave signal one should use the sine signal and a comparator and a digital divider for the low frequencies. The digital signal (MSB) directly from the DDS will have quite some jitter at most frequencies.

One still has to add amplitude setting. This could use the ref. input of the DDS chip for fine adjustments as one option.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
Re: IC for function generator
« Reply #7 on: November 10, 2016, 11:54:47 pm »
For a good square wave signal one should use the sine signal and a comparator and a digital divider for the low frequencies. The digital signal (MSB) directly from the DDS will have quite some jitter at most frequencies.

I have not seen any jitter on the digital sign bit (MSB) output of the DDS. I would expect to see a lot of jitter on the sine wave also if there was jitter on the sign bit since the output is the MSB going to the DAC....
 

Online coromonadalix

  • Super Contributor
  • ***
  • Posts: 6222
  • Country: ca
Re: IC for function generator
« Reply #8 on: November 11, 2016, 01:34:51 am »
check for dds generators on Ebay   you have a few who can go as 200mhz ???  they even have an touchscreen interface, and the price is very good ...
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14474
  • Country: de
Re: IC for function generator
« Reply #9 on: November 11, 2016, 11:50:46 am »
The sign bit or MSB for the DAC can only change with the clock. So only fractions of the clock (e.g. 75 MHz) can be produced without principle jitter. Other frequencies should have an about +-6 ns jitter. It depends on the application if the really matters or is visible.

For the sine wave it is not only the upper bit that is effective, but the other bits help to get the zero crossing right at the correct timing. The reconstruction filter makes the interpolation. Ideally the time resolution is increased by about the DAC amplitude resolution. So a much lower jitter is possible. The interpolation with the analog values works best for rather high frequencies (e.g. > 10 MHz and also jitter from the comparator will increase towards lower frequencies. So for low frequencies an extra divider (could be just a few steps like divide by 2 / 32 / 512 / 8192 / ...) would be needed to get low jitter (< 1 ns) at these frequencies too. The divide by 2 step helps to get exactly 50% on/off ratio.

 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
Re: IC for function generator
« Reply #10 on: November 11, 2016, 09:21:41 pm »
I see. And since I choose a clock frequency (32.768MHz) with an exact binary value and limited my frequency selection to increments of 1Hz, I always have an exact fraction of the clock. Therefore, no jitter.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14474
  • Country: de
Re: IC for function generator
« Reply #11 on: November 11, 2016, 09:31:21 pm »
With the 32,768 MHz clock you can not get a low jitter 4 MHz clock, just from the digital circuit part: One period is somewhat slightly more than 8 clock periods - so most of the time 8 and sometimes 9.

The clock frequency might still have some advantages, as for frequencies that are multiples of 1 kHz the DDS phase increment is a simple value with quite some zeros at the end. This would cause less spurious signals at these frequencies.
 
The following users thanked this post: rs20

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2320
  • Country: au
Re: IC for function generator
« Reply #12 on: June 26, 2019, 01:57:33 am »
I will go with the AD9834. Simply because I don't have to worry much about generating a clock signal and the better resolution. Another benefit is the better documentation.
But I will try to make it that way, that the AD9834 could be replace with an AD9102 module.

I think you made a wise choice. I spent a little time looking at the AD9102 interface and it looks like it is pretty involved to program. (Not a good choice for the beginner.)

Sorry for necro-posting, but I gotta say I disagree with this. Compared to the very real difficulties of doing actual electronics (take handling RF signals, avoiding crosstalk, poor decoupling which can all result in hours of time designing and building a board resulting in an unuseable thing and all the effort going down the drain; or soldering fine pitch components which, if it goes wrong, can spell a frustrating end to the project), "programming" a device like a AD9102 is absolutely trivial. Yes, it would be hard if you had to get it working on the first try. But this is firmware, you don't need to do so at all.  Once you have a board with an AD9102 on it, you can just tinker away. Getting a simple sine wave out of an AD9102 is perfectly straightforward. Then keep slowly adding features.

TL;DR: Needing to modify and rebuild hardware 10 times would be tear-inducingly awful, weeks of pain. Whereas modifying and rebuilding the firmware 10 times is a standard evening of light tinkering/development. The 'difficulties' of an AD9102 fall into the latter category.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
Re: IC for function generator
« Reply #13 on: June 26, 2019, 03:58:37 am »
I will go with the AD9834. Simply because I don't have to worry much about generating a clock signal and the better resolution. Another benefit is the better documentation.
But I will try to make it that way, that the AD9834 could be replace with an AD9102 module.

I think you made a wise choice. I spent a little time looking at the AD9102 interface and it looks like it is pretty involved to program. (Not a good choice for the beginner.)

Sorry for necro-posting, but I gotta say I disagree with this. Compared to the very real difficulties of doing actual electronics (take handling RF signals, avoiding crosstalk, poor decoupling which can all result in hours of time designing and building a board resulting in an unuseable thing and all the effort going down the drain; or soldering fine pitch components which, if it goes wrong, can spell a frustrating end to the project), "programming" a device like a AD9102 is absolutely trivial. Yes, it would be hard if you had to get it working on the first try. But this is firmware, you don't need to do so at all.  Once you have a board with an AD9102 on it, you can just tinker away. Getting a simple sine wave out of an AD9102 is perfectly straightforward. Then keep slowly adding features.

TL;DR: Needing to modify and rebuild hardware 10 times would be tear-inducingly awful, weeks of pain. Whereas modifying and rebuilding the firmware 10 times is a standard evening of light tinkering/development. The 'difficulties' of an AD9102 fall into the latter category.

You have got to be kidding!

No RF here.  And both devices have fine pitch.

Minimal documentation!
34 registers with one-line bit descriptions being the total extent of the programming documentation.
A 3-wire or 4-wire SPI interface with two data pins for double SPI transfers.
Far from standard and the double SPI transfer mode would necessitate bit-bang software transfers (i.e. no hardware SPI).

Not for the novice programmer!  Especially for the people who search for libraries to do all the hard work.
Far far far from a trivial interface.
Sure, you turn it on and a sine wave comes out.  Simple.  You're done.  Right?
I predict weeks of trial-and-error and pain.  Then giving up!

Do you want to tinker or accomplish something?


Before you ask...  E.E. degree with 35+ years of professional software development.
« Last Edit: June 26, 2019, 04:24:06 am by MarkF »
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: IC for function generator
« Reply #14 on: June 26, 2019, 05:11:54 am »
SPI double mode argument is BS. By default interface is plain 3 wire SPI.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2320
  • Country: au
Re: IC for function generator
« Reply #15 on: June 26, 2019, 06:15:25 am »
You have got to be kidding!

No RF here.  And both devices have fine pitch.

I wasn't comparing different options, I'm just saying that as an individual thing, you would have to be a million times better an EE than software before programming an AD9102 became comparable in difficulty to correctly designing and assembling a board with an AD9102 on it. Maybe you are a million times better at EE than programming, but I would suggest you shouldn't assume everyone else on here is the same.

SPI double mode argument is BS. By default interface is plain 3 wire SPI.

This. MarkF, you're looking at every part of this, and assuming the absolute worst. I'm not talking out of ignorance, I've used this device in the past. I made it extra complicated for myself by requiring that I could output different frequencies, synchronized with a pulse output by a separate microcontroller, such that the 0 of the sin coincided with the end of the microcontroller pulse. It was a while ago now, but I recall spending a whole day figuring out an issue which turned out to be having my SCLK and MOSI backwards or something like that, and then I had this going in no time at all:



The fact that each bit has a one-line description is a GOOD THING. It means the operation of each piece of the device is simple, and the great flexibility of the device as a whole comes from the varied ways you can plug those pieces together. There's plenty of examples outlining the main features, so you have far more to work with that just one line descriptors.

If you expect the datasheet to be a Stack Overflow-style guide that has every possible thing you can imagine already figured out for you, then it'd be 1000 pages long.
If you just invest a little time in understanding the design decisions behind the AD9102, the datasheet makes beautiful sense. YMMV I suppose.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
Re: IC for function generator
« Reply #16 on: June 26, 2019, 01:36:45 pm »
I feel sorry for the person reading this and then chooses the AD9102 over the AD9834 thinking it will be a walk-in-the-park to use. 
Both the AD9102 hardware and SPI interface is far more complex than the AD9834.
The concepts and capabilities of the AD9102 are much harder to grasp than in the AD9834.

One line descriptions is what I would consider as minimal documentation.  (Not a bad thing.  Just minimal.)
I have no idea what a Stack Overflow-style guide looks like.  I have never seen one.
The point I am trying to make is that the AD9834 documentation is more detailed.

The double SPI transfer mode argument is not BS if you need/want to use it.  It's not a hardware SPI transfer capability.

I am not making any assumptions about the user.  I am comparing the two devices and the manufacture datasheets.
I see that I am not going to win any arguments here.  Just saying the AD9834 is much easier to use than the AD9102.
I would still recommend the AD9834 over the AD9102 for a novice.

This discussion is suppose to be a comparison of the AD9834 and AD9102 devices.
This is not a comparison of electronics vs software.
This is a comparison of the electronics and software needed for the AD9102 vs the AD9834.
« Last Edit: June 26, 2019, 01:39:39 pm by MarkF »
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: IC for function generator
« Reply #17 on: June 26, 2019, 06:19:29 pm »
Double SPI argument indeed is BS because it is optional mode. When someone need/want to use it, he shall not be considered as novice. Fast SPI is needed only for waveform memory of AD9102. As far as I know, theres no such in AD9834. In general I agree to you, but had to correct you fallacies. BTW stm32f4 spi peripheral have not only double but quad spi mode. There are other mcu's with such functionality.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf