CommonPIC32

Annotated examples/vga/README.txt

69:f3a4ee69fdfc
2018-10-27 Paul Boddie Added example image data and a function to copy the data to the framebuffer. Added a tool to prepare image data from conventional bitmap files.
paul@31 1
Introduction
paul@31 2
------------
paul@31 3
paul@36 4
This example demonstrates the generation of an analogue VGA signal from a
paul@36 5
PIC32 microcontroller using general output pins. It follows on from the work
paul@36 6
done in the VGAPIC32 project. The result is not entirely satisfactory:
paul@31 7
paul@36 8
 * Every fourth pixel is wider than the others, this apparently being an
paul@36 9
   artefact of the DMA transfer mechanism.
paul@31 10
paul@46 11
It might be possible to introduce some kind of delay and even out the pixel
paul@46 12
widths, but this has not been investigated with hardware. However, unlike the
paul@46 13
vga-pmp example, there is no accompanying signal to potentially orchestrate
paul@46 14
the staging of individual pixels at a slightly delayed rate.
paul@46 15
paul@46 16
Attempts to introduce other remedies to the wide pixel problem have been made
paul@46 17
with the vga-dual and vga-timer examples.
paul@31 18
paul@31 19
Hardware Details
paul@31 20
================
paul@31 21
paul@31 22
The pin usage of this solution is documented below.
paul@31 23
paul@31 24
PIC32MX270F256B-50I/SP Pin Assignments
paul@31 25
--------------------------------------
paul@31 26
paul@31 27
MCLR#          1  \/  28
paul@31 28
HSYNC/OC1/RA0  2      27
paul@31 29
VSYNC/OC2/RA1  3      26 RB15/U1TX
paul@31 30
       D0/RB0  4      25 RB14
paul@31 31
       D1/RB1  5      24 RB13/U1RX
paul@31 32
       D2/RB2  6      23
paul@31 33
       D3/RB3  7      22 RB11/PGEC2
paul@31 34
               8      21 RB10/PGEC3
paul@31 35
          RA2  9      20
paul@31 36
          RA3 10      19
paul@31 37
       D4/RB4 11      18 RB9
paul@31 38
              12      17 RB8
paul@31 39
              13      16 RB7/D7
paul@31 40
       D5/RB5 14      15
paul@31 41
paul@31 42
Note that RB6 is not available on pin 15 on this device (it is needed for VBUS
paul@31 43
unlike the MX170 variant).
paul@31 44
paul@31 45
UART Connections
paul@31 46
----------------
paul@31 47
paul@31 48
UART1 is exposed by the RB13 and RB15 pins.
paul@31 49
paul@31 50
Data Signal Routing
paul@31 51
-------------------
paul@31 52
paul@31 53
For one bit of intensity, two bits per colour channel:
paul@31 54
paul@31 55
D7 -> 2200R -> I
paul@31 56
paul@31 57
I -> diode -> R
paul@31 58
I -> diode -> G
paul@31 59
I -> diode -> B
paul@31 60
paul@31 61
D6 (not connected)
paul@31 62
paul@31 63
D5 -> 470R -> R
paul@31 64
D4 -> 1000R -> R
paul@31 65
D3 -> 470R -> G
paul@31 66
D2 -> 1000R -> G
paul@31 67
D1 -> 470R -> B
paul@31 68
D0 -> 1000R -> B
paul@31 69
paul@31 70
HSYNC -> HS
paul@31 71
VSYNC -> VS
paul@31 72
paul@31 73
Output Socket Pinout
paul@31 74
--------------------
paul@31 75
paul@31 76
  5 (GND)  4 (NC)   3 (B)    2 (G)    1 (R)
paul@31 77
paul@31 78
      10 (GND) 9 (NC)   8 (GND)  7 (GND)  6 (GND)
paul@31 79
paul@31 80
  15 (NC)  14 (VS)  13 (HS)  12 (NC)  11 (NC)
paul@31 81
paul@31 82
Output Cable Pinout
paul@31 83
-------------------
paul@31 84
paul@31 85
      1 (R)    2 (G)    3 (B)    4 (NC)   5 (GND)
paul@31 86
paul@31 87
  6 (GND)  7 (GND)  8 (GND)  9 (NC)   10 (GND)
paul@31 88
paul@31 89
      11 (NC)  12 (NC)  13 (HS)  14 (VS)  15 (NC)
paul@31 90
paul@31 91
References
paul@31 92
----------
paul@31 93
paul@31 94
https://en.wikipedia.org/wiki/VGA_connector
paul@31 95
paul@31 96
http://papilio.cc/index.php?n=Papilio.VGAWing
paul@31 97
paul@31 98
http://lucidscience.com/pro-vga%20video%20generator-2.aspx
paul@31 99
paul@31 100
https://sites.google.com/site/h2obsession/CBM/C128/rgbi-to-vga