Author Topic: MHz Triangle Oscillator Clipping  (Read 1459 times)

0 Members and 1 Guest are viewing this topic.

Offline IonforbesTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: gb
MHz Triangle Oscillator Clipping
« on: July 11, 2026, 09:51:46 pm »
Hello all,

I'm working on a class D amplifier with a goal of 2 MHz switching. Being a clocked PWM design, it needs a triangle oscillator. I came up with the attached circuit. It's just a timing capacitor, C53, charged by the emitter-coupled current sources TR7-5 and TR8-6. The comparator IC5 just sets the thresholds and steers the current sources to charge/discharge C53. Since the oscillation is between 1V and 3.2V, and the bases of TR5 and TR6 are at 4V and 1V respectively, and TR7 and TR8 are just emitter followers, the idea is that at no point do any transistors saturate.

Problem is, whilst it simulates well, once built there seems to be a 100ns delay in starting the downslope, which manifests as a 'cropped' top of the triangle wave. I've spent quite a while trying to debug, but am now stumped and think I need a second perspective!

The image 'comp_c53' shows C53 voltage (yellow) and the comparator output (blue). Clearly, the comparator is plenty fast, it's the current steering section which adds the 100ns delay after the falling edge if the comparator. This suggests the bottom couple TR8-6 are slow. I probed the emitter ends of R36 and R37 to get a view of emitter currents, and sure enough, whilst the top source TR7-5 cut off immediately, the bottom source seems to have a slowness (image 'emitters', R36 (yellow) and R37 (blue)). The image 'tr8' shows the base of TR8 (blue) and its emitter (yellow), which shows that, somehow, the emitter of TR8 is lagging its base. This is where I'm completely stuck. TR6's base is held at constant 1V, so should not be attempting to hold the common coupled emitter node high. TR8 is not saturated as the CB junction is nevver forward biased, so it shouldn't add so much delay. Once the base is driven to 0V, the emitter node should be pulled down by a 68 Ohm resistor, which is hardly gentle. And the BC848 is not a slow transistor, so I can't figure out where this slowness is coming from! Is there something I'm missing? p.s. all scope captures have 0V 2 div up from bottom of grid

Thanks, Ion
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #1 on: July 11, 2026, 11:52:57 pm »
At a guess TR8 is saturating, and delaying the switching, and both current sources are off together hence the flat top.
P.S. TR8, when on, is pulling about 65mA, seems excessive.
« Last Edit: July 12, 2026, 12:00:05 am by moffy »
 

Offline IonforbesTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: gb
Re: MHz Triangle Oscillator Clipping
« Reply #2 on: July 12, 2026, 12:18:37 am »
Does saturation require forward biasing of the collector-base junction? With TR8's collector tied to 5V, that should never happen and it'll just be a linear emitter follower. Also yes the current is quite high, bad design on my end. It's not portable so the power draw shouldn't matter
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #3 on: July 12, 2026, 12:55:50 am »
Does saturation require forward biasing of the collector-base junction? With TR8's collector tied to 5V, that should never happen and it'll just be a linear emitter follower. Also yes the current is quite high, bad design on my end. It's not portable so the power draw shouldn't matter
Yes, you are correct, but it sure looks like both current sources are off, try using a resistive divider with a speed up capacitor to drive TR8s base.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3358
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #4 on: July 12, 2026, 12:59:26 am »
Problem is, whilst it simulates well, once built there seems to be a 100ns delay in starting the downslope, which manifests as a 'cropped' top of the triangle wave.
That's quite a lot of off-current flow, plus transistors will struggle at 2MHz, as you find.
A diode bridge would be better, and will not have higher shunt currents.
 
The following users thanked this post: moffy

Offline IonforbesTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: gb
Re: MHz Triangle Oscillator Clipping
« Reply #5 on: July 12, 2026, 01:53:37 pm »
Thanks all for the input. I made the mistake of committing to a very tight SMD PCB without testing the circuit first, so I can't insert any parts in series connections. I did try adding a 330 pF base-smitter capacitor to TR8. Seems odd, but I thought that the AC coupling would allow the push-pull comparator to 'help' pull down the emitter resistor R37 on the negative edge. The attached pic shows R37 (yellow) and the comparator output/TR8 base (blue), and whilst the issue is obviously not done, it does reveal a bit. The emitter now does pull down a lot faster at first, but then at 2.4V it gets held up. So it's not just the 68 ohm resistor struggling to pull down the node, I suppose TR8 must be driving its emitter high. But it doesn't look like typical saturation delay, since it looks more like a gentle gradual slope down. Very confusing, especially since the top PNP sources work just fine. And I checked, any pin that's meant to be constant voltage is in fact constant and not dipping from edges. As a last attempt, I'll have to see if I can increase R37 so the current is low enough to be driven directly by the TLV3501, replace TR8 withy a diode, and live with the lower switching frequency
 
The following users thanked this post: moffy

Offline duak

  • Super Contributor
  • ***
  • Posts: 1052
  • Country: ca
