Finally, over 5 years after I started this thread, here we are: VGA 640x480 in grayscale on a Classic CRT!
The above image is displayed with an original CRT and an original (modified) analog board, with a replica Xceed CRT neck board for grayscale. The display is coming from an LC II but could be any VGA source.
A synopsis for those just joining this thread: the goal is to increase the resolution of the compact Mac screen from 512x342 to 640x480 (or higher). There have been several nice hacks of the display before, but they usually involve replacing the CRT or at least putting in the guts of another monitor like a 12" Apple Monochrome Display. Here, I'm trying to increase the resolution using the existing CRT, existing analog board and existing flyback.
It turns out, for reasons explained earlier in the thread, that it's much easier to modify the late-model Classic analog board (used in the Classic II and later builds of the Classic) than any of the earlier compacts, because the late Classic board uses a different and more flexible flyback transformer.
The challenge in a nutshell is that increasing the screen resolution means increasing the horizontal scan frequency from 22.25kHz in the original to 31.5kHz (VGA) or higher. The horizontal sync is used to drive the flyback which generates all the voltages to the CRT, and the circuits in the compact Macs are very much
not multisync: they are finely tuned to operate at exactly 22.25kHz and VGA is a long way from that.
The specific barrier to higher horizontal scan rates is the retrace time -- how long it takes the beam to go from right to left of the screen. This is ~8us on most compacts, but for VGA it needs to be 5us or less, or you'll end up with foldover on the left part of the screen.
Shortening the retrace time inherently means increasing the retrace voltage pulse (see earlier plots in this thread). That pulse is what powers the flyback and generates all the CRT voltages. Increase the pulse and all the other voltages go up with it, which is bad. Hence the problem changing resolution.
Anyway, I found a working solution. It needs the following large components:
1. Classic or Classic II with
late-model analog board (logic board is not used)
2. Micron Xceed replica grayscale CRT neck board - I used a PCB from @Bolle.
3. Benchtop power supply capable of generating 45V at 0.3A. Highly recommended that this is adjustable so you can ramp it up slowly for testing.
4. VGA signal source - I used an LC II, but it could be anything
These are the modifications to the analog board (referring to BOMARC schematic):
1. Replace capacitor CL6 (originally 0.028uF) with 8.2nF, rated at 600V or higher
2. Replace MOSFET QL2 (originally IRF740) with IPP80R280P7 or similar (rated at 800V)
3. Remove voltage regular IP2 (LM317) and diode DP13. The 45V benchtop supply should patch into the output of IP2 (pin 2). It may also be beneficial to replace CP11 (220uF/50V) with a part with a higher voltage rating, though I haven't done this.
4. (This is the part that took me the longest to figure out) Cut the trace going to pin 4 of the flyback transformer (which connects it to the now-45V supply). Wind 16 turns of wire around the core of the flyback (see photo) and solder across the trace you just cut. Starting from the side of the trace connected to the power supply, the windings should go counterclockwise around the core, finally connecting to pin 4 of the flyback. More on this below.
5. HSYNC and VSYNC need to be supplied by the external VGA signal. At least for HSYNC the sync pulse needs to be lengthened to >10us for the analog board to be happy with it. This can be done with a 74LS123 one-shot multivibrator (I also use a similar circuit for VSYNC). These connect to pin 5 (violet wire) and pin 4 (grey wire) of the cable that goes to the logic board.
6. The CRT neck board is soldered to the analog board in the Classic. It needs to be desoldered to attach the Xceed neck board. I found it helpful to desolder the wires at the neck board side and attach a 12-pin Molex connector like on the SE/30 analog board, so that I could use the existing cable harness I had for the Xceed. The VGA video signal bypasses the analog board entirely and goes straight from the HD15 connector into pin 6 on the Xceed board.
7. Without the logic board, there's no brightness control. I replaced it with a signal generator but a constant 5V source should work fine. It goes to pin 9 (blue wire) of the cable assembly that goes toward the logic board.
Once all of that is done, it can be tested and adjusted. For testing, I usually bring up the video signal and 5V to the 74LS123, then I power on the Classic, then finally I gradually bring up the 45V supply voltage to the flyback. It's important the sync signal stays stable while the circuit is powered. I blew up a couple MOSFETs when I turned off the 5V supply and the MOSFET stayed on too long, resulting in an enormous voltage spike when it finally turned off.
To get the picture mostly centred, turn PL3 (H. Center) control to its minimum value.
Even at a standard resolution, the Xceed board needs some adjustment. With the brightness all the way up, I adjusted PL2 (Cut-Off) on the analog board and the trim on the CRT neck board until I was happy with the brightness and linearity of the grayscale. Then I adjusted the focus (PL1).
Why it works:
Reducing CL6 from 28nF to 8.2nF reduces the retrace time to 5.0us. This is short enough to fit between scan lines at VGA, where there is 6.3us from the end of the visible part of one line to the start of the next.
Because the horizontal frequency is higher, the beam needs to move faster across the screen. That means we need a higher drive voltage than before. In the original Classic the flyback is driven from 30V, but I found 45V produced the right width of picture.
The result of the above will be a much higher retrace pulse: 486V instead of 310V. That would blow up the original QL2, which is why we substitute the higher-spec part.
Now the big problem is that all the flyback secondary voltages are directly proportional to the retrace pulse. We really don't want everything to be 50% higher! I stumbled around on this for a while, before I realised that we could change the turns ratio of the transformer just by winding some extra turns around the core. Basically, we want more turns on the primary side. I arrived at 16 turns by trial and error. I haven't tested this on other machines, and I don't know if it is sensitive to how tightly the turns are wound or what gauge of wire is used. Based on my measurements I expect 16 is a minimum number of turns rather than a maximum.
The 74LS123 is needed because the Classic HSYNC circuitry filters out signals that don't stay low for at least ~10us. Without it you'll get no retrace pulse at all. Also we need QL2 to stay turned off for the entirety of the retrace time, which is actually a bit longer than the VGA sync pulse.
With all of these modifications in place, I measured the following voltages:
Pulse at CL6: 486V / 5.0us [original: 310V / 8.0us]
CL1: 13.0V [original: 14.7V on my set; BOMARC says 12.6V]
CL2: -131V [original: -123V on my set; BOMARC says -109V]
CL5: 786V [original: 740V on my set]
HV: estimated at about 14kV [BOMARC says 13kV]
The video signal is fairly clean though it looks like there's a possibility of slight ghosting because of an impedance mismatch between VGA and the Xceed board. That needs further investigation, but the good news is that the levels match out of the box. My modification drives the Xceed video amplifier with a 45V supply rather than 30V, but I haven't seen any adverse effects of this.
Next I need to tidy this up a bit and try to reduce the dependence on external supplies (e.g. find a boost converter for the 45V). I'd like to get this into an SE/30, but its flyback transformer is much less flexible. So one possibility is to design a hybrid board where the horizontal circuits of a Classic could be transplanted into an SE/30 form factor.