DOWN THE APPLE CASSETTE INTERFACE RABBIT HOLE

11 posts / 0 new
Last post
Offline
Last seen: 1 day 16 hours ago
Joined: Apr 1 2020 - 16:46
Posts: 999
DOWN THE APPLE CASSETTE INTERFACE RABBIT HOLE

Hi fans !

 

As some of you might know, your "Uncle Bernie" has been on a crusade for a year (or so) to root out the problems with the notorious Apple Cassette Interface (aka "ACI") once and for all. Religious people may see this as a holy mission to drive out the demons lurking in that piece, but this is tongue-in-cheek as no demon can possess a dead piece of hardware. Scripture teaches that only living beings - humans or animals - can be possessed by demons (so many of the Stephen King horror novels got it wrong). But I mention this demon topic for an allegoric reason: despite being a seasoned analog / mixed signal designer who believes in Laws Of Physics, so there must be an explanation for the "evils" in the ACI based on science and engineering, but it turned out to be a hard nut to crack for anyone who really wants to understand what really is wrong with it. It would be easier to say it's due to "demons" and then pursue some other, more rewarding goals in life. There certainly are no laurels to be earned by fixing a 47 year old cassette interface design. Besides the fact that real cassette recorders are almost extinct. But being retired, and having no real purpose in life anymore, I need to pick some windmills to fight like Don Quixote. The notorious ACI is one of these windmills.

 

PREFACE (the historical background, you can skip to my upcoming next post in this thread unless really interested) 

 

So in the past, some progress was made. I wrote an additional firmware page (256 bytes) which has additional functions (such as the Apple II style checksum for recordings) and I fixed the volume indicator LED circuit. The "extended format" PROMs have been in my IC kits since a year now, but to get the benefits, Apple-1 builders had to cut some traces and add some wires, which is despised by some, so I also made a PCB revision which includes these mods, and I gave away the leftover PCBs as a bonus with my recent kits (now they are gone, none left). Here are some links on how all this looks and works:

 

See Post #9 and #16 of this thread: 

 

https://www.applefritter.com/content/uncle-bernies-improved-apple-1-cassette-interface

 

... and here is an example what you can do with these mods:

 

https://www.applefritter.com/content/can-improved-aci-load-4kbyte-apple-basic-2-seconds

 

But alas, all this work, despite bringing improvements, did not really get to the bottom of the ACI rabbit hole. I had hopes that the modified PCB would allow me to reduce the hysteresis to the level seen in the Apple II cassette interface. Alas, this was not possible despite I had added a high performance, modern, SMD, power supply bypass capacitor right at the LM311 comparator. This measure brought some improvement but not enough: it allowed to reduce the hysteresis by half, but not to a third of what would be needed. So I got a big "F" - FAIL - like in school. (BTW, the  most traumatizing experience in my whole life --- if I had children I would never, ever send them to school - home schooling is the way !)

 

You might ask why I did not see the problem with the hysteresis reduction, before I made the PCB mod. Well, reduction of the hysteresis was not the target objective of that "Gen 1" ACI PCB mod, so I never tried hysteresis reduction before I sent the PCB layout for production. Also, manually adding power supply bypass capacitors to any circuit in an attempt to improve its robustness is a hit-and-miss endavour. The leads of these capacitors are inductors in the nH range and these will impair the effectiveness of the mod. It happens to work with the "reliability mods" I have published to fix the DRAM reliability problem in the Apple-1, see here:

 

https://www.applefritter.com/content/part-path-towards-rock-solid-apple-1-builds

 

... but this success can't be generalized. I have seen cases in my professional realm that adding bypass capacitors actually made matters worse (and I know why). The whole topic is extremely complex and the industry has spent lots of money (10's of millions of US$ at least, if not billions) to get a handle on this issue.

 

The problem boils down to this: any power supply grid on any PCB is a resonant LCR network. The digital ICs sitting on this network produce current spikes when switching / being clocked. These current spikes may incite the whole LCR network to resonate. If you happen to hit a resonance frequency, the power supplies / ground rails may oscillate enough to crash the whole system. Bad !

 

This phenomenon even extends into the microscopic world of ICs --- such as PC CPUs. Less experienced IC designers think that just generously adding enough power supply bypass MIM capacitors in the IC will make it work. A fallacy. The whole power supply grid needs to be properly modelled and simulated. This is a multi million US$ CAD boondoggle and lots of money is still flowing into that dark hole.

 

A typical remedy is to add "spoiler tank circuits" which comprise integrated inductors, resistors, and capacitors. They are tailored to ruin resonance effects in the larger network. A mechanical analogy is the dual mass pulleys you can find on some car engines. These are made out of two parts bonded together by a rubber insert. The rubber element provides the damping (a resistor). And some springyness - an inductor. The outer rim of that pulley is a mass - a capacitor - completing the spring / mass system. The electrical equivalent is a LCR spoiler tank circuit.

Now here is how this trick works: the whole dual mass pulley is bolted to the crankshaft. The crankshaft may have a critical resonance where the engine would blow up. The dual mass pulley dynamic subsystem is tuned such that near the critical resonance frequency of the crank shaft it will start to resonate itself and drain resonant energy from the crankshaft. So the crankshaft oscillation gets dampened. I once had such a car and when driving it at 135 mph in top gear and flat down there was a woiiiig-woiiig-woiiing sound from the engine and that is how the dual mass pulley dampend the crankshaft oscillations down to a harmless level. Otherwise I would probably not be here to tell the story because the engine would have exploded !

 

