Showing posts with label electronics. Show all posts
Showing posts with label electronics. Show all posts

Monday, March 8, 2021

Readout for the 5S14N

Introduction

The 5S14N is a very versatile sampling plugin for the Tektronix 5000 series scope. While some say it is the little brother of the 7S14 for the 7000 series mainframes, it is actually the other way around. The 7S14 contains the same board as the 5S14N, so far that it actually has the 5000 series edge connector on them, but unused, having an adapter board to connect to the mainframe. The only feature missing from the 5S14N is the readout capability, hence the N suffix.

The slower, 5000 series mainframes do not have readout, but the faster 5400 series do. Since I have a 5440, I started wondering if it would be possible to add the readout, as the way the readout works is exactly the same as in the 7000 series scopes. BTW, the readout is masterpiece of analog engineering, created by Barrie Gilbert of Gilbert cell fame.

After consulting with the service manual, it seemed like a viable idea. Since both plugins are practically the same, except for the mainframe interface, I was hoping that Tek did not produce two version with only a few components missing. There is the readout board, which contains the resistors to program the currents for the mainframe readout circuitry, which is not in the 5S14N, but that didn't seem to be a problem, as that could easily be duplicated. However, if the switch contacts from the timebase or the input attenuators are missing, then there is not a lot of hope. After taking apart the unit and doing some measurements, it turned out that fortunately this is not the case. Everything is there that is needed for the readout. Well, nearly everything, these are the missing components:

  • The readout board
  • Interconnect between the readout and the horizontal board
  • Interconnect between the readout and the vertical switch board
  • Connecting harness between the readout board and the input attenuator switches
  • Connection between the readout board and the mainframe interface

So, let's go trough these items and see what can be done.

The readout board

The readout board is a fairly simple circuit, consisting mostly of resistors, that create the programming currents for the readout in the mainframe. The resistors are switched by the cam switches of the horizontal timebase, the vertical attenuator switches and some other switch, like Ch2 invert, etc.
Additionally, there are some active components to implement the 10x/1x probe readout switching and the readout enable for the enabled channels.
Due to the excellent service manuals from the time this plugin was produced, the schematics are given in the 7S14 manual. Fortunately, the same mechanical implementation can be used, as the board is fastened to the casing of the delay line, which is also the same in the 7S14 and the 5S14N, there is no need to figure out where to put the extra board. Given all this, my approach was very simple: make a copy of the boards.

I used KiCad for the whole process. First, I entered the schematics into ESchema basically copying the one in the service manual. 


The components are simple, the resitors must have the same value as on the schematic, as they control the currents for the readout. For the diodes, the usual 1N4148 or any similar diode is ok.

Substitutes had to be found for the transistors. For Q1 and Q2 I used MPSA14 NPN Darlingtons. Q3 and Q4 PF5101 N jFETs and for Q5 and Q6 2N2222 NPN transistors.

Q5 and 6 have to have Uce above 30 v and Q3 and 4 have to have UGS above 30 V. The later is especially critical, as a lot of jFETs has this voltage lower, they will break down and possibly blow the readout current switch in the scope. There are a lot of devices that may be used, just make sure, you get the pinout right on the PCB, or change the design to suit.

Then design the PCB. The placements of the components are in the service manual, but the layout is not, or at least was not readable in my copy. So I basically used the same placement of the components and then designed the layout myself. There is nothing critical in there and it is simple enough to easily implement on a double sided board, even without using vias.



Once done, it was sent to JLCPCB for manufacturing, and after some time, I had a very nice PCB.
The KiCAD project and Gerber files are available at https://github.com/szigix/5S14N-readout

Interconnect for the horizontal board

This is easy. The horizontal board has the pin headers already populated for the readout so all I needed were a couple pieces of ribbon cable with pin header socket on each end. Unfortunately I did not have the crimp connectors used by Tektronix, so I simply soldered pin header sockets at the end of the cables. I made them a bit longer than what is really necessary, so it would be easier to assemble.

Interconnect for the vertical board

This is similar to the horizontal board, some ribbon cables with socket at the end. Not too easy to plug them into the vertical switch board, but long tweezers and sharp eyes can help.

