# [time-nuts] sine to square wave circuits

Magnus Danielson magnus at rubidium.dyndns.org
Fri Oct 6 18:24:10 EDT 2017

```Hi,0

On 10/04/2017 11:09 PM, Attila Kinali wrote:
> On Wed, 4 Oct 2017 16:44:17 +0100
> Dave B via time-nuts <time-nuts at febo.com> wrote:
>
>> Silly question, and forgive my ignorance.
>
> It's not silly at all. It took me some time to understand it...
> well... understand more of it. I'm far from understanding noise
> and how it propagates through a circuit.
>
> Disclaimer: What follows is what I think is true. It might not be.
> If I am wrong, please correct me.
>
>> But, why is a simple two transistor discrete Schmitt trigger circuit no
>> good for this purpose?
>>
>> 10MHz is not a problem, so what is bad about it?
>
> First of all, you need a bit of understanding about amplifiers
> and noise. Rodolphe and Enrico provide a nice introduction about it
> in [1]. Summarizing you have two forms of noise that matter: white
> noise and flicker noise. White noise is what we call the noise floor
> and is there from DC up to optical frequncies. The contribution of
> white noise to jitter is dependent on its power relative to the signal
> power. Ie the SNR defines your ultimate jitter performance. Every
> amplifier adds a bit of white noise. What we call the noise figure
> is the amount by which the SNR decreases due to the amplifier.
> Today, most amplifier circuits are in the order of 0.5dB and 5dB.
> Which means that the jitter increases by a factor of 1.06 (ie 6%
> increase) to a factor of 2 (100% increase). This calculation is
> made under the assumption that the amplifier is linear. Ie that
> there are no higher order terms in the Taylor expansion. This
> is not generally true, but a good approximation for a well designed
> amplifier. In case the non-linearities (higher order terms) cannot
> be neglected, these can contribute to a higher level of white noise
> than the noise figure of the amplifier would suggest and it becomes
> also signal level dependent (this is, at least partially, due to
> AM to PM noise conversion). What's nice about white noise is that
> you can filter it. Because your signal is at a well known frequency
> (assuming it's sine) and white noise is everyhwere, you can filter
> out that bit where it's everywhere else.
>
> Flicker noise is the other big contributor to jitter. It originates
> from noise close to DC that is upconverted by the non-linearity to
> the signal frequency. Even small non-linearities will lead to this
> upconversion, which means it cannot be completely avoided, only
> limited by keeping the non-linearities small.
>
> The problem with a Schmitt Trigger is its high gain with bad noise
> figure and a highly non-linear circuit. The positive feedback
> loop that the Schmitt Trigger has will feed back noise, that came
> from the input, was amplified through the amplifier stage, amplified
> again through the feedback stage, into the input. Describing it this
> way it is easy to see that the noise of a high gain amplifier with
> a positive feedback is even higher than what you would expect from
> a normal, feed-forward only amplifier. Additionally, the positive
> feedback is so high, that the Schmitt Trigger exhibits strong
> non-linear behaviour, as it snapps-in to the new value.
> Ie 1/f noise close to DC will be upconverted to signal frequency in
> addition to having increased noise figure for white noise.
> Another way to look at this is by seeing the signal as it crosses
> through the switchig point of the Schmitt Triger. The amplitude noise
> on the signal will cause the Schmitt Trigger to switch earlier or later
> depending on whether the noise increases or decreases the slope of the
> signal. And once the Schmitt Trigger switches, there is no going back.
> Ie AM noise becomes PM noise.
>
> Very much simplified, this boils down to: Hysteresis is bad!
> A little bit less simplified, the sine to square wave converter
> should be a circuit that works as much in the linear region as
> possible, especially close to the zero crossing point.
>
> Now, to answer the question itself: A simple inverter is a
> class B amplifiers with a gain of 10dB to 30dB (for todays CMOS
> processes, I don't know the values for HC/AC/...etc). The packaged
> "single chip" inverters are usually a chain of those inverters.
> Ie we have a very high gain, but at the same time, the amplifier
> saturates quickly. These amplifiers are not optimized for noise,
> but for high gain and high slew rate (ok, not really, but that's
> what the design boils down to) and exhibit relatively high non-linear
> behaviour even close to the switch point. But even though they are not
> optimized for noise and are non-linear, they are still "more linear"
> than a Schmitt Trigger as there is no hard-switching with no way
> back, but a regular amplification.

Too much theory. It is much simpler.

The wide-band white noise will modulate the amplitude, and as the slope
progresses towards the trigger point, it can modulate the trigger point
in time. How much time depend on the slew-rate at and near the trigger
point, and the amount of jitter is t_n = e_n / S where e_n is RMS noise
amplitude in V, S is slewrate in V/s and t_n is time jitter in s.

The Schmitt trigger does not help to "remove jitter", it helps to remove
unnecessary bouncing. After a comparator or Schmitt trigger has
triggered out of time, you cannot "heal" the signal directly, it now has
that jitter.

A linear amplifier, or at least acting linear near the trigger point,
can increase the slew-rate enough without adding too much noise.
Eventually the slew-rate of the signal will be quick enough that a
comparator can finalize the squaring without causing excess jitter.

Cheers,
Magnus
```