Close

Text is looking good :)

A project log for RA8875 VGA

Let's use a LCD driver to drive a VGA monitor. It sounds fun.

dylan-brophyDylan Brophy 08/15/2024 at 03:360 Comments

I've got the #Arduino Desktop running the card and a keyboard, so I have an actual interface/prompt now.  The text is looking pretty good, but there are streaks from the text so there must be something messed up in the video signal.

There is some trailing white blur after the text, so I wonder if the voltage on the RGB lines is not dropping as fast as it should or something.  Here I ran some commands to test out the text.

Just last night or so I didn't even have the pixels working right, and to be completely honest, I have no idea exactly what made the pixels want to show up.  My theory is that adding a software reset before initialization fixes it, but I don't really know, and due to the nature of resets it's not the easiest thing to test.  Whatever, it works, and it seems to work consistently.  Here's the reset code:

writeCommand(RA8875_PWRR);
writeData(RA8875_PWRR_SOFTRESET);
writeData(RA8875_PWRR_NORMAL);
bootloader_delay(1);

 Now, when I did get the pixels working, it was still messed up:

It's hard to tell in the picture, but the pixels are not exact and kinda messed up.  The video quality also changed when I touched the back of the board, which would seem to indicate a signal integrity issue.  In fact, it seemed that many of the pixels were dropped completely, but there was a pattern to it, so the text was still somewhat legible.  I thought the RA8875's connections to the PCB must have been bad, which made *some* sense, since I had replaced the RA8875 chip twice and there wasn't much solder left on the pins.  I checked this, and the video did look a little better, but it still was wrong.  I decided to try changing the pixel clock polarity, and this fixed the problem.  Again, the relevant code:

GraphicsDisplayDevice* initVideoCard(ParallelBusDevice* bus) {
  timing_params_t timing;

  timing.pixclk = RA8875_PCSR_PDATR;
  timing.hsync_nondisp = 88;
  timing.hsync_start = 40;
  timing.hsync_pw = 128;
  timing.hsync_finetune = 0;
  timing.vsync_nondisp = 23 + (600 - 480) / 2;
  timing.vsync_start = 1 + (600 - 480) / 2;
  timing.vsync_pw = 4;
  timing.voffset = 0;
  timing.width = 800;
  timing.height = 480;

  // SYSCLK = ((PLLC1 & 15) + 1) * 20Mhz / 4
  // For PLLC1 = 7, SYSCLK = 40Mhz
  timing.PLLC1 = RA8875_PLLC1_PLLDIV1 + 7;

  return new RA8875Parallel(bus, &timing);
}

This is the correct code to make the RA8875 output a valid 800x480 VGA signal.  I based it on my experimentation, and on the tinyvga site, which is a great resource by the way:  http://tinyvga.com/vga-timing/800x600@60Hz

The timing I'm using is for 800x600, but I lengthened the vertical porches to make up the difference in y resolution.

Discussions