Archive for June, 2020

MDA tester

June 28, 2020

The Haas at i3detroit has been acting up. Not the complicated functional part of the machine, just the monitor. It has a tendency to lose all vertical deflection (mostly) and flat-line. It’s still apparent that the signal into the monitor is ok, you can still make out that the screen that was being shown was flattened, but it’s like the vertical deflection part of the monitor just took a vacation. That vacation was not well deserved or earned from many long years of service. This monitor is from 2012 and has very little time on it. We got this machine donated in november of 2013 so most, if not all, of the time that monitor has had was in a light duty non-production capacity. So it has come time to fix the monitor.

Almost, but not quite a full collapse

Let’s step back in time to a happier place, VCF midwest 2019. A time when a packed convention hall full of people gawking over hardware ranging from slightly older than me to significantly older than me was perfectly normal and not a harbinger of disease and death. Ok, maybe not normal to everyone but at least not the other thing. I had come across some people selling unpopulated PCBs for various projects and I was happy to talk myself into some more stuff to do. The one I picked up that is relevant here is this MDA/CGA/EGA to VGA converter board. It takes digital video signals and converts them to analog video signals. This may not sound like an improvement, but VGA has been around for a LONG time and will probably still be supported for more time in the future. Those other standards… not much can take those signals these days. this converter board takes in the digital signals and builds a digital representation of the screen on the ram it has, then recreates a vga signal based on that image. The timings here are super critical and since they are not an even multiple of each other some clever work has to be done to make sure no data gets missed in either the saving of the data or the generation of the new signal.

There it is, dangling

I picked up this board to use it to get vga video out of the 80 column chip on a commodore 128 which outputs digital rgb video (or monochrome composite). I never got to try that. It is now sitting inside the haas at i3 translating from mda to vga and shooting the resulting image out to a generic little dell lcd monitor. This converter board is interesting because even though it takes a little soldering skill and patience to source parts and a programmer for the fpga onboard, it is still remarkably cheap for what it does. It is probably the cheapest MDA to VGA converter board out there right now. I will caution you when building this, the CoreEP4CE6 is cheaper than the chip onboard on its own. That should tell you the relative quality of this board is very, very poor. I had to reflow the solder on the qfp because so many were cold solder joints, but it does work. That has us sorted for now, but I still want to see about fixing this CRT.

Mounted, working, sane people would just leave it like this forever

In order to fix the CRT, I really need a way to drive it while it’s on the bench. I know some people are satisfied with function generators to make sync pulses and throw some junk in the video lines but I wanted something I knew was correct, something exact that I could calibrate to. I needed to generate a real MDA video signal. This is not as easy as you might think. MDA was an early monochrome computer video output standard, but even though it wasn’t particularly short-lived I don’t have anything that uses it. This means I need to synthesize it myself. At its heart MDA is a 16.257Mhz clock signal that drives everything. 720 pixels wide, each taking 1 clock cycle to display. Then 10 pixes of downtime, 135 pixels of a horizontal sync pulse (on a different wire), 17 pixels of downtime, then start again with another line of 720 displayable pixels. After 350 displayable lines the vertical sync wire goes low for a time the equivalent of 16 lines, then 4 lines of nothing and we’re back to displaying that first line again. That’s not so hard. Provided you have a source for that specific frequency clock and hardware that can make those pulses just right.

Stolen from an mda/cga monitor manual (D is your displayable area width and I is your displaysble area height)

Doing this on a microprocessor is certainly possible, but you would need one faster than the signal you are trying to generate, potentially much faster if you are using a high level programming language or an architecture that takes many cycles to perform one instruction. You might get away with one slower than your generated signal if you use DMA but that is beyond the scope of this project. I decided it would take much less guesswork about timing if I were to just do it on an fpga. While processors (even extremely large and pipelined ones) are deterministic with respect to timing, it takes much much more work to determine exactly when something will happen and if it will continue to do so with any regularity. The fpga is set up to let me specify, every clock cycle, what happens. There’s a few things that made MDA generation different from VGA generation as you might find in books or other tutorials. First, let’s talk about signal levels.

