aboutsummaryrefslogtreecommitdiffstats
path: root/notes/vga.txt
blob: d75281a86f3ca99f8eb94ba6903fd1cced15c8e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

Notes on GPIO Writing
------------------------------------------------------------------------------
Classic digitalWrite() gives ~500ns pulse time (2MHz)

gpio_write_bit() is about 360ns (2.78MHz)

Writing to GPIO?_BASE is about 60ns (16.6MHz -> 18MHz)

pwm write 0x0001 is about 30ns (33MHz) with prescaler as 1 (default)
pwm write 0x0001 is about 14ns (72MHz) with prescaler as 0 (!)

VGA Timing
------------------------------------------------------------------------------
1/25.125MHz = 39.72ns (640x480 pixel clock)

Crude 640x480 directions:
    From www.epanorama.net/documents/pc/vga_timing.html
    480 lines
    31.77 us horizontal line length -> 2287.44 clock cycles -> 2287
    3.77 us sync period -> 271 clocks -> 271
    1.89 us front porch? -> 136 clocks -> 136
    25.17 us video -> 1812.24 clocks -> 1812
   
    So... 
    2287 reload 
    271  1: Hsync high
    407  2: Video on
    2219 3: Video off
    2287 4: Hsync low

    Vertically, it's 
    480 lines active video
    11 lines front porch
    2 lines Vsync (low)
    31 lines back porch

Currently, setting vs. clearing GPIO registers seems to take a different amount
of time? Or perhaps i'm not analyzing branching correctly. Regardless, if you
SET 100x times then UNSET on one line, then UNSET 100x then SET the next line,
the two changes in color will generally not line up.