Re: MHz Triangle Oscillator Clipping
« Reply #6 on: July 12, 2026, 08:19:08 pm »
I think the reason why the circuit works as it does is because the current mirrors are being switched, and in particular switched off overly hard, ie. the comparator output is rail-to-rail so the voltage swings at the emitters of the transistors will be on the order of a few volts.  Any excess voltage goes into charging various interelectrode capacitances which then have to be discharged in the complementary phase of the cycle. ECL gets its speed from a much smaller swing; something like +/- 100 mV.

It should be possible to add voltage dividers to establish more appropriate base voltages for TR7 and TR8 and not overdrive TR5 and TR6 but this will add parts.

Since the comparator output is RtoR, the B-E junctions of TR7 and TR8 could each be replaced with a series diode and resistor where the resistors are sized to divert sufficient current from TR5 and TR6.  The comparator data sheet shows that its output's absolute maximum current is 74 mA but doesn't show what the I-V characteristics are.  I calculate that the current mirrors operate at about 6.7 mA and should be within the comparator's output capability.

The Nexperia data sheets for the transistors don't show switching performance.  These devices have Ft(min) of 100 MHz and appear to be more appropriate for audio.  Something like 2N3904/6 with a 250 MHz Ft(typ) have turn on/storage/turn off of 100-200 ns.

IMHO, while this circuit could be made to work, it's best to not switch the current mirror inputs, rather, switch the outputs, ie. the collectors.
Here's a link to an article on this type of oscillator from Dennis Feucht, an ex-Tektronix engineer: https://www.edn.com/function-generator-circuit-concepts-part-2-current-source-function-generators-fgs/  The second figure shows a diode bridge switching the outputs from two current mirrors. The comparator is implented with discrete components.

A good bit of the existing circuit stays.  TR7 & TR8 are removed and a diode bridge is added between the collectors of TR5 & TR6 and the timing capacitor C53.  The diode bridge node opposite the timing capacitor is driven from the comparator output through a resistor sized to draw sufficient current from the current mirrors.

Hope this makes sense.

Cheers
« Last Edit: July 12, 2026, 08:22:15 pm by duak »
 
The following users thanked this post: oPossum

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3358
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #7 on: July 12, 2026, 10:17:23 pm »
Thanks all for the input. I made the mistake of committing to a very tight SMD PCB without testing the circuit first, so I can't insert any parts in series connections.
Ouch,
You may be able to salvage something, by a change from the storage-time prone aggressive voltage switching, to a more finesse of current steering approach.

This circuit takes care to not fully switch either current leg, so there are no large voltage deviations, or storage time effects.
Instead, it modulates the current between two settings and the cap sees the difference.
It does benefit from low C transistors, and for best linearity you want parts with flattest current slopes (Highest Hoe or highest early voltage, VAF)


In your circuit, you change TR7 TR8 for correct value current steering resistors, and voila.

Addit: added .ASC file of 3 test modules.

« Last Edit: July 14, 2026, 10:35:52 pm by PCB.Wiz »
 
The following users thanked this post: Someone

Offline moffy

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #8 on: July 12, 2026, 11:32:05 pm »
Ouch,
You may be able to salvage something, by a change from the storage-time prone aggressive voltage switching, to a more finesse of current steering approach.

This circuit takes care to not fully switch either current leg, so there are no large voltage deviations, or storage time effects.
Instead, it modulates the current between two settings and the cap sees the difference.
It does benefit from low C transistors, and for best linearity you want parts with flattest current slopes (Highest Hoe or highest early voltage, VAF)


In your circuit, you change TR7 TR8 for correct value current steering resistors, and voila.

That is a nice solution, as long as the comparator doesn't mind the load. It is fast as it maintains the emitter switching. :)
Just a note to the OP, TR8 does appear to be acting weirdly, maybe it is damaged, or I have experienced a case where I swaped the C and E, and the NPN worked as a transistor, but badly i.e. low gain, and low breakdown voltage that was current dependent.
 
The following users thanked this post: Someone

Offline w42i

  • Contributor
  • Posts: 22
  • Country: de
Re: MHz Triangle Oscillator Clipping
« Reply #9 on: July 13, 2026, 10:14:06 am »
Concepts for fast triangle waveform generators can also be found in: Dennis Feucht. Designing Waveform-Processing Circuits. Scitech Publishing, Inc., 2010. ISBN: 9781891121852
 

Offline IonforbesTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: gb
Re: MHz Triangle Oscillator Clipping
« Reply #10 on: July 13, 2026, 05:52:26 pm »
Thanks all! I ended up increasing R37, replaced TR8 with a diode (the SOD-523 conveniently fits across the B-E pins of a SOT-323/SC-70), and changed C53 so I got a nice 2.1 MHz oscillator. The slopes aren't equal, but that shouldn't matter since it's only a PWM comparator ramp. I'll have to use your solution PCB.Wiz in another revision. I'm new to current steering circuits so naively thought anything's fine so long as it doesn't saturate, even if it's slamming into rails. Your circuit is a lot gentler.