My fpga development board of choice is the mojo v3. At the time it was one of the most fully featured and expandable boards out there and even includes an armega32u4 for uploading code and providing analog inputs. This is probably no longer the device of choice for hobbyists but it’s what I have. There were several add-on boards for my fpga available when it was new, one with ram onboard (because ram takes up a lot of space if you build it in an fpga, it’s cheaper to use a smaller fpga and have offboard ram), one with a bunch of microphones, one with hdmi ports and ram (potentially interesting, but for a later time) and one for connecting servos. I jumped at the servo shield because it boasted 24 pins of bidirectional 5v tolerance for my fpga pins. My intention for this bosrd was always to interface with 74xx and 40xx series logic so I figured the MAX3002 chips that were intended to talk to the PPM input on a servo motor would be just the ticket to talk to higher voltage vintage electronics. They are supposedly good to 20Mbps data rate which should be well over the 16.257Mhz we’ll be expecting them to do.

The short answer is that did not work, the level shifters introduced an unknown source of interference that made the video signals nearly unrecognizable. I lament that I don’t have pictures of the scope traces for this issue, but it was bad. Running the perfect mda signal into my known good converter gave me this:

Not the rectangle it should be


The drive strength of the fpga pins themselves is enough to get in MDA range so I declared that good enough and was rewarded with this beautiful picture:

10 pixel rectangle around the perimiter

Now that we know how to wire the FPGA, what do we do about programming? (This is a bit backward from my bumbling, but it makes for a more linear explanation of issues and solutions). Fortunately for us, generating VGA video is a fairly common early project in fpga tutorials and we can cut out a bunch of stuff right away. First, we don’t need more than one bit for video (MDA does have an intensity pin, but it’s not populated on this monitor). That means any code talking about multiple bits per color can go right out the window. Next is an issue though, how do we get that clock signal we need? The pixel clock for VGA that the examples I found used was 25Mhz, it’s supposed to be 25.175 but 25 is close enough for most use cases and the monitor will just deal. To get 25Mhz from 50Mhz (the native clock of the mojo) you just divide it by two. That’s pretty easy, each rising edge of the main clock you flip the bit representing your slower clock, that means it takes twice as many clock cycles input to get clock cycles output. Divide by two. But how do you get 16.257Mhz from 50Mhz? You could divide by three and get 16.666Mhz which would probably work. For that you would want to act on both the rising and falling edges of the 50mhz signal, keeping your signal in sync and keeping the duty cycle 50%. That seems complicated (and the wrong frequency besides). How about something that will get us the exact frequency we want, but dithered a bit to account for not being divisible by the master clock?

Let’s imagine we are trying to manually line up our clock signals. After one tick of 50Mhz we pass 20 nanoseconds, great. How many do we want before we flip our 16.275mhz clock? 61.44ns. Ok, so keep going. After three cycles at 50Mhz we hit 60ns, still not where we want to be for our slower clock but the next tick will be a lot more. Do it anyway. At the next cycle we flip our slower clock, that’s 80ns we waited, equivalent to a 12.5Mhz clock, way too slow. We keep going. Our next chance comes at 100ns but for 2 cycles of our slow clock we want to be at 122.88ns. Next pulse is at 120, still not there yet. Next pulse is at 140ns and we switch. Now we have taken 2 cycles of our slow clock in 7 cycles of our fast one. That works out to 14.29Mhz on average. If we keep going we eventually average out to our 16.275Mhz clock, but our clock pulses are uneven. They may be uneven, but they don’t drift. Because we keep accumulating and reference the start time and not the last approximate pulse’s time it works out that we average our target frequency. This is like having a counter and adding a number to it over and over. When that counter overflows we still have the remainder (the ‘error’) and we continue counting to the next pulse fron where the first pulse should have been, not where it was. By keeping that remainder we make sure that our pulses do not drift from where they are supposed to be, but end up as close as possible to where they need to be. In my code that counter is 2^32 bits large (4,294,967,296 in decimal), and I add 1,396,465,667 to it each clock cycle. After three clock cycles it will not be full, but on the fourth it will overflow and have a remainder. I keep adding to that remainder until it overflows again, and again, each time incrementing the slower clock. Maybe I took more space explaining this concept than needed, but it’s the real difficult part of the project to get your head around. Everything else is just counting pixels or lines and deciding if you can draw on the screen or if it’s time for a sync pulse.

That’s really it. Based on the explanation above we draw for 720 slow clock cycles, then wait, then pulse another line for our horizontal sync. Do that 350 times and then we pulse the vertical sync line, wait, and start all over. I made some basic patterns to display based on that, of which the 10px border seemed the most useful. It turns on the video signal if it’s on the first 10 lines, the last 10 lines, or if it’s on the first or last 10 pixels of any line.

The code is a conglomeration of a bunch of examples and I’ve been unable to get back to it to clean it up into a nice module like the vga module it started as but for now it’s one big hacked up blob of verilog.