The only exception is P4 on the readout board, which goes to P4-1 and P6-3 on the horizontal board. Those headers already have connectors on them, but the one pin missing. I found some crimp connector sockets that I was able to insert into the connector housing and used that. All other connectors go to the vertical switch board, which is hard to access, but otherwise pose no problem.

Be careful not to mix P3 and P4 they are both two pin connectors next to each other. Mixing them may blow Q5 and Q6.
 

Attenuator connection

This one is a fiddly job. We need the connection from the attenuator switches, uncal switches and Ch2 invert switch to the readout board. Very very fortunately, the the rotary switches for the attenuators contain the wafer and contacts for the readout. Without them, it would be probably pretty much impossible to retrofit readout. The same is true for the Variable pots, they do have the switches for the uncal indicator, just unconnected. So the task was to figure out what goes where and then how to connect.

The switches are hard to access, but by removing the fastener nuts from the switches and from the gain and the time diff pots, they can be wiggled out to access the connections. I soldered wires to them and after some switching back and forth and checking with a continuity tester I was able to find the pinout. The diagram shows what goes where. The pin names are referencing the names on the 7S14 schematics of the readout board. Looking at the wafer closer to the front of the instrument, there are five solder tabs, two of them are actually between the attenuator resistors. The pin for 2 and 5 are close to each other, so this positively identifies the whole setup. The switches for the two channels are in different orientation when in place, but the pinout is the same.
The "uncal" switches and the Ch 2 invert pushbutton are trivial. 6 wires come from Ch1 and 7 (because of invert) from Ch2. I laced the wires and soldered the connectors onto the other end.

This is the  connection for the wiring. P1 on the readout board is for Ch2:

P1-1 - col
P1-2 - 0
P1-3 - 00
P1-4 - 2
P1-5 - 5
P1-6 - uncal (<)
P1-7 - invert

P2 is for Ch1, be careful, this is not the same pinout:

P2-1 - uncal (<)
P2-2 - 5
P2-3 - 2
P2-4 - 00
P2-5 - 0
P2-6 -col 

This picture shows Ch2 already wired and the wires laced up, see the blue, red, white, green, brown wires soldered to the front wafer. Also, observ the blue wire (col) going to the Ch2 invert switch. Ch1 is still to go, some of the trimmers are removed from the front panel to provide access to the switch. 


The mainframe interface

This is easy, but not very elegant. Fortunately the fingers on the edge connector are there, but they are not connected to anything, just the bare pads. I wish Tektronix had put at least a solder pad next to them. So the solution is to simply solder the wire at the inner end of the connector, bodge wire style. That should do it. Once everything is tested, I will probably put a dab of epoxy there to mechanically stabilize the wires. Be careful no to pinch the wires when the frame holding the rear of the modules are put back.

Fortunately, there are holes that can conveniently be used to access the other side of the connector.

This is how the edge connectors are connected. The first 3 columns show the function of the pin, where Ch1c is Ch1 column current, Ch1r is row current and TS1 is TimeSlot pulse number 1, etc. 
The next two columns show where these are connected on the horizontal boards and the last two on the vertical boards. 10-1 means pin 1 of P10 of the readout board, except the two with the *, where these are connected to P4 of the vertical switch board.
 
Number  A  B     Horiz A  B    Vert A  B
24   Ch2c Ch2r    4-2*  10-1    6-3   6-4  
25   TS3   TS2    10-5  10-4    5-3   5-2
26   TS8   TS9    10-7  10-8    5-5   5-6
27   TS1   TS4    10-3  10-6    5-1   5-4
28   Ch1c Ch1r    4-1*  10-2    6-1   6-2

Putting it all together

So, how all this goes together? Some details are already mentioned above, so here are some general guidelines.

Use thin wires. There are a lot of wires connecting the readout board and there isn't much room below the horizontal board.I used ribbon cable for most of the interconnect and it takes up a lot of space. The best I could do is to loop some of them under the readout board, so they don't get pinched between the board and the cover of the horizontal cam switch cover.

The pin header should be as low as possible, because the pushrods for some of the front panel switches can get in the way.

Since there are a lot of wires, double check that everything is connected properly.



Saturday, February 20, 2021

YATPGPSDO - Yet Another TruePosition GPSDO - Part 3: the firmware

 In the previous part I described the hardware. So now it is time to write about the software.

