General Category > Amstrad CPC hardware

Understanding Retro Electronics

(1/8) > >>

Bryce:
Hi all,
     as there are several users here that are starting out in electronics, I thought I'd mention this here. Dave over on the EEVBlog has just posted a short tutorial video explaining the basics of logic gates and boolean algebra. For anyone looking to understand how their CPC works, this is one of the basics which needs to be understood, so if you have 30 Minutes to spare, it's well worth watching: https://www.eevblog.com/2017/03/24/eevblog-981-introduction-to-digital-logic/

Bryce.

Edit: Maybe I should make this a "sticky" thread and I will add further useful videos and documents that I know of.
 

Bryce:
Hi all,
     just recently I've been asked the same or similar questions by several new electronics enthusiasts, who've usually just bought their first oscilloscope. So I thought I'd do a short electronics tutorial to explain the situation. So what's the question:

Why is the square wave clock signal in my CPC not square?

The answer to this is a mixture of several factors, so here's a basic explanation:

Harmonics
Most square waves aren't perfectly square to start with. They are the sum of a bunch of sine waves. The fundamental frequency (16Mhz in the case of the CPC clock) plus many harmonics of that frequency. Harmonics are signals which are a multiple of the fundamental frequency, so for example with the CPC clock:

Fundamental Frequency = 16Mhz
2nd Harmonic = 32Mhz
3rd Harmonic = 48Mhz
4th Harmonic = 64Mhz
5th Harmonic = 80Mhz and so on...

This is what a real square wave (40Mhz) looks like on a Spectrum Analyser. You can clearly see the fundamental frequency (1) and it's associated harmonics right up to 500Mhz.



Bryce_40MHZHarmonics.png
(21.19 kB, 800x480 - viewed 1223 times)


From the diagram below (only showing uneven harmonics) you can see that by adding all the harmonics together, you get a rough square wave. Each harmonic is or should be (if you haven't messed up your design) a little lower in amplitude than the frequency before it. The more harmonics you include, the more defined the square wave becomes. The edges get steeper and the top line becomes straighter. So this mixture of frequencies, not just a simple square wave, is what your oscilloscope is actually trying to measure.



Bryce_SWHarmonics.png
(11.64 kB, 640x420 - viewed 1265 times)


Scope issues
So let's assume your shiny new scope has a bandwidth of approx. 60Mhz (the stated bandwidth is never exact). On the CPC clock, your scope will effectively be showing you the sum of the fundamental frequency plus the harmonics up to the 4th (64Mhz), but all further harmonics are too high a frequency for your scope to handle (or will be seriously attenuated). As seen in the diagram above, this isn't enough to give a well defined square wave. This also answers another frequently asked question: Why do I need a 100Mhz scope if I only intend measuring signals up to 16Mhz? ...well that's why. For sine waves the stated bandwidth is what you can accurately measure with the scope, but for square waves you need to be able to measure higher frequencies than the square waves fundamental frequency to get an accurate picture. You can test this effect on your scope by switching on/off the 20Mhz bandwidth limit. This will show you the effect that ignoring the upper frequencies has on the displayed shape.

The next issue is what's known as the rise time of the scope. Every scope has a certain rise time, ie: how fast the scope can keep up with a sharp signal rise. Even if your scope is able to handle higher frequencies, it may not be able to react to them. The very popular Rigol low-cost scopes have a rise time of about 3.5ns, so even if your scope has the bandwidth to capture lots of harmonics and you are measuring an ideal square wave with really sharp edges, the scope will show a 3,5ns slope on either side because that's the fastest it can update.
The last scope issue only applies to digital scopes. Older analogue scopes took the entire raw signal and fed it to the CRT. Newer digital scopes take samples of the signal at certain intervals and average out what happened in between the samples. So the more samples your scope can take per second, the more accurate the displayed square wave will be. However, even low-cost scopes such as the Rigol now offer at least 1GSa/s, which means that a 16Mhz signal is sampled around 62 times per wave which is more than enough to give an accurate picture.

Here's a look at a 4Mhz square wave on a 100Mhz scope. The square is relatively accurate because it can capture up to the 25th harmonic.



Bryce_4Mscope.png
(31.56 kB, 800x480 - viewed 1265 times)


Now a 40Mhz square wave, where effectively, the scope is only able to display the sum of the fundamental frequency and its 2nd harmonic.



Bryce_40Mscope.png
(34 kB, 800x480 - viewed 1231 times)


So... If I broke the bank, sold the wife and bought myself a >€200K 9Ghz 10GSa/s HP Agilent Keysight scope would I then see a perfect square wave? The answer is sadly still no.
For the same reason your scope couldn't show a perfect square wave, the electronics in your CPC wasn't able to produce one in the first place. The transistors that make up the clock circuitry also have their limits when it comes to the frequencies they can handle. They also have limits to the time they need to switch on or off. Additional problems such as capacitance in the tracks of the PCB will mean that even the best intentioned square wave will have been considerably rounded off due to these factors. In extremely high speed systems, very expensive parts are needed to be able to create accurate clock signals at extremely high frequencies and even the PCB track layout will be optomised to reduce capacitance.

But my $2 Chinese logic analyser shows me a perfectly square clock signal!
Of course it does. Logic analysers only measure the voltage at intervals and display them as high or low depending on the reading. Then they draw a vertical line between the high/low dashes. This isn't a representation of what the wave looks like, just a digital state readout.

So does it matter that my clock signal is all curvy?
Usually not. The clock really only has two states, on (1) or off (0). The electronics doesn't really care whether it's rounded or not. All that matters are the two thresholds for 0 and 1. As long as the clock is going below the voltage threshold for a 0 and above the threshold for a 1 at the correct frequency and the duty-cycle (high/low ratio) is approx. 50%, it is doing its job properly. The only time the waveform shape is critical is if a single waveform was somehow crossing the thresholds more than once per cycle, if the clock wasn't crossing one of the thresholds at all, or if the clock had "jitter" (the wave length of each wave was varying). To counter act multiple crossings, designers will usually use gates with hysterisis (known as Schmitt Triggers) to filter out the unintended crossing.



Bryce_RealSW.png
(17.55 kB, 640x420 - viewed 1249 times)


I hope that explained a bit about reading digital signals with a scope. Questions are of course welcome.

Bryce.

Further reading[/attach][/attach]

keith56:
Fascinating post! I've been watching many of the eevblog videos recently, and am planning to buy an oscillosocpe soon, so your post has no doubt saved me a lot of time and confusion!

I'd be interested in seeing other posts or links to other tutorials on fault finding 1980's type hardware.

||C|-|E||:
Great great contribution! Thanks!!  :-*

mr_lou:
Can't be long now before you've written enough material like this to gather it all into a CPC Electronics book.....

Navigation

[0] Message Index

[#] Next page

Go to full version
Powered by SMFPacks Media Embedder
Powered by SMFPacks Alerts Pro Mod
Powered by SMFPacks Mentions Pro Mod