<previously the old code was pasted here, it is now uploaded to github>

The above code contains a bunch of cruft like using the built in button and LEDs, as well as a bunch of unused signals created by the video generation that would be good for drawing more complex images. Let’s see how it looks on the CRT.

Rectangle drawn


Ok, who can see the pachyderm in the corner just staring at us? There’s something obviously different between the video the haas generates / CRT takes and the MDA signal my tester generates / the fpga converter likes. The Haas signal on my converter is shifted off the left side and my fpga signal on the CRT is shifted to the right. This tells me that the signal generated by the haas has a smaller hsync pulse than we’re expecting (or possibly smaller downtime). I’ve been told the hercules version of MDA (same signal, but bitmapped graphics instead of just text) uses a 16.000Mhz pixel clock, perhaps the hsync pulses are also smaller? I should go poke the haas with a scope and see how it actually transmits. It’s not perfect MDA.

EDIT:

I did eventually get around to creating a module for the MDA generation and moved the logic of deciding what to draw to the main module. This should allow better readability and the ability to do more complex things to the screen. That code is now hosted on github.

Garrard model 3500 turntable made standalone

June 28, 2020

I’ve been refurbishing a Packard Bell solid state stereo console (probably close to an RPC-720) and I decided to remove the built in turntable and fit my own in its place.  Technically mine is less featureful in that it doesn’t do 78rpm [Edit: I fixed that], but it was a gift and is of better quality than the old one. That being said it seems this turntable still works (once I lubed it a bit) and I made it into a standalone box so it could still be of some use. 

It seems to use a U-21.1 829 stylus.  I found some information on this indicating that it’s a ceramic cartridge, but it also is a later model one that has a signal strong enough to use a magnetic cartridge preamplifier.  I cannot confirm that because I had an unused preamp (this one) and could get nothing out of the turntable.  I tried isolating the preamp circuit in the stereo console radio module and was able to use just that portion of the circuit and route it out to a separate amplifier. 

preamp functioning isolated from the rest of the radio unit

Now I needed to trace the circuit and luckily it was standalone and just used the dc power supply in the radio unit to power the preamp.  Here’s the circuit I traced:

This is a mono amp, there are two of these in the console

I decided to remove that from the radio and just route the input signal to the output so I can use my turntable with built in preamp here. 

well labeled board harvested of components and bypassed

Now I need to reassemble the components into a small box, let’s use that preamp I tried earlier and has not been super useful. 

there’s also components on bottom

This works, it’s not ideal from an audio quality standpoint, but right now my priority is making this thing useful, not good. 

4 pin plug, green earth, black switched mains, red hot, black neutral

One thing that I didn’t expect is the turntable being just straight mains powered and having switched mains out.  That switched mains is used to power an external amp, I mounted an interesting set of outlets on the back of the turntable box, you can use it for an amp if you like.  I also used some right angle mounted audio jacks stolen from the original cabinet and a nice switched and breaker-ed mains input jack I found. 

No idea where I got those outlets but I have a bunch and I love them

That’s that.  It works, now.  Some handles and some feet and now it’s at least a moderately servicable turntable which can continue to be useful.

rename bluetooth modules

June 22, 2020

I intend to install bluetooth modules in both my vintage cars, and my stereo console, but the generic module names are super boring. I decided to follow this article and rename them so they show up as something descriptive. I also used this hack to allow for a custom programmer based on a couple dollar FTDI chip. My module was not a big achievement because I bought the exact module that is described in the instructable, it just worked.

that’s 1.27mm pitch header, I made it a socket

What was an achievement was hacking this TaoTronics module that a friend used in his car. It uses a CSR8635 which should also program using my method proved above, but what’s the pinout of the module? Luckily the chip is not BGA so I can trace the module pins from the chip pins.

After much tracing I discovered this, my arbitrary pin numbering starts at 1 on the left of the bottom tow of the module and increases as you move to the right. 5: CS, 8: MOSI, 9: CLK, 14: SPI_EN, 15: MISO. We powered the module from the main 5v input to the puck and used a 1v8 labeled pin to tie to SPI_EN (also grounded to a labeled GND pad). This worked and allowed us to flash the module.

There, another module traced, now go forth and hack! The software is now here because qualcomm got a little stingy and feels like encouraging people to use competitor’s modules by not allowing access anymore.

EDIT: Important note, because of the frankly moronic way windows handles usb serial ports you need to make sure to check what port the ftdi shows up as and run Zadig to change the driver EVERY SINGLE TIME you unplug the ftdi board. I’m now on COM91… Stupid fucking windows.

