Friday 22 August 2014

Google Mock - Dammit gets me every time

Actually this isn't Google Mock's fault but it does catch a code error.

I have a class

class MyServiceInterface
{
public:
   virtual void provideAService()=0;
   ...
};

Then I have a mock for this

class MockMyService : public MyServiceInterface
{
public:
    MOCK_METHOD0(provideAService, void());
};

In my test I expect it to be called

EXPECT_CALL( *mockService, provideAService());

When the test finishes I get this error. It's weird as I used a smart pointer to hold the pointer to the mock.

c:\work\XXX\test\src\MyServiceTest.cpp(132): ERROR: this mock object should be deleted but never is. Its address is @04334590.
ERROR: 1 leaked mock object found at program exit.

Yes the solution is obvious - the MyServiceInterface has no virtual destructor. The following to the service interface definition and we are all good.

virtual ~MyServiceInterface() { };

It just catches me out often enough that I thought if I write this out I might remember...

Monday 18 August 2014

Tektronix Scope Probes

So now that the work on the scope looks like it is going somewhere I went looking for a set of probes.

I found a guy on ebay selling Tektronix P6063B passive probes. These are quite nice I think as they are like 12pF in x10 mode and have 200MHz of bandwidth.


Also, as they are proper Tektronix ones they have this feature where the scope can tell if they are in x1 or x10 mode and the scope will change the volts/div reading accordingly. Essentially the scope has two lights that glow through the skirt to show you what volts/div setting you are on. If it is in x1 mode it lights the left light and if you are in x10 mode the right hand one. It figures this out based on a 3rd connection on the skirt of the BNC connector.

Another thing I liked is they have a feature where they from the probe tip you can flick a switch and it grounds the signal so you can see the background noise level.

The age of them is a hoot too. They were sealed in plastic bags when I got them - never been used. Checkout the date on the instructions! 1986! Wow!

Friday 15 August 2014

Tektronix 475 Triggering

Triggering

Unfortunately the trigger on my scope still doesn't work. There is a trigger delay knob you can use to delay the sweep after the trigger. If I set the scope for auto triggering (so it sweeps anyway even when it doesn't have a trigger) and then use the delay knob I can sort-of kind-of get the waveform to stay still. And it looks really good when I do! I like this scope!


I really want to fix this scope now!

Ok so I pick a mid-point which is just after Q526, I set the trigger source to channel 1 and connect a signal to the scope. I can see the signal in auto mode but in normal mode I can't get it to trigger. There is a signal there but it is very weak (less than 10mV). So then I pick a spot in front of the two JFETs and sure enough I have a good signal there. Ok we have a neighbourhood!

The base of Q526 has a signal so then I turn it all off, pull Q526 and put it in the transistor tester. The transistor tester tells me it is a resistor. I check the BE and BC junctions with the diode range on my DMM and they look wrong.