I told you this to show you that engineering is a very interesting profession. Once you grasp the basic concepts, you can see them being applied everywhere. Heck, even in tall buildings the architects put in "resonance spoilers" such as large swinging pendulum masses somewhere in the top levels. Without them the right wind speed could make the skyscraper oscillate at its resonant frequency and the building would collapse. As far as I am concerned I would not want to be near any such building. Because I know the math of such a dynamic system. Under certain circumstances, its response may become chaotic, and then all bets are off. Hopefully Mr. Architect has checked the math thoroughly and it was not done by H1B slaves hired from third world countries. Where you can buy your M.S. or Ph.D. for a pittance. Maybe I'll buy myself a Ph.D. from there, too, if it's cheap enough (I'm a cheapskate). To be able to brag. Like Saul Goodman (of "Breaking Bad") proudly displayed his law certificate from some dubious university in American Samoa, an American Territory. Oh, I got my divorce cheaply in another American Territory, Guam. Seriously. What an awesome deal ! The airfare was more than the lawyer fees ! The parasitic lawyer here in Colorado Springs wanted a higher retainer (!) alone than the whole Guam divorce did cost me, including airfare, hotel, lawyer, etc. And I got a real divorce certificate from the Superior Court of Guam ! No American can brag to have gotten a divorce certificate from any "Superior Court" here in the continental U.S. ! No "sworn financial statements" needed in Guam, either ! You don't want your financials being part of a court record, ever ! So if you want to get rid of your trophy wife, go Guam !

 

But enough of that. The point I wanted to make is that once power supply noise / resonance effects get their fingers in the pie, things get complicated. And not easy to analyze. So I avoided to waste my RQLT on these effects in the ACI until I had the final PCB in hand. Which, alas, turned out not the the final one. Because it did not allow the reduction of the hysteresis down to the level I wanted.

 

You might ask why I want to get the hysteresis down to Apple II levels. The reason is - compatibility.

I want the same characteristics in the Apple-1 ACI card as seen in the Apple II cassette recorder interface. Which was good enough to satisfy the Apple II users for a full year until the famous Disk II system came out. If the Apple II cassette interface had been as bad as the notorious Apple-1 ACI, there would be no Apple (nowadays one of the most valuable corporations in the world). Angry customers would have torn them down and maybe set their headquarters on fire, who knows. But as we all know this did not happen. Because the Apple II cassette interface was certainly "good enough".

 

This is where I want to get with the improved Apple-1 ACI. I think I can reach this goal based on my Gen 2 ACI cards, which currently are in lab evaluations. But, man, the journey was a strange one. It all begins with analyzing the Apple II cassette interface, which is similar, but distinct from the ACI of the Apple-1. Other than the TAPE IN circuit and the checksum lacking in the Apple-1 recordings they are much the same. The encoding / modulation method is the same. You can actually read any Apple-1 tape recording on the Apple II and vice versa - except when reading on the Apple II, you have to ignore the missing checksum stalling the read or the checksum error which might appear or not. My "extended format" PROMs for the Apple-1 ACI cure the checksum problem, though.

 

The tape storage systems on both machines are so similar in terms of hardware and software that it is mind boggling to see how the Apple II system succeeds to satisfy the user while the Apple-1 ACI drives the user nuts and makes him/her want to smash everything with a sledge hammer. In my following posts in this thread I will show you why.

 

Stay tuned !

 

(And please don't comment until you saw my next post !)

fingerz's picture
Offline
Last seen: 2 months 4 weeks ago
Joined: Aug 10 2017 - 13:40
Posts: 173
Oh, I got my divorce cheaply
fingerz's picture
Offline
Last seen: 2 months 4 weeks ago
Joined: Aug 10 2017 - 13:40
Posts: 173
So if you want to get rid of

So if you want to get rid of your trophy wife, go Guam ! 

My wife is from Guam! LOL

Offline
Last seen: 1 day 16 hours ago
Joined: Apr 1 2020 - 16:46
Posts: 999
A bit off topic ...

... in post #3, fingerz wrote:

 

"My wife is from Guam! LOL"

 

Uncle Bernie comments:

 

Good laugh ! Seems you're as drunk as I am am now. Evidence: you needed two attempts to post your story about your Guam wife.

Fine. The Guam ladies really are cute when they are < 35 yrs of age. But no way they would want to marry me (I'm too old). --- I'm still looking for an all American country girl to give me some babies. In 15-20 yrs I'd be 6 ft under and she would get all the millions - which might be worthless in year 2040.

What a scam courtesy of the Federal Reserve.

 

Other than that, I'll keep posting worthless information about the Apple-1 in this forum. And BTW, here is my favorite band:

 

https://www.youtube.com/watch?v=QxIWDmmqZzY

 

Just now I'm lis'ning to them. From the great internet - most optical networking trunks of the worldwide internet use my patents - and all I got, by law, from all the litigations you never heard of was a measly $25000 cut. Enough to run a private jet for 10 hours or so. F*ck them. F*ck them all. F*ck 'em greedy corporations I slaved for.

 

And about the band - they flew to their death in a dubious airplane - which should have long been scrapped - with an idiot crew. Never, ever do this. This why I always fly myself. With my own airplane.

 

- Uncle Bernie

Macintosh_nik's picture
Online
Last seen: 38 min 12 sec ago
Joined: Jan 8 2021 - 05:18
Posts: 466
Hi Uncle Bernie!

I read with great interest the news about your new ACI card. Although you asked not to comment, I will still say that I'm ready to be your beta tester or something else to help. And I'm not a drinker.

Offline
Last seen: 1 day 16 hours ago
Joined: Apr 1 2020 - 16:46
Posts: 999
Down the ACI Rabbit Hole - Part 2: The Apple II TAPE IN circuit

I think the best way towards understanding what is wrong with ACI (the Apple-1 card) is to examine an example that works - the cassette interface TAPE IN circuit as found in the Apple II.

 

Everything else (like the TAPE OUT circuit), the modulation method, the firmware, is much same for both systems, except that the Apple II cassette firmware writes and checks a checksum in each recording block. Which  can't be done with a mere 256 Bytes of PROM available on the ACI card. With my "extended format" PROMs of 512 Bytes, an Apple II compatible checksum is available for the Apple-1 ACI, among other goodies. The problems lurk in the TAPE IN circuit. Here is the one for the early Apple II:

 

 

It uses less components than the TAPE IN circuit of the Apple-1 ACI and still works more reliably.

 

I do not know if anybody out there really is interested how this circuit works, but for those who are interested and can't see it immediately, here is a simplified discussion, which is aimed at the electronics hobbyist, and be warned, it got much longer than I intended. Electronics professionals don't need to read the following to understand how the above circuit works. Hobbyists wanting to "know more" may find it useful. 

 

CIRCUIT DESCRIPTION

 

The active element in this circuit is the 741 opamp being used as a comparator. The AC signal from the TAPE IN jack (the round thing to the left) is coupled to the inverting input, pin #2, of the type 741 opamp via a series connection of a 100 nF capacitor and a 12 kOhm resistor. Another 12 kOhm resistor from pin #2 to circuit ground establishes the DC operating point for that input at 0V. Since the 741 has NPN  BJTs at its inputs, this means that it must be run from a negative power supply: the  reason for the -5V. Which is a fundamental drawback of this circuit: it can't be used in any modern replica of the Apple-1 or Apple II that does not have a negative supply voltage. For the real Apple II of course this does not matter at all.

 

The noninverting input of the 741, pin #3, also has a 12 kOhm resistor to ground to establish the same DC operating point near 0V - except that the 1 MegOhm resistor from this input to the 741 output, pin #6, can wiggle the operating point at the noninverting input a little bit up and down, depending on whether the output of the opamp is at a positive or negative voltage referred to circuit ground / 0V.

 

Note that the output of a 741 type opamp can't swing "rail-to-rail" as more modern opamps can do. This means that the voltage at the output can never reach the +5V or -5V power supply rail voltages. Alas, this is where things get a bit fishy, because each 741 may be different (due to process tolerances). So your mileage may vary. On the 741 of the above schematic I measured an output swing from -2.84V to +4.5V, but in my PC48 Apple II clone I measured -2.82V to +4.54V, similar enough. In a real Apple IIe I measured an output swing of -3.16V to +4.36V, before something in the switchmode power supply exploded and made it spill nasty stinking smoke out. Yikes ! And another one bites the dust ... and I lost the opportunity to measure the supply voltages it had, forever.  Should have done that first. The key point here is that  if, say, the +5V rail voltage is a bit lower than that, the possible output swing at the 741 varies accordingly. So I can't say if the above difference came from the power supplies being off or from the different IC.

 

This said, if you want to do these measurements in your own machine, don't expect to get exactly the same numbers as I got. Just as a sidenote, the Apple IIe uses the same TAPE IN circuit as the Apple II  does, but uses a MC1458 dual opamp instead, so the pin numbers are different from the 741: for the opamp we are interested in, the output is at pin #1, but the inputs at pins #2 and #3 are the same as with the 741. According to the MC1458 datasheet, which can be found on the internet, this thing essentially has two 741 in one DIL-8 package (on one die of course), except there are no pins to trim the offset (the 741 has those).

 

Now back to the circuit description. The 12 kOhm and 1 MegOhm resistor work together to produce the hysteresis in the comparator, this is done by "positive feedback".

See the "+" sign on the noninverting input ? To which the output feeds back ? See, easy as that. Positive feedback !

 

Now to calculate the hysteresis, we analyze the 1 MegOhm / 12k Ohm resistive divider. Conveniently, the  12 kOhm resistor is tied to circuit ground, 0V. So it's super easy: the divider ratio is 12/1012 = 0.01186 (last digit rounded up). Multiply the two boundary output voltages with this number to get the boundary input voltages at the noninverting input: -2.82V * 0.01186 = -33.4mV and +4.54V * 0.01186 = +53.8mV. Total hysteresis as seen on the opamp: 53.8mV + 33.4mV = 87.2mV.

 

This is the hysteresis as seen at the opamp. When its output swings from -2.82V to +4.54V, the noninverting input swings from -33.4mV to +53.8mV. This sets the two trip points of the comparator (a hysteretic comparator always has two trip points. A comparator with no hysteresis tends to oscilllate in the vicinity of the one trip point it has --- no good ! And just as a warning for beginners: you can't see this ill effect in SPICE simulations unless you add all the relevant invisible components which are not in the schematic ;-)

 

HOW THE HYSTERESIS WORKS IN THIS CIRCUIT

 

To see how this hysteresis works, assume the input signal at the inverting input is +100mV. Since this is higher than any of the two possible voltage extremes at the noninverting input, the opamp sees a negative differential input voltage --- internally it calculates V(pin#3) - V(pin#2)  --- and drives its output to the negative extreme it can do, -2.82V, and we know from the above analysis that in this case the noninverting input will be at -33.4 mV.

 

Now assume that the inverting input (normally driven by a signal generator or the cassette recorder, but for this thought experiment the voltage magically appears) falls from +100mV to exactly -33.4mV. In the ideal case (no offset voltages), the opamp will see a input voltage difference of zero volts, and, consequently, start moving its output towards zero volts.

 

This move begins with the output slammed at -2.82V, remember ? So what happens if it moves, say, from -2.82V to -2.80V ? Remember the resistive divider ? The noninverting input will move, too: -2.80V * 0.01186 = -33.2mV, which is 0.2mV higher than it was before. But the inverting input still is at -33.4mV, remember ? The differential input voltage of the opamp suddenly became positive: (-33.2mV) - (-33.4mV) = +0.2mV --- done by the opamp itself. Since the ideal opamp has infinite gain, it now wants to output the highest positive voltage it can do, which is +4.54V. Again, remember the resistive divider ? When the opamp output reaches its maximum at +4.54V, the noninverting input will reach +53.8mV, and all this happens while the input signal at the inverting input still is exactly at -33.4mV ! It did not need to move any further ! Fascinating, isn't it ? 

So, once the trip point is reached at the noninverting input, and the output starts moving upwards, it never stops moving until it slams into its upper limit, and nothing can stop that process until that point. In this ideal case, of course. Note that during the whole time, beginning with the output moving ever so little, the voltage at the noninverting input increases all the time ... so the differential input voltage of the opamp also always increases and the driving force in the process grows and grows.

Like an avalanche grows. Or the momentum of a runaway train or car with no brakes going downhill grows. Nothing can stop it once it's set in motion. Except for the inevitable event when limits are hit. In the comparator circuit, nothing bad will happen, the output voltage will just slam into its maximum limit the opamp can do, and the motion stops. In case of the train or car, bad things can happen, of course. But you get the idea.

 

Hope you now have understood how positive feedback works in this comparator. The second part  (so far we only discussed half of the hysteresis action) I leave for you as a mental exercise.  To start, assume the inverting input still sits at -33.4mV and the output is slammed to +4.54V and then describe how the voltage at the inverting input must move to flip the comparator back, and at which input voltage that would happen. 

 

A FEW FINE POINTS

 

So far the discussion of the comparator circuit. I have intentionally left out a few fine points to avoid confusion. The above is difficult enough to grasp for most people not being electronics engineers. A runaway train opamp ... unstoppable once set in motion ... weird.

 

Here are three of the fine points (for those who are interested):

 

First, the input circuit from the TAPE IN jack to the inverting input (pin #2) form a high pass filter with a corner frequency of 66.3 Hz, close enough to the 60 Hz line frequency used in the USA to suspect some intention behind this component sizing. Alas, the damping factor at this corner frequency is only 0.707 (-3 db) so it won't be efficient against that hum, if such a hum would infest the TAPE IN signal. At the actual modulation frequencies of 1 kHz and 2 kHz for the digital data stream the high pass frequency transfer function is already almost flat (only 0.014 dB difference between the two) so it can be ignored for any practical purposes. Obviously, no tailoring of the frequency transfer function at the modulation frequencies was attempted.

 

Second, the input circuit acts as a voltage divider / attenuator for any input signal. To simplify, assume the capacitor is not there, and then you can see the plain vanilla voltage divider with coefficient 0.5 (or, a -6dB attenuation). This is valid for all signals sufficiently above the corner frequency of the high pass filter even when the capacitor is put back. One important consequence of this attenuator is that the input signal referred hysteresis is twice of what is the hysteresis on the comparator itself, or 2 x 87.2mV = 174.4mV ... the original Apple-1 ACI circuit has ~460 mV of input signal referred hysteresis, 2.6 times that, but you can't get there (by increasing the 47 kOhm resistor to 120 kOhm, you can try, but the ACI won't work anymore, as increasing that resistor would awaken the "demon" before you get there). This large hysteresis is the reason  why the original ACI needs high volume settings (unfit for human ears) to make it work.  

 

Third, the reason for the peculiar 12 kOhm series resistor at the output. Remember the output will swing to negative voltages ? TTL inputs don't like that: plain vanilla TTL has parasitic substrate diodes there, and all the Schottky TTL (74LSxxx and 74Sxxx) have intentionally added Schottky clamping diodes there. Any sufficiently negative voltage on such an input respective to the local GND (0V) pin of the TTL will open these diodes and so the 741 will fight with that diode in that TTL until one of them will give up the holy smoke. The clamping effect also would sabotage the full development of the desired hysteresis. The 12k series resistor prevents this fight and limits the current drawn out of the TTL input to harmless levels.

 

So, all the components in that comparator circuit have been discussed. The other components seen in the schematic belong to the trivial TAPE OUT circuit we can ignore.

 

The only open question is why the hell did these guys use an opamp in lieu of a real comparator ? The LM311 in the Apple-1 ACI is such a real comparator and its PNP inputs would allow it to work without any negative supply voltage. The Gen 1 PCB does that and it works !

We can answer this question only after looking at the gory details of the ill effects in the above circuit. This will be the topic of my next post in this thread.

 

SOME QUESTIONS RISED ABOVE ANSWERED

 

Oh, and to answer macintosh_nik's questions and concerns in his post #5: I'm no drinker either. But after the heroic fight saving my trees and shrubs from breakage due to the heavy snow we got that night, the "Famous Grouse" was the right medicine against all the pain inflicted on me by that hard manual labor and awkward acrobatic movements I'm not used to. It took until 2 AM in the morning to be able to lay down in bed and get some sleep. Only one tree lost a branch. 

 

Oh, and the Gen 2 PCB - if successful - will be made available to the Apple-1 user community.

 

I will present it in this thread later. But I don't think that with Gen 2 I will have all too many empty PCBs from the prototype run left over. The Gen 1 basically was a tried-and-true concept implementing the already known fixes and mods I've published in the "Improved ACI thread". So I had to build only two examples to try it out, and could make the other 28 PCBs available to builders worldwide (now all Gen 1 PCBs are gone, except one that is spoken for, and it's a lab rat).

 

The Gen 2 PCB is a heavily modified, yet untested platform, and there are five (!) different options and different circuits that can be implemented on that PCB. All these must be built, optimum sizing of the added components experimentally found, and then measured both in the lab and in various Apple-1 for the key performance criteria I want to achieve with it. 

 

One of the five circuit options is the Gen 1 circuit implemented on the Gen 2 PCB, and this one was already built up and it works. So if none of the yet untested Gen 2 circuits would work as desired, the Gen 2 PCBs still can be useful. 

 

The other four options will need several different component sizing choices each, so I will quickly run through the 30 prototype PCBs I had ordered. Also, keep in mind that I don't know yet if the hysteresis can be reduced to the point where I want it to be, and if that brings any benefit at all.

 

The Gen 1 circuit works OK for typical users and it works perfectly with an AIFF or WAF file, the proof is the turboloader I've published with the BASIC (see the link in post #1). 

 

What I seek with Gen 2 is a more reliable and faster load with cassette recorders. Which only can be done if all the "demons" have been driven out of the ACI circuit. If none of the Gen 2 circuits can get there, we don't need no Gen 2 PCB ! The Gen 1 circuit and layout will do. And it is much easier to build. Gen 1 has only two SMD capacitors more, all hidden under the IC sockets. Gen 2 has six SMD components more, one active, and so the space below the LM311 socket got quite crowded. Only one of the five circuit options "cheats" in the sense that the added IC I use for it did not exist in 1975.

 

All other four circuit options only use circuitry that was available in 1975, except for the SMD form factor. Which is only necessary to hide them from view, such that the Gen 2 ACI card still looks like the original one. I hope, of course, that the goals can be achieved without the "cheat". For me this is important because I want to show that this ACI circuit could have existed in 1975, and it would have been (almost) perfect. Again, I don't know if I can get there. The ill effects we are dealing with cannot be simulated in SPICE in any useful manner, so real experimental lab work using the real PCBs and real Apple-1 is required to study the real world performance of the candidates.

 

For the ill effects, I will show them in the next post (for today I'm done with posting). These ill effects also are manifest in the Apple II circuit, just not as bad as in the original ACI circuit. Understanding them in the Apple II circuit, and how exactly they limit the performance, is helpful to understand them in the original ACI circuit where they are much worse.

 

Stay tuned !   

Offline
Last seen: 1 day 16 hours ago
Joined: Apr 1 2020 - 16:46
Posts: 999
ACI Rabbit Hole - Part 3: Apple II TAPE IN in the real world

So far we have examined the ideal case: happy cute Unicorns playfully prancing around on evergreen pastures, farting rainbows into the sky, and everybody is joyful and happy and all circuits work as intended.

 

Alas, in the real world, all these sweet dreams shatter from real world dirt effects which never are mentioned in typical textbooks. Because these dirt effects can be so intricate and hard to grasp analytically, that a professor who dared to write any such hypothetical textbook touching them would look as incompetent as he really is. Only few professors who write textbooks have worked long years in the electronics industry, so how can they know the real world ? There are a few exceptions, famous textbooks, written by authors with a profound industrial background, go for those. The "Art of Electronics" by Horowitz and Hill is one of these exceptions, a must have, despite some chapters now show their age, nobody uses those old ICs anymore, or do we ;-)

 

Another few words of warning. In the following I will show you photos taken off an analog oscilloscope screen. In these photos you can't see all the fine details I can see when I am peeking into that CRT. So some of the cursor settings you will see will appear to be wrong. They are not. I can see things the camera can't reproduce. And note that digital oscilloscopes - with a very few, very expensive exceptions - are unfit to do this kind of work. These exceptions try to mimic the behavior of a real analog oscilloscope with a trick called "digital phosphor" and this requires immense digital processing power and large, fast RAM memories. Cheap digital oscilloscopes do have their merits but don't even try to do this kind of work with one of them. You can never see everything you need to see with cheap digital oscilloscopes.

 

So, welcome to the real world: no green pastures, no Unicorns, just an industrial wasteland full of toxic waste dumps, and danger, traps and ill effects lurking everywhere. Actually, it's a moor, too: there is no solid ground to be found anywhere. Each step you make, something nearby wobbles. Frigthening. Especially in fog. Many a great horror story was made of of this stuff.

 

If course, this is meant as an allegory. "No solid ground" in a real world circuit means that nowhere the "circuit ground" is at the same potential. And this "ground" moves. All the time. The ICs switching and being clocked are the steps that make the moor wobble in our allegory above. A spooky and frightening place !

 

Say goodbye to the "0V" assumption. Power supply rails are not static and stable neither. They are polluted with all sorts of toxic waste and crap - the better your instruments are, the more of that pollution you can see. Same as in the real enviroment - some ubiquitous chemicals like PFOA can damage human and animal health at and below 1 ppb in drinking water. One part per billion ! (See where the problem is ... you need a high end lab to find that stuff, and even more expensive equipment to measure it quantitatively).

 

In typical 1970s microcomputers, and with a good analog oscilloscope of 100-150 MHz bandwidth, you can already see a lot, down to the fine structure of all that mess which relates to the clocks. It's not necessary to go much higher for the type of 1970s vintage computer work. I have a few Tek 78xx Series laboratory grade scopes which back in the day (they reigned supreme in the years 1977-1987) did cost as much as a new middle class car, but I barely use them anymore. The problem is to keep them in good running condition. So for this work, I used my trusted Hitachi V-1150 oscilloscope which I rebuild once every decade or so. It has 4 channels and 150 MHz bandwidth. Good enough ! Unlike the complex Tektronix masterpieces with all their complications it's simple enough to fix it. Oh, I when I bought it new back in 1987, I handed over the cash for half of a new middle class car - but instead of a rubber floor mat, I got the service manual.

 

So, this said, you can try to repeat my measurements, but don't try try that with a cheap digital oscilloscope or a hobby grade analog scope with a meager 20 MHz bandwidth. And keep in mind that the digital camera can't reproduce what I can see when being there and peeking down into that CRT. So if you think my cursors are off sometimes, trust me, they are not. But I had to reduce the beam brightness so the camera could take an acceptable quality picture. So some of the fine features I can see are not visible in the photos.

 

Let's keep it simple first and let's look at the pin #3 (noninverting input) of the 741 opamp in a typical Apple II clone (a faithful copycat clone of early original Apple II, and it still works, other than my original Apple IIe, where something in the power supply exploded and spilled smoke, and that was the end of my measurements on that IIe):

 

 

TAPE IN was driven by an Agilent 33120A function generator, 2V amplitude sinewave, 1 kHz. Ground clip was at the bottom of the 12k resistor, probe tip ait its top. I set the cursors to a point where the "ideal" signal would be, without all the crap / noise / toxic waste riding on it.  This would be the middle of the brightest band you can see. The human eye is quite good at that. The crap / noise / toxic waste "rides" on this ideal signal and by the intensity variation you can qualitatively see the statistical distribution of that crap. Beware that there are excursions into the dark regions nobody can see. But these don't happen often enough to be visible on such a scope. You would need a storage scope (brings its own problems with it) or, better, a high end digital scope, which can make on screen statistics / distribution diagrams of the signal excursions around a cursor setting. This is where digital scopes show their true power - data processing - but don't expect them to show you such nice, direct, pictures as quickly and efficiently as with a good analog scope. These digital scopes can be a bitch to program / set up.

 

Now, in the above photo you can read "81.4 mV" between the cursors. The calculated hysteresis for the ideal case (see part 1) above in the thread) was 87.2mV, so this result is fair enough. It seems that the lower cursor was a bit off center of the bright band, which may have contributed. We don't need to be super accurate here: the message is that there indeed is a lot of crap riding on this signal. Here are measurements for the crap:

 

 

We can see that it fits into a 42mV wide band (between the cursors) which captures most of the noise / crap. As explained above, there will be some excursions beyond these bounds but these are too rare to be visible.

 

Here is a cursor measurement of the clean gap between the "crap bands": 

 

 

The result: 45.4mV (cursors were reversed).

 

As you might suspect, these are a kind of a bit naive measurements because I want to keep it simple, as an entree, before I show you the more intricate details. There is one reason why I have chosen to make these measurements at all: they give us a clue how the designer of that circuit may have sized the hysteresis, back in the day, 45 years ago. As a thought experiment, what would happen in the above scope picture if we reduce the hysteresis ? The answer: the clean gap would shrink. And at about the point where the "crap bands" would touch, the tape read process would not work anymore, because the "crap" now could overwhelm the hysteresis.

 

This is a limiting case, and exploring under which conditions a circuit ceases to work is one of the first and foremost tasks when characterizing a new design in the lab. You don't want to see only a case where the circuit works, but you want to see where it fails. And then size, tweak and modify as needed to stay as far away from all failure points as possible. In case of the TAPE IN circuit, it looks as if the designer did tweak the hysteresis by setting it to a point where the height of the "crap bands" (~42 mV) was doubled (safety factor 2) to leave a "clean gap" of ~45 mV, and if we look at these numbers we arrive at 84mV (or 87mV, if adding 42mV and 45mV) which happens to be the theoretical hysteresis we have calculated in my previous post, #6. (I use "height" here because neither "Peak to Peak" nor "Amplitude" would be correct terms ... the information is in the brightness distribution in and around these bands). 

 

There is an empirical way to arrive at much the same component  sizing: replace the 1 MegOhm resistor with a 5 MegOhm trim pot, and see how much you can turn it up before the comparator output starts to chatter with no input signal applied. This is the functional limit. Measure the resistance of the trim pot. Then, apply safety factor 2, and set it to half that value (doubling the hysteresis). You can do this experiment on any unmodifed Apple-1 ACI card, too, by replacing the 47 kOhm resistor with a 250 kOhm trim pot.

However, be aware that a trim pot is a different animal than a fixed resistor. The former has more parasitic capacitances and inductances than the latter. Since we deal with frequencies high enough where these tiny parasitic capacitances and inductances may have an effect, you will not get exactly the same result after you have replaced the trim pot with a fixed resistor - the latter, in the typical case, will give a somewhat better result, but in some cases, the opposite is true because the parasites had some unintended remedial effect. A, the fun of electronics alchemy lab work ! 

 

Just as a side note, where does the safety factor 2 come from ? (Skip to BANDWITH EFFECTS below if not interested in the following tripe)

 

ABOUT SAFETY FACTORS IN ENGINEERING

 

It's rooted in statistics. Assuming a Gaussian distribution (which is not always the case !), the "crap bands" you can see on a typical analog scope (and some experience) represent +/- 3...4 sigma events. If you double that (factor 2) you arrive at 6...8 sigma events. Which happen seldom enough to be tolerated in many applications.

Structural engineering goes further: traditionally, steam boilers and stuctures like bridges are designed with a safety factor of at least 3 (or more). Except when it's a bridge designed by a diversity and inclusion driven team of female affirmative action / minority "woke" hires like this one:

 

https://wentworthreport.com/2018/03/19/diversity-fail-all-women-engineering-team-blamed-for-collapse-of-miami-pedestrian-bridge/

 

Six people were killed and nine were injured. But what can I say. The infamous "Galloping Gertie" Tacoma Narrows bridge which collapsed in 1940 was designed by men. But enough of that. Just wanted to warn  that whenever politics meddle with hiring decisions, the outcome will be bad more often than not. Outsourcing design tasks to third world countries or using H1B slaves who come and go also is bad. These political agenda / ideology / greed driven decisions are one of the reasons why our technological civilisation is coming apart at the seams and why most products we can buy today are crap and don't last anymore.

 

BANDWIDTH EFFECTS

 

You may have noted some slight nonchalance I have shown above when discussing the numbers. But actually, writing these numbers down to 3 sigificant digits (or even more) is not needed. I did that mainly to a) allow you to check the math and arrive at exactly the same numbers, and b) to avoid confusion about possible errors in the text. If the cursor measurement shows 81.4mV, I could write down 81mV in the text and it would be good enough, but then some readers would ask where the ".4" has gone missing and accuse me of being sloppy. 

 

The ugly truth is that the whole discussion above is somewhat bogus, because I did not include bandwidth effects. The discussion is fine to show you my conjecture how the hysteresis was probably sized by the designer of the circuit, because this is a well trodden path / line of thought fairly common in engineering, and it works. However, to get a more complete picture, we need to consider bandwidth effects, too. Here is what happens if I turn on the bandwidth limit mode of my Hitachi V-1150 oscilloscope. This limits the bandwidth in the vertical channels to 20 MHz (down from 150 MHz):

 

 

See the little "BL" flag ? And the height of the "crap bands" now being down to 16 mV ? This is how the real world works and why you may not want maximum bandwidth (aka speed) in every case. If you had infinite bandwidth the noise would be infinite, too, and swamp any signal. So the trick is to limit the bandwidth to a point where the circuit can still process the wanted signal with enough fidelity, but not much more bandwidth, so that the total integrated noise over the bandwidth stays as low as needed by the system. I do not want to indulge in this topic any further, because we would need to look into Fourier transforms and other advanced mathematical methods. I mention this only because which very high likelyhood, this is the reason why in the Apple II they chose to use a 741 opamp in lieu of the LM311 comparator:

 

The LM311 is very fast (for the time being) and, being no opamp, has no internal compensation capacitor which would limit its bandwidth to low values. All the bandwidth limiting within the LM311 are just parasitic capacitors which just happen and are small, so the internal bandwidth of the LM311 is quite high (for the time being). The 741 opamp, "born" in 1968, is internally compensated (think: slowed down) and the datasheet tells us it has a GBW (Gain Bandwidth Product) of merely 1 Mhz. Some datasheets also show the internal schematic and it uses a Miller compensation scheme with a capacitor C = 30 pF. This data would allow us to make a simple SPICE model that can mimic the dynamics of the 741 when being used as a comparator. But unless somebody is really interested, I'll skip that. This post already is long enough. You might argue why a simple circuit like this can need so many words to describe, analyze and criticise it. I could show you a one transistor circuit which needs even more words and very, very complex math. Electronics is not as trivial as the "Archer" electronics lab kits from Radio Shack  pretend it to be, sorry. No happy prancing Unicorns and most circuits in the real world don't work as desired before a lot of time and money was spent on them. Let's continue with the ugly truth:

 

DIFFERENTIAL MODE

 

At this point we know enough to be ready to do measurements which show what the opamp sees at both of its inputs. To do this, you need an oscilloscope which can invert channel CH2 and add it to channel CH1. CH1 is connected to the noninverting input (pin #3) of the opamp. CH2 (the inverted one) is connected to the inverting input (pin #2) of the opamp. If both channels are electrically in good shape (tuned to have the same gain over the frequency range in question) then the $5000 oscilloscope turns into a $0.35 opamp (no, just joking). But with this setup you can see on the scope the differential signal the 741 "sees". Which gives more insight. Here is a photo with full bandwidth, and no signal generator connected to TAPE IN (unplug the cable at the TAPE IN connector. The cable alone may change things).

 

 

The "crap band" is about 100mV high (although most of it, the bright band in the middle, is only 40 mV high). But you can see the "needles" which stick out and these would trip a fast comparator erratically, despite of the 87mV hysteresis. This circuit would not work with a LM311. However, the 741 does limit the bandwidth internally, so let's turn on the bandwidth limit of the scope to see what kind of effect this has:

 

 

Here the fine structure of the "crap" emerges and you can see how the clocks in the system make the ICs produce current spikes here, there, and everywhere, making everything wobble and move. But the "crap band" height now is down to 67.2mV, a tad below the 87mV hysteresis. The 741 internal bandwidth limit is much lower than the 20 MHz limit offered by the scope, so the crap it can "see" will be lesser, and we can conclude that the circuit is good enough. Which we already know, by empirical evidence (Apple, the corporation, still exists and did not go out of business in 1977 due to a botched cassette read circuit driving customers mad, which did not happen because they had improved it over the Apple-1 ACI circuit ... but with the ACI circuit in the Apple II the wheels would certainly have come off).

 

Just in case you want to do the same measurements, here is the test for your differential measurement setup: hook both CH1 and CH2 to the same polluted point, here, pin #3):

 

 

What you can see here is that the "crap signal", despite being quite wild, gets cancelled out, except for the 4.4mV residual noise band seen, which is the intrinsic noise of the oscilloscope vertical channel at 150 MHz of bandwidth. This picture does not change (and should not change) when both scope probes get disconnected from the noisy test point (but stay connected). Otherwise something is amiss with the tuning of both channels, as they don't have the same gain and frequency response anymore.

 

So far the measurements on the PC-48 Apple II clone. In the next post I will show you some photos of measurements from the real Apple IIe until it died:

 

 

This power supply is a basket case. I will put a more modern and safer switchmode power supply into its metal enclosure and toss the old PCB. Yikes ! Yet another repair project. I have so many things to repair in and around the house and on the car that I have enough work to do for the rest of the year !

The problem, of course, is that I can't hire anyone to do this work for me: first, nobody wants to work anymore, and those who would, do shoddy work at usurious prices. The local stealership quoted a tad below $600 to repair the A/C on my car. After I diagnosed the problem myself I ordered a $36 spare part and I'll put it in the next weeks, before the heat is up. All this steals the time I'd need to work on my Apple-1 projects. But this is how life is nowadays. If you want to get things done, done right, done on time, and done on budget, you have to do it yourself ! Hope I never need to do appendix surgery on myself ;-)   Never set foot into an American hospital. They are death traps. And charge $200 for one Aspirin pill regardless. But they never pay the damage if your leg rots away after some small surgery. Happend to the young woman next door. A small sports accident needing surgery ended with a long odyssee, many follow up surgeries to cut out the rot, to save the leg. Oh, and they of course bill you for fixing what they broke. Car stealerships did not have found the same tricks yet, or did they ? See, the whole worldwide economy is infested with scams. And all the numbes are bogus. Made-up GDP "corrected" with bogus CPI numbers ? And the result boldly being called "investment analysis" ? This is why we are in the situation we are now. So don't trust anyone. Not even me ;-)   . . . do the work yourself to be sure !

Offline
Last seen: 3 hours 36 min ago
Joined: Feb 27 2021 - 18:59
Posts: 618
Rifa girls are easy

The fried capacitor can simply be removed, it has no purpose besides EMI compliance. It is basically the easiest repair in the world.

Offline
Last seen: 1 day 16 hours ago
Joined: Apr 1 2020 - 16:46
Posts: 999
In post #9, robespierre wrote

In post #9, robespierre wrote:

 

"The fried capacitor can simply be removed, it has no purpose besides EMI compliance. It is basically the easiest repair in the world."

 

Uncle Bernie answers:

 

I did not look into that yet as the stinking thing is out on my back porch. At least it has stopped smoking.  Even if these capacitors are not needed (both of them ? The big one was singed by the dying small one !) there always are concerns about residual metal shreds which may float around (and hide in places just to break loose later), long term corrosion by the residues of the fumes, and then, in general,  possible end-of-life of other components, too.  How much time would it cost me to throughly clean and inspect the thing to get it back in service and how much time would it cost me to just put one of my open frame switchers in which are new and will last for a long time.

 

It's essentially the same problem as with keeping all the other 30-40 years old equipment running. You can invest hours into fixing it and replacing end-of-of life components, clean switches and re-calibrate everything, just to use it for a few hours until the next component dies inside. This is the reason why I don't recommend anyone to buy old lab equipment (like analog oscilloscopes) off Ebay. There is a reason why these mighty Tek 78xx series high-end laboratory scopes are being offered for $300 while the much simpler (and less mighty) Hitachi V-1150 are being offered for $1000 and above. In terms of theoretical performance, the Tek wins. In terms of TLC (= RQLT) required to keep them in good running condition, the Tek is a monstrosity you want to avoid.  And beware, even the lesser Tektronix scopes are full of challenges, such as the notorious hybrids which more often than not are dead or on their last legs. The only way to get replacements is to buy another Tek scope of the same type, just to find out that its hybrid amplifier modules driving the CRT are shot, too. 

 

So be warned !

 

- Uncle Bernie

Offline
Last seen: 2 months 1 week ago
Joined: Jul 5 2018 - 09:44
Posts: 2587
A lot of people just put in a

A lot of people just put in a new RIFA cap to replace the one that blows.  If it doesn't take out some other component when it does (most often the fuse, but occasionally a resistor or diode will blow) then that repair usually proves adequate.  It is acually usually more serious if an electrolytic cap leaks, because that often causes corrosion that can cause problems.  The contents of the RIFA caps is mostly some kind of metalicized lmylar paper or something.  It smells awful but it doesn't really seem to cause a lot of problems even when people don't make a lot of effort to clean up the mess.

 

I had one of these blow in a Franklin power supply recently and pretty much all I did was replace the fuse that blew, the two RIFA caps (the one that blew and the other one pre-emptively) and just half ass clean up the mess from the RIFA that blew and then put it back together.  I pre-emptively replaced the RIFAs in the other 3 Franlin supplies on the machines I've been working on.  A few years ago I bought a //e off eBay cheap because it was non-working.  The big RIFA and fuse in it's Dynacomp power supply were blown in it..  Replaced those and it has been running fine since then.

 

 

Offline
Last seen: 1 day 16 hours ago
Joined: Apr 1 2020 - 16:46
Posts: 999
ACI Rabbit Hole - Part 4: Apple IIe TAPE IN in the real world

These are much the same measurements as in my previous post #7, but instead on an Apple II clone, it's a real Apple IIe.

 

The Apple IIe was a vastly improved machine with the hardware design completely redone, and many TTLs were "swallowed" by the new custom LSI chips in the machine. The PCB layout also was completely redone, this time with CAD, and the power and ground grids are much more solid than in the previous incarnations of the Apple II concept.

 

Keep in mind that the Apple IIe uses a dual opamp in lieu of the 741, so the opamp output we are interested in on the Apple IIe is pin #1, but otherwise it's the same TAPE IN circuit as in the previous Apple II ... which is a good sign. They did not find it necessary to improve anything, so it certainly was "good enough" for the Apple II users who still used cassette recorders.

The Disk II system (thanks to Woz' genius floppy disc controller design and Job's greed for profit having stripped the floppy drive mechanism down to the bare minimums) was the cheapest floppy disk system available on the market of the time being, but despite of this many users still only had cassette recorders, especially those who just wanted to play computer games.

 

Here are the photos of the measurements I took on the Apple IIe:

 

 

This photo shows the hysteresis as seen in the Apple IIe, and this time I used the bandwidth limit feature to get narrower "crap bands" which helps to center the cursors in them. As a result, the measurement is spot on with the theoretical analysis in post #6.

 

The following photo shows the upper "crap band" with bandwidth limit on (20 MHz). Surprisingly, it's a little bit worse than as seen in the Apple II clone of the previous post. But not much worse:

 

 

The "clean gap" between the "crap bands" can be seen in the following two photos, one time with full 150 MHz bandwidth (only 26.4mV clean gap), and one time with 20 MHz bandwidth limit turned on (41.6mV clean gap). So the "clean gap" is certainly large enough:

 

This is the same but with 20 MHz bandwidth limit:

 

 

The differential signal measurement in the following photos (voltage difference at the opamp inputs) show that the Apple IIe is a bit "cleaner" than the previous example, again, the first one with full bandwidth and the second one with bandwidth limit:

 

This is the same but with 20 MHz bandwidth limit:

 

 

I think it's quite remarkable that all the elaborate engineering and "toxic RF waste cleanup" efforts that went into the Apple IIe brought the height of the crap / noise / pollution band only down to 75.2mV, compared to the 100mV seen in the previous example. But this is how cruel the real world is. Electronics engineering is not for wimps !

 

In the bandwidth limited case, the 44.0mV height of the "crap band" gives us a clue that a similar improvement (over the 67.2mV we saw in post #7) was obtained for the differential signal case.

 

But overall, both the TAPE IN signals of the Apple II clone and the Apple IIe are quite in the same ballpark, and they both are "good enough" to make the cassette interface work well enough that the typical user will be satisfied with its performance and reliability. The internal bandwidth limiting of the 741 type opamp - when used as a comparator - improves things further, but it's too much work for me to build an experiment to show you this. Suffice to say that the measurements with 20 MHz bandwidth limit already show that the TAPE IN has a "safety factor" of 2 under these conditions, so it's no wonder it even works better when the 741 reduces the bandwidth even further (However, there is a catch with that, too, to be discussed later in this thread).

 

In my next post I'll show you measurements from the Apple-1 ACI and then you can see how much worse it is. But don't hold your breath - at the moment I'm busy with some other things.

 

- Uncle Bernie

 

Log in or register to post comments