• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Mac-to-VGA monitor adapter struggles

NJRoadfan

Well-known member
I would give cleaning the C-sync to H-sync a shot. My bet is on the 66Hz problem though. ViewSonic panels can be picky based on my own experiences. The VG150 my parents had sometimes needed a hard reset to display video on some computers I used it on. Mind you, these were bog standard PCs! I think the NVRAM was retaining previous modes and not re-syncing. Its response to this was to play dead and remain in standby.
 

bigmessowires

Well-known member
Do you have a thought about how to process the CSYNC to make proper HSYNC? In theory you could just invert CSYNC whenever VSYNC is asserted, and there's some discussion about that approach here. But in this case since the extracted VSYNC doesn't actually match the periods where CSYNC is inverted, that won't work.
 

dougg3

Well-known member
My bet is on the 66Hz problem though.

It does seem more likely that the refresh rate would be the problem, but if you look up the manual for the VG900b it claims to support 50-75 Hz. But maybe even though it says that, it only supports a few standard rates in that range?

I guess one way to narrow it down would be to actually generate a 66 Hz video signal with an FPGA or whatever, which does have a "normal looking" hsync and vsync and see if the monitor accepts it...seems like a lot of effort though!

Or maybe "encabulator" should be part of the name?

How have I never heard about this joke before? LOL...this is a gem.

In all seriousness I'm terrible at coming up with names, sorry!
 

sfiera

Well-known member
I need a name for this thing... ideas? Some permutation of the words Mac, VGA, sync, strip, -inator, big numbers, and an Australian marsupial. Mac Sync Koala-inator? MacVGA Ripper 5000? Sugar Glider Video-inator? Or just something boring like Mac to VGA Sync Separator Adapter?
If you want Australia but aren’t picky about it being a marsupial, you could call it the “Dinkum Sync’em”

(I suppose I’m cribbing Heinlein’s “dinkum thinkum” there)
 

bigmessowires

Well-known member
At least for my purposes, I'd rather just use a basic LM1881 circuit and not worry about getting a true HSYNC if it's not easily obtainable, or would require an entirely different chip. I was really only looking to pretty-up what I've already done into a PCB kit, not try to invent the last word in sync processors. But if there's some simple improvement I could make, I'll do it.

Hmm, I actually read the LM1881 datasheet for the first time, and I think it's not being used correctly here, or in many of the similar circuits seen on the web.

1. Recommended input voltage on pin 2 is 1.5V and absolute max is 3V, but I'm feeding it a 5V sync signal from the Mac.
2. Different RC filtering schemes on input pin 2 may be needed, the 0.1 uF blocking capacitor is just an example. "Typical Applications" shows a design with an RC lowpass filter instead.
3. R-set resistor value needs to be adjusted for... something related to video timing? The default 680 kOhm may not be right for this.
4. The outputs can only source a few mA of current, but if I'm putting 5V into a 75 ohm terminated monitor input, won't that be 67 mA? Do I need to buffer these signals? 67 mA is a pretty large amount of current.

“Dinkum Sync’em”

Lol.
I guess one way to narrow it down would be to actually generate a 66 Hz video signal with an FPGA or whatever, which does have a "normal looking" hsync and vsync and see if the monitor accepts it...seems like a lot of effort though!
That's true... something like a Pi Pico could probably do it too, or even a discrete video generation circuit like this one I built 15 years ago! But I'm not sure my level of interest extends that far.
 

NJRoadfan

Well-known member
If you need to generate specific video modes, an old PC with a compatible video card (ATI is common) and the "Powerstrip" application can be used.


If you are looking for LM1881 experts or experts in "old" video standards in general, the SHMUPS Hardware Forum is the place to go: https://shmups.system11.org/viewforum.php?f=6
 

bigmessowires

Well-known member
  • Switch 1 is DB-15 sense 0 (4)
  • Switch 2 is DB-15 sense 1 (7)
  • Switch 3 is DB-15 sense 2 (10)
  • Switch 4 is GND
    • Switches 1-4 being on connect themselves to each other. Just like sfiera's 6 switch adapter but arranged slightly differently.
  • Switch 5 connects VGA HSYNC (13) to DB-15 CSYNC (3).
  • Switch 6 connects VGA HSYNC (13) to DB-15 HSYNC (15).
  • Switch 7 connects VGA VSYNC (14) to DB-15 VSYNC (12).
  • Switch 8 enables a diode between sense 1 and 2.
  • Switch 9 enables a diode between sense 1 and 2 in the other direction.
    • For anyone in the future who cares about which diode is which, when switch 8 is on, my meter shows a 0.545 V diode drop with my common lead on pin 7 and my positive lead on pin 10.
  • No idea what switch 10 does...maybe nothing at all. Instructions don't refer to it.
Reading this again, setting both switches 5 and 6 would connect the Mac's CSYNC and HSYNC outputs together. That seems a little dangerous. There are series resistors on these signals inside the Mac, so maybe it wouldn't be harmful.

Maybe switch 10 isn't used, but 10-position DIP packages were easier to source than 9-position ones?

I think my new adapter might need 11 switches. It needs to support all of the combinations above, plus:

- connect VGA HSYNC to LM1881 CSYNC out
- connect VGA VSYNC to LM1881 VSYNC out

It would be great if I could somehow drop one switch... 11 is an awkward number.
 

dougg3

Well-known member
Reading this again, setting both switches 5 and 6 would connect the Mac's CSYNC and HSYNC outputs together. That seems a little dangerous.

I agree, I found that to be confusing. It was surprising to see that the documentation actually suggested it as a combination ("mode 2" = composite sync 2). The documentation even confirms it -- "DB-15M pins 3 & 15 conn HD-15F pin 13". I wonder what the intent is?

I've written a loooong post for the blog

Great write-up!
 

bigmessowires

Well-known member
Maybe it's assuming those signals are open drain, and can be safely AND-ed together with a direct connection? I don't see a pull-up resistor anywhere, though.
 

dougg3

Well-known member
Yeah, it would have to be intended for some other Mac source device that isn't just driving them...

You're probably not super interested in the VG900b part of the saga at this point, but I thought I'd share a few notes I collected as I tried to play "LCD detective".
  • According to eBay the VG900b uses a PWB-5623 display board.
  • According to a Chinese site, this PWB-5623 board uses the Realtek RTD2513 flat panel display controller chip.
  • I found a datasheet for this chip online. The site is super duper slow to download from, but it's there.
  • If indeed this chip is being used in the VG900b, the datasheet claims this chip supports sync on green. 🤣 There's even a pin dedicated for it I guess? Not sure why that would exist on top of the green input pin.
  • I did notice the chip requires some setup for SOG, for example on page 42 there's a sync-on-green enable bit in a register. So maybe the lack of SOG support is a firmware limitation, like they didn't bother writing the software to try SOG if separate syncs didn't work.
 

bigmessowires

Well-known member
Good sleuthing on the VG900b. My sample certainly doesn't appear to accept SOG, so maybe it's a firmware issue. I had two more thoughts about the VG900b troubles, based around the idea it might be a signal quality or signal timing problem. Remember how I found a glitch at the beginning of most HSYNC pulses in the LM1881's CSYNC output? Well, there's actually no reason for me to use the LM1881 CSYNC output at all, since it should be identical to the Mac's CSYNC output. I can just pass the Mac's CSYNC directly to the VGA connector, and if that signal's a little cleaner, maybe it will help. I also thought about why the glitch might exist. I am feeding a 5V CSYNC signal into the LM1881 input that expects a 1.5V peak-to-peak composite video signal, and that has an absolute maximum rating of 3V. Maybe that's causing some glitching (and possibly some damage). I'll try using a voltage divider to reduce the CSYNC signal from the Mac.

I'm feeling under the gun to figure out this stuff asap, since all three of these fussy monitors are slated to be given away or sold in 9 days at Mactoberfest. I won't have anything to test against after that. It's not very likely that I can design a PCB and have it assembled and tested in 9 days.

For troubleshooting purposes, it would be nice to have LEDs that show if there's activity on CSYNC, or on HSYNC/VSYNC, or neither. I need a way to detect if those signals are changing, and not simply stuck high or stuck low. I'm thinking of using a monostable multivibrator 74HC123 for this, configured to output a short high pulse every time there's a rising edge on one of the sync signals. As long as the sync signal keeps changing, the '123 will keep getting triggered and will produce a continuous high output that can power an LED.

Then I started thinking about how else this activity detector might be used. If I have a way of detecting activity on the Mac's sync pins, then I could also use that info to auto-configure some of the VGA connections instead of requiring DIP switches. If there's activity on the Mac's HSYNC/VSYNC, then for sure we want to connect those signals to the VGA HSYNC/VSYNC. If there's no activity on the Mac's HSYNC/VSYNC, but there is activity on CSYNC, then for sure we want to connect the Mac's CSYNC to VGA HSYNC. This would eliminate the need for two or three DIP switches, but at the cost of more circuit complexity. Not sure it's worth it.
 

bigmessowires

Well-known member
I also found this circuit using an LM1881 and some NANDs that claims to produce a true HSYNC output. But after staring at it, and comparing it to the CSYNC and VSYNC outputs that I got from the LM1881 (see my logic analyzer captures above), I don't think this circuit works.

schema_scartotovga.jpg
 

bigmessowires

Well-known member
I added a voltage divider for the Mac's CSYNC output to reduce the signal to about 1.1V before it's connected to the LM1881 input. This still worked, but didn't obviously help anything.

Then I rewired the adapter to provide the Mac's CSYNC signal directly to the VGA HSYNC pin, instead of using the LM1881's CSYNC output. In theory, both signals should be the same. This made a huge improvement in picture quality on the Dell monitor, and eliminated all of the shimmering. But sadly the VG900b still didn't work. I'm curious why this made such a difference. It seems that the LM1881 CSYNC output jitters and glitches, but I'm not sure why.

Finally I tried completely disconnecting the VSYNC and HSYNC/CSYNC wires from the VGA side, so it was sync on green or bust. I thought maybe if the VG900b can secretly support SOG, it's getting confused by the presence of other sync signals too, and eliminating them might help. Nope. Still no picture from the VG900b. I'm ready to retire the VG900b to the category of "doesn't work, don't know why" and focus on finishing up this adapter that's still hopefully useful for other models of monitor like my two CRTs.
 

bigmessowires

Well-known member
Here's a schematic. Feedback please.

mac-vga-lm1881.png
I tried to keep the behavior of switches 1-9 identical to the 10-pin adapter that was mapped out earlier in this thread. I'm not sure I got the directions of the diodes correct for switches 8 and 9. Switch 10 connects the LM1881 VSYNC output to VGA VSYNC. Notice that the LM1881's VSYNC is driven through a 180 ohm series resistor, which is some termination voodoo I copied from the VSYNC output in the IIci schematics. I don't know why it's not 75 ohms. Maybe it could be omitted. Also notice that the LM1881's CSYNC output isn't used for anything.

The LM1881 set resistor (R3) was lowered from the standard 680K value to 510K. I'm not sure this is needed, but I think if this adapter were ever used at higher resolutions there's a chance that 680K would result in the "no vsync pulse" problem mentioned in the datasheet. It may take some experimenting to get the right value here.

The Mac's CSYNC goes through a voltage divider to reduce it from 5V to about 1V for the LM1881. I'm not sure if this is actually necessary, but directly connecting the 5V signal would seem to exceed the LM1881's maximum input voltage rating for that pin.

The adapter will attempt to self-power through a rectifier on all three Mac sync inputs. I have some doubt this will work, since it seems like the diode drop and losses from the Mac's termination resistors would result in a self-power voltage well below 5V, but this AppleFritter thread from 2005 says it worked. Initially I had a switch to select between self-power and external power, but I ran out of space and just connected them directly. Because of the diodes, if you connect an external 5V supply at J3 then the adapter will draw power from that instead of self-powering.

The 74LS123 one-shot controls the blinkenlights. If I've calculated correctly, each falling edge on the Mac's CSYNC or VSYNC will turn on the corresponding LED for 22 ms. As long as falling edges keep coming at least once every 22ms, the LED will stay lit. I couldn't figure out a simple way to trigger the same one-shot from both VSYNC and HSYNC without adding more hardware, so it only checks for activity on VSYNC. But based on what we've learned about the Mac video hardware, if VSYNC is active then HSYNC will also be active and vice-versa. I still need to add a decoupling capacitor for the '123. The whole LED business could be scrapped if it uses too much PCB area or power.
 

NJRoadfan

Well-known member
You may want to take a look at the Renesas ISL59885 chip. It is used in a device called..... The SyncSlayer. It outputs true horizontal sync.


The adapter above is not self powered though. Also note, all these chips aren't specced for TTL/5V sync levels on their inputs, but seem to work fine.
 

bigmessowires

Well-known member
Ahoy, it is routed. I put effort into squeezing everything as tight as possible, so it's only about 0.4 inches longer than it would be for a simple adapter with no active electronics.

mac-vga-lm1881-board.png
 
Top