AVR VGA generator

avr-vga-generator

This simple circuitry makes up the hardware for [Andrew's] AVR-based VGA generator. He managed to get an ATmega1284 to output a stable VGA signal. Anyone who’s looked into the VGA standard will know that this is quite an accomplishment. That’s because VGA is all about timing, and that presented him with a problem almost immediately.

The chip is meant to run at a top speed of 20 MHz. [Andrew] did manage to get code written that implemented the horizontal and vertical sync at this speed. But there weren’t enough clock cycles left to deal with frame buffering. His solution was to overclock the chip to 25 MHz. We assume he chose that because he had a crystal on hand, because we think it would have been easier to use a 25.174 MHz crystal which is one of the speeds listed in the specification.

Red, green, and blue each get their own two-bit range selected via a set of resistors for a total of 64 colors. As you can see in the video after the break, the 128×96 pixel video is up and running. [Andrew] plans to enlarge the scope of the project from here to make it more versatile than just showing standard images. The code (written in assembly) is available at his GitHub repository.

17 thoughts on “AVR VGA generator

  1. This is very awesome. I have to recommend a Propeller chip if you want to do vga out, but there is a lot of elegance in this method. I wonder if it’d play well with the 25.174?

    1. The pi is enormous and very expensive compared to a single AVR.

      Say you wanted to make a throwaway dongle to fit on the back of some monitors for a gag, you wouldn’t be using rpis for that would you?

      1. RPi has major issues with overscan takes ages to get it setup right. Why is this? Howcome’s all my other HDMI devices work out the box? Just curious.

        1. Because it is engineered for use with TVs, which by default (for some stupid reason) have some sort of 10% image zooming turned on.

          Usually when you turn it off you get more visible picture from your other sources too!

        2. That’s not an issue with the Raspberry Pi. It’s an issue with Raspbian, the debian distro that the foundation provides.

  2. Why not use an XMEGA ? They support up to 32 MHz natively (and require minimal adjustments when migrating from normal avrs )….

  3. Nice work, done alot of VGA work with FPGA’s luckily once you get it working on that you’re usually golden once you derive the proper clocks. Your milage may vary applies to digital tv’s more than ever. What works on one may not even on another of the same model!

  4. I Did this for my school final… I ran into a bunch of problems. But I used a 16F877A chip running at 4 MHz and the only real output I got was a checker pattern. a basic off/on on the output… I tried to get it to run at 20 Mhz, but I just couldn’t get it to work.. Even though I failed the project, I got a 100% due to me recognizing the limitations of the chip in the writeup… The teacher was real impressed I was able to do as much as I did with it..

  5. Also of use for doing this, Quinn Dunki has done it with a Atmega324, running at 10 MHz instead of overclocking. Halving the resolution to let you get away with some better timing and a few other things like that.

  6. Done it on an Uno once, used the timers for sync and SPI for pixel out, managed to get reasonably high res (2 actual pixels per soft pixel and 4 lines per soft line) that way

  7. nice presentation, implementation props for sharing the code.
    can’t wait to see the character se in action for updating images.t

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s