IC for function generator - Page 1
Forum section: electronics / projects

author: testian
author_rank: Regular Contributor
timestamp: November 02, 2016, 08:14:49 pm
content: 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.AD9834AD9102used in other projectsnearly 0 references75MHz Clock, crystal for clock180MHz Clock, separate clock generation necessarySine,Square, TriangularSine,Square,Sawtooth, Triangular, On-chip 4,096 x 14 bit pattern memory0.28 Hz resolution at 75MHz10.8 Hz resolution at 180MHzSOPQFNhttp://www.analog.com/media/en/technical-documentation/data-sheets/AD9834.pdfhttp://www.analog.com/media/en/technical-documentation/data-sheets/AD9102.pdfFor 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

author: Kleinstein
author_rank: Super Contributor
timestamp: November 02, 2016, 08:46:59 pm
content: 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.

author: MarkF
author_rank: Super Contributor
timestamp: November 02, 2016, 08:51:06 pm
content: 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.

author: macck
author_rank: Contributor
timestamp: November 04, 2016, 11:33:41 am
content: 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.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.

author: testian
author_rank: Regular Contributor
timestamp: November 08, 2016, 02:47:16 pm
content: 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.

author: MarkF
author_rank: Super Contributor
timestamp: November 10, 2016, 07:36:11 am
content: Quote from: testian on November 08, 2016, 02:47:16 pmI 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 rangeSine, triangle, 1X square, 2X square, sweep up and sweep down (The sweep function is done in software)1 Vp-p output+/- 2VDC offsetHARDWARE:AD9834PIC18F2550TLE2082 OpAmpMCP4802 DAC32.768MHz Oscillator1.27" OLED displayPEC11R-4220F-S0024 rotary encoder w. switchUse the recommended pullup/filter from the spec sheet for best encoder response.SOFTWARE:32K program memory required.Implement frequency sweep up/down functionRead rotary encoderWith 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.).

author: Kleinstein
author_rank: Super Contributor
timestamp: November 10, 2016, 04:01:55 pm
content: 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.

author: MarkF
author_rank: Super Contributor
timestamp: November 10, 2016, 11:54:47 pm
content: Quote from: Kleinstein on November 10, 2016, 04:01:55 pmI 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....

author: coromonadalix
author_rank: Super Contributor
timestamp: November 11, 2016, 01:34:51 am
content: check for dds generators on Ebay you have a few who can go as 200mhzthey even have an touchscreen interface, and the price is very good ...

author: Kleinstein
author_rank: Super Contributor
timestamp: November 11, 2016, 11:50:46 am
content: 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.

author: MarkF
author_rank: Super Contributor
timestamp: November 11, 2016, 09:21:41 pm
content: 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.

author: Kleinstein
author_rank: Super Contributor
timestamp: November 11, 2016, 09:31:21 pm
content: 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.

author: rs20
author_rank: Super Contributor
timestamp: June 26, 2019, 01:57:33 am
content: Quote from: MarkF on November 10, 2016, 07:36:11 amSorry 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.

author: MarkF
author_rank: Super Contributor
timestamp: June 26, 2019, 03:58:37 am
content: Quote from: rs20 on June 26, 2019, 01:57:33 amYou 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.

author: ogden
author_rank: Super Contributor
timestamp: June 26, 2019, 05:11:54 am
content: SPI double mode argument is BS. By default interface is plain 3 wire SPI.

author: rs20
author_rank: Super Contributor
timestamp: June 26, 2019, 06:15:25 am
content: Quote from: MarkF on June 26, 2019, 03:58:37 amI 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.Quote from: ogden on June 26, 2019, 05:11:54 amThis. 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.

author: MarkF
author_rank: Super Contributor
timestamp: June 26, 2019, 01:36:45 pm
content: 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.

author: ogden
author_rank: Super Contributor
timestamp: June 26, 2019, 06:19:29 pm
content: 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.