Shop OBEX P1 Docs P2 Docs Learn Events
Early VGA drivers — Parallax Forums

Early VGA drivers

After playing with NTSC on my DE0-Nano, I tried to make some VGA drivers.
There is no description of the color modulator so far, but fortunately it's very similar to the old P2-hot. So I managed to get scaling and sync working.
With a 50 MHz clock the best fit is 640x480 standard VGA, because you can use a pixel frequency of 25 MHz.

I tried different streamer modes, and the RFBYTE RGBI8 allows to generate color bars very easy. Color bars are better than pictures to judge the quality of the driver, and they need very few memory, which is important for the Nano.

In the attached ZIP is a colorbar driver and a bitmap driver with 320x240 pixels signaled as 640x480. The bird-picture is very pixelated, as I had to reduce the resolution to 256x96 to make it fit in the 32kB memory of the DE0-Nano.

Andy
320 x 240 - 10K

Comments

  • I haven't even had a look at any video stuff yet but I'd like to have VGA for my Tachyon once Chip updates the bootloader to handle SPI Flash. Since I have the filesystem running and testing networking, plus I have a built-in assembler I think about the only other thing I need to make a stand-alone development system is to interface a PS/2 keyboard and write a simple screen editor. Actually I might even program up a little ARM chip as the USB HID host so I can just output serial to the P2 for the keyboard but PS/2 is easy enough for the moment.

    So I would be interested in what you may come up with given your limited ability to test on the DE0.
  • Awesome Ariba, do you mind if I mix it into the TV code? so we can make a one driver fits all? once we add Component also?
  • AribaAriba Posts: 2,690
    Baggers wrote: »
    Awesome Ariba, do you mind if I mix it into the TV code? so we can make a one driver fits all? once we add Component also?

    For that I have made it. Perhaps you have noticed that I used the same names for all the variables as the NTSC drivers does, so a merge should be easy :thumb:

    Andy
  • Good job Andy.
  • Excellent, nice one bud :D
  • RaymanRayman Posts: 14,640
    edited 2015-11-13 20:51
    I got your bird going with DE0-nano and 15" Coby LCD TV with VGA input.

    Doesn't work with DE2-115 though. Maybe VGA connections are different?

    Doesn't work on P123-A7 either...

    I wonder if Chip needs to connect the sync signals to FPGA outputs...
    I just looked at P123 schematic and can't figure it out...
  • AribaAriba Posts: 2,690
    edited 2015-11-13 22:37
    Rayman

    Hsync should be on one of the DACs (I think DAC0), and Vsync is on PA0. Perhaps you can test the signals at the VGA connector and the headers with a scope.

    As far as I know with the P2-hot image the VGA drivers were compatible for DE0-Nano and DE2-115.

    Andy
  • The h/vsync signals on the P123-A7 are not connected to DAC's and share with the EXP-C connector.
    AFAIK they are not yet implemented in the P123-A7 FPGA image.
  • cgraceycgracey Posts: 14,152
    ozpropdev wrote: »
    The h/vsync signals on the P123-A7 are not connected to DAC's and share with the EXP-C connector.
    AFAIK they are not yet implemented in the P123-A7 FPGA image.

    That's correct. You can't generate sync signals for VGA, yet.

    On the next release, I'll make VGA HSYNC go high when DAC0 is not 0. I'll also make VGA VSYNC a regular pin. This will give complete VGA ports to cogs 0 and 1. On both cogs, DAC0 will be reduced to a digital output. This will enable VGA, but still work for TV and HDTV signalling, as well.
  • Rayman did you plug the VGA cable into the add-on board? or into the DE2-115 board? because it worked on my DE2-115 last night.
  • RaymanRayman Posts: 14,640
    Strange... Just tried it again and nothing... Just flashed it with latest image yesterday...
  • Ah, not sure I used yesterday's image.
  • Try the previous one?
  • Ignore that, just checked it is 15b
  • RaymanRayman Posts: 14,640
    edited 2015-11-14 15:33
    Are you saying you have the latest image loaded too?
    Maybe your monitor doesn't need vsync?
    Or, maybe something is wrong with my setup...
  • Yeah, it would appear I have the latest image.
    It's an LG 1080p LCD Monitor/TV
  • Baggers wrote: »
    Ignore that, just checked it is 15b

    Latest filenames end in _v4c.extension.

    I think Chip made two updates with the same 15 or 15b number, or perhaps, 15, 15a, 15b, but the filenames differ, so check for that ending and you won't go wrong.
  • RaymanRayman Posts: 14,640
    Ok, I downloaded latest, reseated parallax board and reloaded code

    --> It works! Don't know what was the problem before though...
  • Glad it's working now Rayman :D
  • RaymanRayman Posts: 14,640
    edited 2015-11-17 15:42
    I just hacked Andy's code to show a 640x480 photo.

    The photo is 8-bit bitmap with a special palette.
    The output actually doesn't use the palette, it's just the RRRGGGBB direct mode...
    Used Photoshop to set the palette and do some error diffusion to make it look good.
    This is on DE2-115. There's not enough RAM for the whole photo.
    Hopefully Chip will get us new P123 images with VGA enabled soon...
    1496 x 1122 - 616K
  • RaymanRayman Posts: 14,640
    Here's using the palette (I don't think you can tell the difference.)
    1496 x 1122 - 529K
  • RaymanRayman Posts: 14,640
    Here's a try at 4bpp. Whole image fits, but there are some problems...

    First, looks like nibble order is backwards. Not sure what to do about that...
    Also, the bottom line is messed up. I don't think it's a memory issue,,

  • jmgjmg Posts: 15,173
    Rayman wrote: »
    Here's using the palette (I don't think you can tell the difference.)
    A palette should allow more choice within certain common colours, (ie better blending) and that effect does seems to be visible here, when you do a A:B comparison.
  • cgraceycgracey Posts: 14,152
    That 3:3:2 RGB image looks pretty good for having no palette.

    Have you got a picture of the 4bpp image using the file I posted for you that properly arranges the bitfields (nibble swap, in this case)?
  • RaymanRayman Posts: 14,640
    edited 2015-11-20 11:17
    Here's the 4-bit bird, all better now on P123:

    (It actually looks better in the photo than it does on the screen... On the screen, the pixilation is much more noticeable compared to 8-bit per pixel...)
    640 x 480 - 85K
Sign In or Register to comment.