esp-link telnet adapter

June 22, 2020

OK, this makes me a bit annoyed. I get people wanting to make money and not open sourcing things, but the wifi232 made a big splash and now it’s been literally three years since they were sold out and there’s no indication that they’ll be back ever again. If anyone has one and wants to mail me one I happen to know how much protection the esp8266 has to prevent just dumping the entire code memory as a binary file (it’s none!). Until then we have to deal with other wifi modem firmwares. I saw the the Retro Wifi SI in a recent hackaday post and while it’s good, it’s also a little expensive (and shipping to the US is also expensive). I also don’t exactly need a full modem, just a virtual serial port to telnet adapter. I decided to use the esp-link firmware that I’ve used before to just set up a super simple transparent serial link. Combining that with a d1 mini, a couple LEDs, a 3.3v-5v level shifter board, a max232 breakout board, and a db25 and shell makes this:

Things to remember: redirect the debug output somewhere other than the main serial pins, swap the main serial pins so the esp doesn’t barf on boot at a strange baud rate. Use the latest (3.0+) firmware to get baud rates less than 9600. If you have a max3232 breakout board you no longer need to double amplify the signal, it will work straight from 3.3v.

Computer switchbox repair and upgrade

June 22, 2020

I have this switchbox I’ve been using for literal decades and I decided to dump an unreasonable amount of money into upgrading it and repairing what amounts to trash in most people’s eyes.

Original condition, failing neon tubes

I wanted to do two things: replace the neon tubes in the switches and upgrade the surge protection from a phone jack to an ethernet jack.

phone jacks replaced with ethernet jacks

Here you can see the replacing of telephone jacks with ethernet keystone jacks. That involved filing out the squares to fit the new jacks and gluing them in. I terminated them with pigtails so they could be plugged into an ethernet surge protector. I realize that this may inhibit transfer speeds, but it’s not a huge deal to me.

there it is, all installed

Now we reach the real difficult part, disassembling 30 year old switches that were never meant to be opened to solder onto thermally sensitive components that were originally crimped and fitting it all back together. I can sum this up: I failed and I don’t recommend trying.

I ended up breaking the fragile plastic here and gluing it never worked, to solve this I ended up sourcing replacement switches. I wanted ones with different color fronts (my original switches were amber and the master was red) but I only found one type, here. That seemed to work, but since all the crimp connectors were soldered it was a lot of work getting them off.

color scheme reversed, used one of the best old switches as the master

There it is, purchased 5 specialty switches, 2 keystone jacks, an ethernet cable, and a surge protector. It’s now all packed up for another 30 years of use. After seeing my efforts here let me explain something to you. Do not do this. Like, why would you? Seriously, this was just a waste.

Tektronix 2336 YA Oscilloscope repair

June 22, 2020

Recently a friend asked me to take a look at his oscilloscope. I could write a whole story here, but basically this: it took me a while to find the service manual for this scope (so it’s now on the internet archive here) but I didn’t need it. The symptoms were a burning smell and no trace on the screen except a blip when it is turned on after recently being turned off.

this is the blip

A forum post that helped someone else also seems to have the single issue that may befall this model of scope. I found it here and will quote it in case that link goes down:

I had a similar problem and suggest checking on the A15 board, C108 (.005uf) for shorted, and R113 (1.6K) for burnt changed value.

As info, if the 102 voltage is ok, it suggests that the high voltage circuitry is working ok.

Looking at the parts in question I did find a shorted cap and burned resistor. Tektronix lists the cap as “CAP.,FXD,PLSTC:0.005UF,0.1%,200V” which is… just ludicrous. Most caps are 20% tolerance, even today. 10% or 5% are available in most values, but 1% is just strange. 0.1% is just out of this world nuts.

The shorted cap in question

The actual cap seems to be 1%, which is less stupid of a component choice but still… Also a more modern value would be 0.0047uF because that value at a standard tolerance includes the possibility of being 0.005uF. 200v in the application seems needed, so we need to replace it with a larger value. 450v seems to be common on digikey, but in our parts bin we find…..

1200v! pretty damn god enough

here we see the replaced cap and resistor. I used a 1.8k resistor because it’s what I had. It’s good enough.

There, working, done.

This was an easy-ish fix because someone else had already figured out the issue. I’m here to assure you that component values don’t matter that much and tektronix is nuts for putting a 0.1% 200v capacitor in the 102v power supply circuit in their scope. Good luck repairing things in the upcoming appocalypse!