Q526 is a 2N4258 PNP switching transistor. Not really sure why they picked this. I have some 2N2907s on hand as I was going to replace the one in the channel switching logic. I decided to give it a go and start up the scope again. Ok! now I have a signal at Pin 3 of the U520! But still no trigger :(

When I hit trace view before I got nothing but now I do see the input waveform but it is pretty dirty and big. The voltage and (as far as I can tell) the waveform matches the pictures in the scan of the service manual I have. So why no trigger.

The manual says I should see the trigger signal on pin 8 and 9 but I am not seeing anything. The voltages are a bit off (13.4 instead of 14.6). The voltages on some of the other pins are a bit off too.

As luck has it the scope has two trigger circuits and they are pretty much identical. Oddly the B trigger seems to have the same issue with the source follower circuit so I replace that transistor too. Strangely the output of that chip is also silent even after doing this. I decided I will swap the two chips and see what happens but this has no effect - they are both still not working.

Someone on the Tektronix forum asked what the bias on the input to U520 was like but that looked Ok.

I tried pulling one of the transistors after U520 to see if there was something loading down the output but this had no effect.

When I scope the tunnel diodes I can see the auto trigger pulse happening so I think they must be fine.

I'm a bit stuck. I really suspect these custom Tektronix paraphase amplifier chips (U520 and U720) are stuffed. Any ideas would be welcome.

Tektronix 475 Channel Selection and Channel 1 Problems

Channel Selection

So now the scope is sweeping but not triggering. I also noticed that no matter what channel switch I select it always shows channel 2 and decided to tackle this next.

The circuit is thankfully mostly digital and based on 74 series logic. The only quirk was that the VSS line was at -5V and VCC was at ground. So logic high is zero and logic low is -4.8V


There is a dedicated channel MUX IC that switches between the different channel input and then the logic decides which channel to display. There is logic to switch between channel 1 and two on the sync pulse for alternate mode and there is a 2MHz oscillator made up from a couple of capacitors and some NAND gates that swaps between channel 1 and 2 in 'chop' mode.

There is a transistor configured as a voltage regulator to generate the -5V and -5.7V used by the logic from the -8V line. The output was a little off and the -5 was more like -5.7 and the -5.7 was closer to -6.4. I tried swapping the transistor but it didn't change.

The outputs of the flip-flops control the channel selection lines on the MUX. These really didn't look right - instead of being near 0 or around -5V they were at around -1.5V. I checked all the resistors to look for a short but no luck.

74 series logic is cheap and easy to come by so the next day I bought replacements for the 7474 and the 7400s. After replacing the 7474 I still didn't have channel selection but the outputs of the flip-flops now looked like sensible logic levels. I decided the output of the 7400 in the chop/alt circuit was off so I just replaced all the 7400s. Thankfully I noticed that U330 is upside down compared with the other chips on this PCB (pin 1 is on the right). Now I can change channels! The other interesting thing was that now the -5V and -5.7 volt lines were the correct voltage.

The alt mode also worked and it displayed two waveforms. Chop however didn't. I looked at the input to U330B and there was no signal from the oscillator. I checked the voltage at the input to U330A and I noticed the -5.7 was present. Weirdly, just touching the legs of U330 with the DMM caused the oscillator to start running. 

Looking at the circuit I actually don't understand how this works. The resistor divider network on pin 12 I thought would set it to low (-5V). When the chop switch is closed pin 1 and 2 go low which brings pin 3 high which brings pin 13 high. But as 12 is low this won't effect 11 and so won't start oscillation.

As I changed both 7400s together I thought I would take a punt and put one back in and see what happens. The first one I put in was the one that used to be U340 and it didn't work at all - the outputs were at -1.5V (not high and not low). When I put the one that was originally U330 it worked! Alt, chop and everything now worked. I still don't know why. I have to assume something about it being 74LS changed things but again I don't see how it works in the first place.

Channel 1

So now when I move the vertical position of channel 1 and 2 the right trace moves and if I am in channel 1 then the channel 2 position has no effect etc. If I connect a signal to channel 2 I can see it on the scope! Its a mess as trigger doesn't work but it is definitely progress. I get nothing from channel 1 however no matter what I do with the knobs.

There are two metal cans at the front of the scope that contain input attenuators. The white boxes below are the attenuators. Apparently they are a ceramic hybrid and are frequency compensated so they attenuate by the same amount across the scopes frequency range. There are a series of tiny gold switch contacts which switch in or out each attenuator and the switches are engaged by pins that poke up from this barrel attached to the volts/div knob below. In the photo below you can just see the first two switches although these ones are the AC/DC/GND switch contacts. The silver input capacitor is visible at the top.


I knew channel two was working so I attached a scope to the output of the attenuator block of each channel and compared. The output from channel 1 was very low. The attenuators are socketed so I carefully removed each of them one at a time and used a piece of paper soaked in Isopropyl Alcohol to clean the switch contact. Essentially you turn the knob until the switch opens, put the paper under the switch and then turn the knob to close the switch. Then you carefully(!) move the paper around to clean the contacts and pull it out. This got the signal shown on the test scope back to something reasonable and now the signal didn't change so much when I moved the knobs.

When I turned the scope on the trace for channel 1 was still a straight line. I then assumed I had an electronic problem. The vertical pre-amplifier is implemented using two custom, hybrid 'cascode' amplifier ICs. A cascode amplifier is two transistor arrangement that offers good bandwith, isolation and slew rate.

As channel 2 worked I could compare channel 1 and 2 to find the difference. I could see the signal at inputs of the second cascode amplifier. I couldn't see any signal at the ouputs. I searched for dead capactors, bad resistors, I tried removing the two transistors following the second cascode to see if the signal would appear but nothing. I even swapped the cascode amplifiers between the two stages but interesting this had no effect - channel 2 still worked and channel 1 still did not. Hmm.. I looked at the biasing of the second amplifier and noticed this was a little different. I noticed that if I set channel 1 to the lowest setting (5mV/division) that I did get a signal although a distorted one.



It turns out there is a second set of switches *underneath* the barrel that changes the volts/div. These ones set the gain for the second cascode amplifier (see below)



I found that I could do the paper trick but from the other side and clean the contacts of the switches underneath. Then I turned it on a again and yeah! A signal!

But still no trigger.

Till next time....

Sunday 3 August 2014

Tektronix 475 - No Sweep

Still no Sweep


I have to admit that I was hoping that if I fixed the -8V line then the scope would jump into life and everything would work. Alas not.

The trick was where to begin as I know there is a problem with triggering as well as sweep. I decided that even if I can't trigger but I can get sweep happening (in auto mode), then I could move forward. Also, the troublshooting flowchart in the manual suggested I should look at the sweep first.

The sweep circuits in the oscilloscope are quite complicated. There are actually two separate sweep generators that can run at different rates. You can set the scope up so that the 'B' sweep starts a short (and configurable) time delay after the 'A' sweep starts. The cool thing is you can run the 'B' sweep at a faster rate which allows you to effectively zoom in on part of the signal. You can move around the longer trace by altering the delay. Then there is 'A' intensified by 'B' mode, Mix mode and... well I don't know.

The next problem is I've never used this scope - well not in a working state so it took a bit of googling and youtube watching to actually figure out what it is *supposed* to do. For example the time/div knob is marked 'A and B TIME/DIV' and the end of the knob says 'pull' but I didn't see how this worked. It was hard to pull and nothing seemed to happen (I expected it to pull out and click). I turned out you have to pull the knob and then turn it. If you do this it disengages the grey knob from the clear skirt and allows you to set the A and B sweep rates to different values. When you rotate either back so they are on the same speed then they lock together and then when you rotate the knob they both turn.

Sweep Generator

The sweep generator is pretty complicated. The first thing that puzzled me was the the differential amplifiers (Q914, Q926 and so on). To begin with I decided to keep it simple and went looking for a sweep signal coming out of Q956. Sure enough there was nothing there (just a constant 15V). But the sweep circuit is initiated by the 'gate' signal from the sweep logic board. The 'A' sweep seems to get initiated by the main sweep gate coming in on the base of Q902. Looking at TP902 I can see the amplified pulse coming in. Great! That means the fault is somewhere in here... Somewhere anyway...



I noticed that if I turn the sweep rate right up to one of the top three speeds (shortest time per division) that I get a short (about half screen) trace on the scope. I scoped the sweep output while this was happening and sure enough I could see a 'V' which was the sweep reducing the output voltage in a roughly linear ramp.

I still didn't get how this all worked. I knew from the manual it was a 'miller integrator'. Turns out this is pretty simply just an amplifier with a feedback capacitor. The capacitor charges roughly linearly and provides the output ramp. The capacitor/resistor used to determine the time constant are switched in by the timing board depending on where you rotate the time/div knob.

Digging a bit deeper I see that the transistors facing up the page like Q904 are configured to either pass or block the gate signal going to one bit of the circuit. The circuit description in the service manual describes these as a 'disconnect amplifier'. So each sweep generator is a JFET and a transistor together with a variable resistor/capacitor from the timing board. They also have a disconnect transistor that turns that sweep on or off depending on what switches you pressed.

So I choose 'A' mode on the scope and looked at the signal coming out of Q904. I found that it was a bit feeble and scratched my head about why. I figured out the A (lock knobs) button puts 5V to the diode going to the base. I fiddled with the time/div knob and figured out the pulse starts to look like a feeble 1V ramp if I set the time/div to one of the middle speed settings! Ok there is some life in there.

I noticed the voltage at R921 was around 14V. I thought perhaps the capacitor C922 had shorted so I lifted one of its legs but it appeared fine. In fact the circuit was the same without it.

I noticed there was a 1V ramp happening on the collector of Q922 so I followed this through. At the emitter of Q940 is was a feeble bump rather than a ramp. I guessed Q940 might be suspect and pulled it. The transistor tester didn't even identify it as a transistor so I replaced it with a BC547 and tested again. This time the ramp looks a tiny bit better but still no output from Q940.

The trouble is I don't know what it is supposed to look like. I remembered the fast sweep sort-of works so I switch into the fastest sweep rate and looked at the collector of Q1014. The first thing I noticed was the ramp was starting at 15V and going down instead of the feeble 1V. The emitter of Q1022 also showed this ramp. 

The voltage at R1011 swung a lot more. This made me wonder if the JFET Q920 might be toast. On a whim I decided to swap the JFET from Q1010 and Q920 to see what would happen and Voila! The medium/slow sweep now works!

I tried putting Q940 back but no that didn't work. So I had two faults - Q940 was dead and one JFET. The JFETs are a bit unusual so I will have to order some from the US.

I did some more investigation and B sweep is dead as well as the fast sweep. Trigger is still broken and there seems to be some problems in the front-end. I can get some wave form if I wiggle the volts/div channel 2 knob but nothing on channel 1.

So more work to do but some progress!


Saturday 2 August 2014

Tektronix 475 - -8V still wonky

No Sweep

Ok so the scope has a spot now. I can move it around (a bit) with the vertical and horizontal position controls. This tells me the deflection is Ok but there is no sweep. No matter what I can't get the trigger or ready light to come on so there is a problem with the triggering also.

There has to be something more fundamental that is causing this so I go back to the PSU as I recall the -8V still wasn't quite right.

-8V

The -8V line is now sort-of working after I changed out the bridge rectifier. The odd thing is that it isn't -8V but -8.4V which isn't catastrophic (I don't think) might be causing other things to go wrong.

So I go back to the power supply circuit diagram. I get the transistors being driven by the opamp - the opamp is an error amplifier and then causes the transistors to adjust the voltage until it matches the reference. The transistor with the base pointing towards the right initially stumped me (Q1464) but it turns out this is a 'foldback' protection circuit. It reduces the drive on the main pass transistor if the current is too high. When the current increases then the voltage across R1467 increases with switches on Q1464 which turns down the drive to Q1466.

There is a tonne of current put out by the circuit so maybe this is it. But then I would have thought this would make the output more positive (i.e. less negative) rather than more negative. Doing some voltage measurements the circuit doesn't look like it is in foldback. Hmm


The -8V reference works using a volrage dividor composed of a 50K and an 8K resistor. It uses 50V to create a reference for -8. The voltage between the two resistors is 0V. When I test this with my meter the resistors have 50.0V and 8.4V over them respectively which makes no sense.

I tried measure the resistors but as they are in circuit the numbers don't look right. The 50K looks like 12 and the 8K looks like about 7.6.

Someone suggested the opamps can get flakey over time so I tried swapping this out (they are easy enough to get) but this made no difference. I also swapped the foldback and the smaller pass transistor with some garden variety BC547s but again this had no effect.

The resistors are 0.1% tolerance types and these aren't too easy to get. I ordered a 50K as the measurement on this one was way off.

While waiting for this in the post I gave in one day and decided to lift one leg of the 50K resistor from the circuit and test it (when you have excluded all the likely stuff eh?). The resistor was bang-on unfortunately. I decided I may as well keep going and lifted one leg of the 8K. The weird thing was that it measured 8.4K. Umm hang on - that is my voltage error? Seriously a resistor went *slightly* high resistance? Apparently!

I could get 8.06K 0.1% resistors from element14 so I ordered some and sure enough my -8V supply is now -8.01V. I found an ebay vendor that cheaply sells the 8.0K 0.1% resistors but they aren't here yet. Still -8.01 is well within tolerance. I call that a win!

Finally the EHT multiplier comes in the post!

EHT Multiplier Replacement


So the Tek475 has been sitting on my desk with the vertical board pulled out for quite some time now. Finally the part I've been waiting for came in the post. I was partly hoping to see a red-cross styro-foam eski like you see on the medical programs on TV but not - just a plain box.

I de-solder the connection to the board and undo the plastic nuts but there isn't enough room between this and the metal case to get it out. I loosen off the screws holding the main interface board in including the ones on the power transistors at the back and I am able to bend it just enough to easy the EHT multiplier out safely.

I've undone the cover over the plate above where the metal tube goes and I disconnect the EHT from the plastic connector which is on the end of the wire coming out of the multiplier (making sure I short it to the case just in case) . The connector is a right -angled affair and the wire goes underneath the metal tube containing the CRT and there isn't enough clearance to get the connector round. So how do I get it out? Ok I could cut the wire (its dead anyway) but then how do I get the new one in? Hmm.. I could pull the metal cover containing the tube back but I really don't want to damage the tube. God I don't really want to *touch* the tube.

Off to the Tek group. Somebody quickly replies and explains that the newer version of the manual describes the tube removal process. As it turns out I've already downloaded this (or the US DOD equivalent anyway).

The process does in fact require removal of the tube. It actually turned out to be easier and less scary than it sounded. You first reach in with a pair of pliers and pull off all these fine wires connecting to the deflection plates and grids etc. They are stiff enough to stay in place so I won't have to remember where to put them back. You undo the back cover and then the round cover over the end of the tube. You pull the electrical connector off the end of the CRT.
Then you undo the screws over the front screen cover and remove the blue filter etc.

Then comes the scary bit - you push on the back of the CRT and ease it gently out of the front of the scope. You have to totally withdraw it from the scope and then rest it somewhere padded. The anode wire comes with it so take a look where it goes before you totally pull it out so you know where to feed it in a minute!


The CRT internals look amazing. I wish I had a clue what half of them are. They look like something out of Star Trek! The black spot looks like a bit of a worry but I'm sure it is just the effect of the cathode heater.



Ok so I still can't get the wire through. I undo the bolt holding the metal tube that the tube rested in so I can slide it partially out the back of the scope. It doesn't move easily but eventually I can overcome the friction of the plastic sleeve it is sitting against and it moves. Now I can easily remove the EHT cable!

I route the new EHT cable through the same way. There is a sort of recess round the case it sits in so I pass it back the same way.

I push the metal tube back in, re-fit the bolt and then put the CRT back in. I stuff the anode wire back into the hole and push it in a bit at a time while pulling the anode through. This takes a couple of goes as somewhere along the line I snag the wires for the graticule illumination and have to re-start.

There are these plastic corners that seem to be to stop the tube rattling in place. One has totally crumbled when I removed the tube. I figure it is just padding so I make up a new pad with some folded paper just thick enough to hold the tube snugly.

The cap goes back on, the the CRT, the covers front and back and now it is time to re-connect the deflection plates. This isn't fun - the wires are thin and the metal tangs leading out of the CRT are thin and relatively short. I don't want to bend them as I imagine snapping them off would be *very* bad. After much cursing, stealing my wife's head lamp and some tricky manouvering they are back on. The worst ones were the horizontal deflection plates which are down a hole through the middle of the main interface board. It's like a high-voltage game of operation! Eventually all these go back on.

I flex the interface board again to get the EHT multiplier in. I solder it back in place, connect the anode lead into the angle connector and decide this might be a good spot for a quick test. I turn it on and immediately you can feel the EHT fire up and the screen quietly sizzles with static. After a few seconds the entire screen is glowing which is a good sign! Means the EHT works and the CRT works!

The next step is to re-assemble the vertical board from the pictures I took before. All the coax goes back in, the connectors go back where they were and the de-soldered bits get re-soldered.

The knobs proved to be trick to put back on as they are quite tight on the fibreglass shafts. Unfortunately I broke one of the connectors. This was easy enough to fix with a bit of epoxy (Araldite).

So then I fire it up and... well nothing. No trace. I hit the beam find button and guess what? We have a spot! More good news! But still more work to do obviously as there is no deflection. Well that's Ok I'm happy :)