First let's summarize what the software needs to do. The TruePosition board implements practically all function of the GPSDO, so we don't have to deal with processing GPS messages or implementing frequency counting or anything else like that. Except for one thing, the TruePosition board would only need power to operate. The one thing is that it won't boot without getting the $PROCEED command via its serial interface. So the bare minimum software is something that send this command and stops. But, of course that is not enough. I want a cool instrument with blinkenlights!

I have to admit that the firmware for this instrument was developed/evolved during some time, while simultaneously learning TruePosition, STM32-Arduino and the u8g2 graphics library. As a result, the code quality is far from best.

Design goals and features

I came up with some design goals and required features for the software:

  • Implement basic functions to drive the TruePosition board. Sent the startup command and any additional configuration command. Monitor status of the board.
  • Provide a usable, concise and aesthetic user interface. Provide means to get detailed data but also have a 'quick glance' way to see the current state.
  • Provide configurable option for timezone, display backlight and position.
  • Be robust. The instrument should tolerate and if possible recover from any issue and notify the user on them.

Basic structure

The development environment was the Arduino implementation for STM32. I initially though that the simple Arduino structure of setup() and loop() was not going to be enough, and I would need to step up to some more complex solution such FreeRTOS, but eventually it turned out to be sufficient. 

The basic structure of the firmware actually very much follows this pattern. After setting up the display, serial lines, etc. it goes into a loop, where it reads character from the GPSDO, detects key presses, handles timing and updates the display and LEDs if required. If enough character is read so that a complete message is received then it is processed. Same for the key presses.

The main loop checks if messages are received from the TruePosition. If they do not appear for a length of time, then the GPS lost message is displayed and the Fail LED is lit. This should not happen in normal operation unless the board stops working or the serial connection is disconnected.

If the boot message is received, the firmware send the $PROCEED command to initiate the booting and waits for the first $STATUS message at which time the GPSDO is considered initialized. 

The User Interface

For main user interface there is a 128x64 pixel bitmap LCD. Obviously a much simpler display would also work, but it looks cool. Incidentally the bulk of the code is about creating the pages for this LCD.

There are two buttons, the Mode and the Select. The Mode button cycles between the pages. On some of these pages the short press of the Select will chose between options and the long press will activate that option. Finally, there are four LEDs. One is for power, on the left side of the front panel, which is always green as long as the device is switched on. The other leds are on the right to the display. The green LED indicates the Locked state. So if there are two green then he GPSDO is locked and operating properly.  The next LED is yellow, which is on if the GPSDO is in Holdover. Finally the red LED indicates fault condition, like disconnected antenna. Additionally there are other states and transitions, like startup or acquisition indicated by blinking and/or combinations of the LEDs.

These are the display pages.

1 - General status page. This is the default page. The status bar shown the current status (such as locked, holdover, etc.). There is an icon to indicate whether the TruePosition is in normal or survey mode. An antenna symbol shown that an antenna is detected and finally there are two indicators for the operation of the 10Mhz and 1PPS output. Although I have never seen the GPSDO board indicate that these are not operational. 

The current time is displayed, as well as how long the device has been locked or in holdover.

Finally at the bottom the number of satellites tracked, the DOP value, the control voltage for the oscillator and the temperature is shown. 

2 - The next page is the clock page. Current time and date and the quality of the timing is shown as well as an analog clock.


3 - Then comes the satellites page. The left shows the constellation and on the right the list of satellites. SNR is a small bargraph in front of each satellite data row in the list. 

4 - The position page comes next. Latitude, longitude, elevation and number of satellites are displayed. Pressing the Select button increases the survey time while long press of the same button initiates a survey.

5 - The final page is the configuration page. Short press of select cycles trough the lines and long press changes that line. Yes, it is not the most ergonomic solution.


The first line sets the time-offset from -12 to +12 hours. The next sets the backlight to always on, always off and automatic.  These settings are not persistent, unless saved using the Save config line. The last line is 'Load last position'. When the configuration is saved, the current position is saved. However, as opposed to backlight and timezone offset it is not automatically reloaded at startup. Instead this menu can be used to load the position, to speed up acquisition.

The source code and the KiCAD files are available under GPL V3 on Github: https://github.com/szigix/YATPGPSDO