Author Topic: Weird lines on VGA controller?  (Read 2471 times)

0 Members and 1 Guest are viewing this topic.

Offline pyrohaz

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Weird lines on VGA controller?
« on: February 16, 2015, 03:14:04 am »
Hi all,

After successfully designing a basic VGA controller in VHDL, I decided to have a go using my STM32F0 discovery board. My timers are synchronized to a 40Mhz clock (the whole MCU is running at 40MHz to simplify timings) and my monitor is syncing fine with the VSync and HSync signals, the colours however are really weird. I've written a simple program to draw vertical coloured bars and while the coloured bars work, there also seem to be some horizontal bars along with the vertical bars which isn't what I was expecting at all. If I ground all three colour inputs, the output stays black though the monitor remains synced.

I'm using the timer onepulse modes to create the VSync and HSync pulses. The one pulse mode only works from timer update to the relative capture compare (as far as I know!) so I resolved the phase difference between the VSync and HSync timers by setting the initial conditions to make the timers start at different periods. My code is: http://pastebin.com/xCF7qrhn

Could anyone fathom a guess to this weird colouring phenomenon?

Cheers!
« Last Edit: February 16, 2015, 03:39:45 am by pyrohaz »
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4309
  • Country: us
  • KE7GKP
Re: Weird lines on VGA controller?
« Reply #1 on: February 16, 2015, 03:24:39 am »
It looks like you are sending only the odd (or even).
You photo appears to show that only every OTHER line has your color bars on it.
That looks like a clear sign of a field problem.
 

Offline pyrohaz

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: Weird lines on VGA controller?
« Reply #2 on: February 16, 2015, 03:40:43 am »
It looks like you are sending only the odd (or even).
You photo appears to show that only every OTHER line has your color bars on it.
That looks like a clear sign of a field problem.

Hi Richard,

Thank you for your swift reply! I see what you mean with respect to the colour every other line (I hadn't noticed that!) Would you care to elaborate on what you mean with respect to a "field problem"?

Thanks,
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4309
  • Country: us
  • KE7GKP
Re: Weird lines on VGA controller?
« Reply #3 on: February 16, 2015, 04:53:36 am »
I don't know how you are generating the video data, but you are creating only half of what you need.  NTSC and PAL send odd/even frames alternately. The "even" frame contains all the even-numbered lines, and the "odd" frame contains all the odd-number lines.  You are generating only ONE of those frames, and the other one is blank (black).
 

Offline bktemp

  • Super Contributor
  • ***
  • Posts: 1623
  • Country: de
Re: Weird lines on VGA controller?
« Reply #4 on: February 16, 2015, 06:16:32 am »
VGA is ac coupled: You need to set all outputs to black at the end of each line.
 

Offline voja

  • Contributor
  • Posts: 45
  • Country: 00
Re: Weird lines on VGA controller?
« Reply #5 on: February 16, 2015, 07:56:47 am »
Check your timings, this is the result of bad horizontal sync locking. Either the horizontal sync is way too long, or the time between horizontal sync signals is longer than required, so the monitor misses one horizontal sync and waits for next one, displaying nothing in the meantime, resulting in black line. There is a good timing list for all VGA resolutions and vertical refresh frequences at http://tinyvga.com/vga-timing
:( + :( = :) :)
 

Offline pyrohaz

  • Regular Contributor
  • *
  • Posts: 186
  • Country: gb
    • Harris' Electronics!
Re: Weird lines on VGA controller?
« Reply #6 on: February 16, 2015, 02:29:46 pm »
VGA is ac coupled: You need to set all outputs to black at the end of each line.

This seemed to be the problem! After scoping my colour channels and comparing them to my HSync signal, it turned out the colours were still high during the HSync pulse and that was causing the problem. After clearing up my code a little, the problem was solved!

Thank you all for the help.
 

Offline ryanmoore

  • Contributor
  • Posts: 20
  • Country: gb
Re: Weird lines on VGA controller?
« Reply #7 on: February 16, 2015, 02:52:08 pm »
I don't know how you are generating the video data, but you are creating only half of what you need.  NTSC and PAL send odd/even frames alternately. The "even" frame contains all the even-numbered lines, and the "odd" frame contains all the odd-number lines.  You are generating only ONE of those frames, and the other one is blank (black).

VGA doesn't use interlacing for any of the common display modes.
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4309
  • Country: us
  • KE7GKP
Re: Weird lines on VGA controller?
« Reply #8 on: February 16, 2015, 04:19:01 pm »
VGA doesn't use interlacing for any of the common display modes.

Bzzzzt! I skipped right over that!  I shouldn't try responding in the middle of the night.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf