Archive for August, 2008
Video Bringup: Part 2
Video works! Er, sort of. After fixing the HYSNC problem, I experimented with the palette chip, just to prove it was working. With a few bytes’ worth of changes, I was able to turn everything red.
The monitor was still confused about the resolution, though, thinking it was 1152×864 when it was really 640×480. You can see in the photo above how the whole image appears twice on the screen. It should be a solid red screen.
After a little quality time with the oscilloscope, I discovered that my HSYNC fix hadn’t fixed anything at all, it had merely broken it in a different way. I reprogrammed the GAL that generates HSYNC, this time fixing the bug for real. Suddenly the monitor started showing pretty much what I expected: a screen full of garbage at 640×480. Success, of a sort.
Now that things were behaving a little more sensibly, I started to worry about those light/dark vertical lines you can see in the image above. That’s not a result of the garbage data in video memory, as the lines extend straight through blocks of solid colors. It’s some kind of electrical noise creeping into the video output. It’s strange, because the lines are very “solid” and consistent, not blurry or wavy or intermittent like I would expect noise to be. I believe the 20MHz pixel clock is somehow leaking into the video output, because when I examined the VGA signal on the oscilloscope, the noise seemed to have have a 20MHz frequency. Maybe not though, because the lines aren’t just simple alternating light and dark bands, but are a repeating series of various lighter and darker vertical lines. So it seems I need some filter capacitors somewhere, or termination resistors, or a voodoo doll or something. Uh, yeah. This is basically why I’m a software guy and not an electrical engineer.
The analog VGA output is generated by a UM70C171 palette chip that I’ve mentioned several times before. I pulled it off an old video card that I dug out of the bottom of a box at Weird Stuff, a Silicon Valley warehouse of electronics junk. At the time I also bought a second old video card that had a chip made by Music Semiconductor, that I guessed was a UM70C171 clone, since its part number included the digits C171, it was the same size and shape, and the video card itself was similar. On a whim, I decided to try swapping in the Music chip, to see if it might be any more noise tolerant than the UM70C171. In retrospect, that was a little dangerous, since I really had no idea if the Music chip was some completely different IC that might fry BMOW when I swapped it in. But I threw caution to the wind, stuck in the mystery Music chip, and turned on the power. To my pleasure, not only did it work, but the noise seemed significantly reduced.
If you click the photo, you can view a larger version where the vertical noise bands are still visible. Areas that should be solid colors have thin vertical lines of varying brightness running through them. I really don’t know what causes this.
I decided to ignore the vertical lines for the moment, and set to work exercising the video modes. It’s funny, after having designed the video system, you’d think I’d know exactly what values to store where in memory to setup a particular mode or draw an image, but really I don’t. The video system schematics just prove that video is theoretically possible, but they don’t directly show you how to do it. It took me quite a while to figure out exactly where the video RAM and control registers mapped into memory, and what values to set in order make the right things happen. Honestly, I’ve only just begun to scratch the surface of it. I guess I need to write myself some documentation or a manual as I go.
Just poking bytes into memory using the monitor program, I was able to get things to happen, but I wasn’t always exactly sure what video mode I was in, or which options were currently enabled. So now I’ve reached the point where I can make things happen on the screen, but I’m not sure they’re quite what’s supposed to be happening. More time reviewing the schematics and GAL equations is needed to decipher it all. Why did I make this thing so darn complicated? I probably should have gone for a single video mode, at a fixed resolution and bit depth, and screw all this flexibility.
Nevertheless, I did get as far as clearing the screen, and turning on a single pixel in the center. I think this was in 128×480 @ 256 colors mode, but I’m not really sure. Help!
Next steps:
- Figure out what’s going on with those vertical lines, or learn to live with them.
- Reverse-engineer my own too-complicated design, so I can learn how to use it to create images.
- It seems as if the image is too dark by about 50%. What should be full white appears medium gray. I need to double-check the signal levels with the oscilloscope: they should be 0.7v for the analog VGA signals.
- Clearing the screen often causes the monitor to temporarily lose sync. Why? HSYNC and VSYNC should be unaffected by the contents of memory. Maybe some bus noise is causing false triggering of the sync signals?
- Depending on the method I use to clear the screen, it crashes BMOW. Hopefully that’s just a bug in my clear screen subroutine, and not another noise problem.
- Once all of the questions above are more or less resolved, I’ll add the character generator ROM so I can print some text.
Video Bringup: Part 1
After an eternity of procrastination and wire-wrapping, I finally finished BMOW’s video subsystem. Well, not quite finished really: the character generator is still missing, but the all the hardware is there to support the pure graphics modes. It’s about time!
With anticipation I flipped the power switch and was greeted with: nothing. The monitor turned on, which was promising, but all I saw on the screen was some faint gray noise on a black background. I spent about an hour troubleshooting, trying different video modes and palette settings, with no change. At last I realized a very stupid mistake: I’d forgotten to place all of the discrete components! The current reference, diode, and assorted resistors were still sitting neatly in a box. I put them into their places on the board, turned on power again, I saw this.
I was expecting either blackness, or some kind of static noise pattern, given that the contents of video memory were uninitialized. I wasn’t expecting this, though. Seen live, it’s even stranger than it looks in the photo. The image is flickering and dancing like crazy. It even looks as though the vertical refresh is starting at random locations within the frame, and sometimes it never gets all the way to painting the bottom of the image before it starts again at the top. Ugh. At that point I was tired and discouraged, and went to bed. Hopefully it won’t prove too difficult to resolve.
Read 3 comments and join the conversationLoads o’ Random Stuff
Yesterday I found an interesting advertisement. A Berkeley student was moving out of the area, and was selling his entire collection of electronics and robotics parts for $50. Of course I had to pick it up, so I’m now the proud owner of more random electronics stuff than you can imagine! Click the photos below to see larger versions.
Some of the more notable parts of the collection:
- An AIRat2 maze-solving robot. This apparently sells for $400 new! But this one is missing its LCD panel, and I don’t have the software for it. Still, I bet I can get it doing something interesting.
- A second half-built robot, with a couple of geared motors.
- A servo and a stepper motor (I think).
- Assorted robot tires.
- Two sonar rangefinders.
- A Sharp rangefinder (IR based?)
- A Xilinx CPLD development board.
- Some kind of camera and interface board.
- Four 11 volt lithium-polymer battery packs, and a LiPo charger.
- Tons of NiMH and NiCd rechargables.
- A 12 volt, 1 amp power supply.
- A solar panel.
- Lots of protoboards.
- Four LCD text displays.
- Assorted ICs: op-amps, voltage regulators, 555 timers, and more.
- A pile of IR and visible LEDs.
- A “helping hands” tool.
- A very nice wire cutter/stripper tool.
- A zillion feet of wire of various gauges and types.
- A lifetime supply of resistors, capacitors, diodes, transistors, relays, pots, switches, headers, etc.
That’s a ton of stuff! Hopefully I’ll get a chance to use it all well. Some of the parts like the batteries, CPLD, and passive components I can definitely use, but others like the robot or the sonar rangefinder will require a decent investment of time to investigate.
Read 7 comments and join the conversationWire Wrapping Pain
I’m beginning to really hate wire-wrapping. Sure, it’s easy to make modifications to the wiring, and the finished result will be nice and sturdy, but it’s SO SLOW to build! Now that my board is getting pretty full, it’s hard to even see the pin numbers, and I have to hunt around to find the endpoints of each wire. And especially when I need a length of wire that I don’t already have pre-cut, I have to spend more time measuring, cutting, and stripping. All told, I’m averaging a couple of minutes per wire. After about an hour of wire-wrapping, my brain overdoses on connections from AG32 to BB08, I begin to feel dizzy, and I have to stop. This has been my first wire-wrapping project, and I think it will be my last.
What then, if not wire-wrapping? A solderless protoboard is nice for prototyping, but doesn’t work well for large designs. It’s also not very permanent, since it’s easy to accidentally knock a wire loose. I could hand-solder point-to-point wires on a breadboard, but I think that would be like wire-wrapping, only worse. For medium-large designs like BMOW, I think the only real alternative is custom printed circuit boards. Unfortunately custom manufactured PCBs are expensive, at $50 to $100 depending on the size and quality. They’re also difficult to modify if you discover an error, so you’ll probably need to go through several versions of the PCB before you get something that works. Some people have had good success making their own PCBs at home, but it involves some nasty chemicals and drilling lots of holes and other headaches I’d rather avoid.
I did some comparison shopping for a hypothetical 4×6 inch 2-layer custom PCB:
Futurlec: $41 for a single plain board. $77 with soldermask and silkscreen.
BatchPCB: $70, including soldermask and silkscreen. Long lead times.
ExpressPCB: about $70, no soldermask or silkscreen.
Most places have a fairly high setup cost, but low cost for bigger boards, or higher quantities of boards. For example, Golden Phoenix will make a 100 square inch board with soldermask and silkscren for $89, and a 155 square inch board for $99.
Read 3 comments and join the conversationVideo Update
I’ve been distracted by some other projects, and haven’t made as much progress on BMOW as I’d like. They were interesting distractions, at least: I worked on a crystal radio project with my daughter, and did some brainstorming about a completely new home-built computer design. I did manage to finish about 25% of the video system wiring, though, and I’m almost at the point where I can test for correct operation of the HSYNC and VSYNC signals. If I can find more time this weekend, and I don’t run out of wire, I should be able to tackle most of what’s left.
Read 4 comments and join the conversation