# Generation of a high-resolution triangle wave [closed]

I am trying to generate a triangular wave of frequency ~ 100 kHz and V(p-p) = 4.5 V.

Additionally, I also have a tight specification that the value of the peak of triangular wave generated in each cycle should be very precise.

It is aimed to achieve a 12-bit performance, by which I mean that the variation in the value of peak amplitude of triangle generated (say in 10-15 cycles), should not differ by more than ~1.09 mV. I got this number by dividing 4.5 V = 4500 mV by 4096 (i.e. 2^12).

I have tried using the conventional square wave generation followed by integrator circuits and simulated them in LTSpice. They do work and generate the 100 kHz and 4.5 V(p-p) triangle, but they have amplitudes variations of around 3-10 mV which gives a very poor performance. The best I could get was when 3 mV variation was observed which gave around 4500/3 = 1500 ~ 10.5 bits performance. The circuits that I have tried to simulate are shown below:

And also another requirement I have is to ensure that the square wave generated using comparator/schmitt triggers should have rise/fall times around 10-20 ns. So, I have tried using high-speed op-amps (AD8041 working on 160 MHz) and comparators but this gave rise to ripples in the square and triangular waves generated. These are shown below:

• To begin with, are you interested in the end result or in making your circuit work? If the former, why not use integrated waveform generator? For example, 28 bit AD9833 Sep 25 at 7:34
• Also, a combination of AD9834 and AD5620 as described in CN0156 is very precise and only needs a tiny MCU for initialization. I've tried it before, just a few SPI commands to set amplitude and frequency Sep 25 at 8:10
• You have specified the y-axis precision. But not the x-axis. How much jitter can you tolerate? May as well tell us. Sep 25 at 11:28
• @Maple The output DAC of the AD9833 is 10-bit. Sep 25 at 14:33
• Here's a point of reference for you...a HP3310A function generator (set to 100kHz) measured p-p jitter of about 100ns, 1ms after a trigger. That's roughly the resolution you're after (one part in 10000). Its basic VCO is a triangle generator. A grounded capacitor is charged/discharged by voltage-controlled current sources, which drive a hysteresis-switch - a different approach from yours. Many function generators use this kind of arrangement, because they need a wide-range voltage-controlled frequency. Sep 25 at 15:56

Triangle waves, like square waves, have an infinite Fourier series, so it will be impossible to synthesize a ‘perfect’ one in the real world. You have to make a compromise somewhere.

The other issue you may be facing is that a DAC will have a zero-order hold influence on the output (sinx/x) which will cause roll-off.

Both issues can be tackled by using over sampling followed by a suitable reconstruction filter.

SPICE simulations of such circuits require a constant time step, and may take other fiddling. LTspice is not necessarily lying to you, but the performance of the physical circuits is bound to parasitics so much that the simulation is not too useful. You’ll have to try it, and try it on a PCB, and iterate on it.

It is also not a problem to be solved in SPICE unless you got a couple \$100k to set up an all-up simulation that derives board and package parasitics from 3D models and sticks them into SPICE. Such tools exist and they cost as much as they do because they are worth it.

If I were to do it without expensive EDA tools - much prototyping would be involved, and lovely metrology work to check it out.

The 10-20ns requirement on the square wave implies a 50-100MHz bandwidth (give or take). This means the triangle wave as well. Otherwise there’s no point to the requirement on the square wave.

So, in a nutshell, you want a slightly modified fast pulse generator, with integrator output. The vintage ones from Philips and HP have schematics available. Good learning material for such circuits.

You’ll have to design a pair of current sources, and steer them with a switch that then drives a wideband integrator. A DC servo can keep the peaks centered around the desired mean voltage.

The current sources must be bootstrapped to the integrator output when they are “off”. That means both sources always drive current and always see the output voltage, but are either switched to the integrating capacitor or to the bootstrap buffer.

The bootstrap buffers will have to have an offset trim so that the transition from bootstrap to integrating capcitor induces a minimal glitch.

If you could relax the requirements by an order of magnitude (100ns/10MHz bandwidth ballpark) it’d not be too hard to do using fairly cheap parts and it should work on the first try.

Keeping the peaks down to better than 1mV stability is not hard. Measuring it to prove that’s the case - that’s much harder. Most oscilloscopes can’t quite do it, and a special gate circuit may be needed to keep the front-end from overranging.

• I wonder, is square generator plus integrator combo really the best way of doing this? It seems to require rather tight coupling of the integrator time constant to generator frequency. AFAIK it is usually done the other way around, triangle generator feeding the comparator to get a square. Which means triangle generator by itself can be even simpler circuit. Sep 25 at 18:01
• Any references to the Philips and HP have schematics, in regard to these would be of great help. Sep 26 at 5:52