While I'm here I may as well share the rest of the circuit, for those interested. It's a full-bridge class D circuit using GaN FETs. My idea was that GaN's high switching frequency would let me have a high LC filter crossover, and so can have lots of loop gain at the upper audio band even with post-filter feedback. That way it I won't need a self-oscillating stage, which can be slightly dependent on speaker charactersitics. Admittedly a self-oscillating design would have better performance anyway, but that's beyond my design skills
 
The following users thanked this post: moffy

Offline moffy

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #11 on: July 13, 2026, 09:32:29 pm »
If using PCB.Wiz's circuit, I might suggest using a logic gate after the comparator to drive the resistors, a suitable logic family will add a small delay but the output should swing much closer to the supply rails.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 22437
  • Country: gb
  • 0999
Re: MHz Triangle Oscillator Clipping
« Reply #12 on: July 14, 2026, 08:22:32 pm »
Isn't this circuit a bit complicated?

Maybe just use the comparator to alter the biasing on the current sink/source.

And don't use the voltage on the capacitor as the output. Add a unity gain buffer.


 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3358
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #13 on: July 14, 2026, 10:33:34 pm »
Maybe just use the comparator to alter the biasing on the current sink/source.
That fully switches the transistors in voltage drive mode, so has current spikes and flat areas on the triangle wave, and slower current edges, not really suited to 2MHz Triangle.
The current-steering design in #7 has similar parts, but gives a much cleaner triangle wave.
 

Online sourcecharge

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: MHz Triangle Oscillator Clipping
« Reply #14 on: July 15, 2026, 12:14:47 am »
I'm curious, why don't you use a 555 (5MHz avaliable), a 4013, and a filter, then amplify it to your specfication?

Maybe because it has to do something with the class D amplifier?

I don't know, but it seems like you are over complicating it.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 22437
  • Country: gb
  • 0999
Re: MHz Triangle Oscillator Clipping
« Reply #15 on: July 15, 2026, 07:18:12 am »
Maybe just use the comparator to alter the biasing on the current sink/source.
That fully switches the transistors in voltage drive mode, so has current spikes and flat areas on the triangle wave, and slower current edges, not really suited to 2MHz Triangle.
The current-steering design in #7 has similar parts, but gives a much cleaner triangle wave.
What do you mean by voltage drive mode? The transistors never saturate.

I think the problem with my circuit is the transistors turn off, adding the storage time delay, which rounds the edges on the triangle waves.
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #16 on: July 15, 2026, 07:44:18 am »
Just a comment, PCB.Wiz's circuit is emitter switching with a low capacitance source, which gives a very clean rectangular current pulse, except for the Early Effect based output impedance. That can be corrected with some cascoding. Because it is emitter switched it is very fast. Zero999's circuit because of the base drive will be slower, but some speed up caps could help some.
« Last Edit: July 15, 2026, 07:46:36 am by moffy »
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3358
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #17 on: July 15, 2026, 09:10:21 am »
What do you mean by voltage drive mode? The transistors never saturate.
I think the problem with my circuit is the transistors turn off, adding the storage time delay, which rounds the edges on the triangle waves.

In your circuit the base voltage swings 1.662V, whilst the current injection/steering version has a fixed, low impedance base, and the emitter voltage changes only 53mV.
That large voltage drive also results in artifacts:
The current into C1 first pulses the 'wrong way' due to C-B capacitance, and then the transistor gradually turns on, and current rises to a somewhat stable but also rounded plateau.

2MHz is quite high, but it looks like available opamps in 2026 might be practical for doing this using an OpAmp integrator and comparator.
The higher the MHz of the opamp, the lower the signal on the differential pins, and the more ideal the triangle becomes.
If linearity really matters, you can use a second opamp to apply some slope injection correction
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3358
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #18 on: July 15, 2026, 09:15:17 am »
Just a comment, PCB.Wiz's circuit is emitter switching with a low capacitance source, which gives a very clean rectangular current pulse, except for the Early Effect based output impedance. That can be corrected with some cascoding. Because it is emitter switched it is very fast. Zero999's circuit because of the base drive will be slower, but some speed up caps could help some.
Yes, but at 5V there is not much headroom for cascode, and the low base impedance looks to help increase the output impedance.
If someone was really worried about very good linearity, a fast OpAmp looks to give better results.
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: au
Re: MHz Triangle Oscillator Clipping
« Reply #19 on: July 15, 2026, 11:07:44 am »
Just a comment, PCB.Wiz's circuit is emitter switching with a low capacitance source, which gives a very clean rectangular current pulse, except for the Early Effect based output impedance. That can be corrected with some cascoding. Because it is emitter switched it is very fast. Zero999's circuit because of the base drive will be slower, but some speed up caps could help some.
Yes, but at 5V there is not much headroom for cascode, and the low base impedance looks to help increase the output impedance.
If someone was really worried about very good linearity, a fast OpAmp looks to give better results.

If you wanted cascode it would be best to increase the supply voltage, just pointing out that there is a way to deal with the output impedance.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->